From 4cf9c7e604be56f14e805cb3ac720e4c57430867 Mon Sep 17 00:00:00 2001 From: Matheus Sanchez Date: Sat, 3 Feb 2024 17:35:01 -0300 Subject: [PATCH] adding standart photo --- .../20240203202946_standart_photo_orange/migration.sql | 9 +++++++++ prisma/schema.prisma | 2 +- src/controller/project/getProjectById.spec.ts | 2 +- src/controller/project/getProjectsByTags.spec.ts | 6 +++--- 4 files changed, 14 insertions(+), 5 deletions(-) create mode 100644 prisma/migrations/20240203202946_standart_photo_orange/migration.sql diff --git a/prisma/migrations/20240203202946_standart_photo_orange/migration.sql b/prisma/migrations/20240203202946_standart_photo_orange/migration.sql new file mode 100644 index 0000000..d1b6da1 --- /dev/null +++ b/prisma/migrations/20240203202946_standart_photo_orange/migration.sql @@ -0,0 +1,9 @@ +/* + Warnings: + + - Made the column `avatar_url` on table `User` required. This step will fail if there are existing NULL values in that column. + +*/ +-- AlterTable +ALTER TABLE "User" ALTER COLUMN "avatar_url" SET NOT NULL, +ALTER COLUMN "avatar_url" SET DEFAULT 'https://orangeapp-contents-prod.s3.amazonaws.com/avatar1.png'; diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 7915d14..42fd83d 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -13,7 +13,7 @@ model User { surname String? email String @unique password_hash String - avatar_url String? + avatar_url String @default("https://orangeapp-contents-prod.s3.amazonaws.com/avatar1.png") is_google Boolean @default(false) created_at DateTime @default(now()) updated_at DateTime @updatedAt diff --git a/src/controller/project/getProjectById.spec.ts b/src/controller/project/getProjectById.spec.ts index e00a447..8f0aeac 100644 --- a/src/controller/project/getProjectById.spec.ts +++ b/src/controller/project/getProjectById.spec.ts @@ -52,7 +52,7 @@ describe('Get Projets By ID E2E', () => { expect(getProjectByIdResponse.body.project).toEqual( expect.objectContaining({ title, - user: { name: 'John', surname: 'Doe', avatar_url: null }, + user: { name: 'John', surname: 'Doe', avatar_url: expect.any(String) }, tags, }), ) diff --git a/src/controller/project/getProjectsByTags.spec.ts b/src/controller/project/getProjectsByTags.spec.ts index 1565eaf..4d71165 100644 --- a/src/controller/project/getProjectsByTags.spec.ts +++ b/src/controller/project/getProjectsByTags.spec.ts @@ -68,13 +68,13 @@ describe('Get Projets By Tags E2E', () => { expect(getProjectsByTagsResponse.body.projects[0]).toEqual( expect.objectContaining({ title: 'Project 01', - user: { name: 'John', surname: 'Doe', avatar_url: null }, + user: { name: 'John', surname: 'Doe', avatar_url: expect.any(String) }, }), ) expect(getProjectsByTagsResponse.body.projects[1]).toEqual( expect.objectContaining({ title: 'Project 02', - user: { name: 'John', surname: 'Doe', avatar_url: null }, + user: { name: 'John', surname: 'Doe', avatar_url: expect.any(String) }, }), ) }) @@ -105,7 +105,7 @@ describe('Get Projets By Tags E2E', () => { expect(getProjectsByTagsResponse.body.projects[0]).toEqual( expect.objectContaining({ title: 'Project 03', - user: { name: 'John', surname: 'Doe', avatar_url: null }, + user: { name: 'John', surname: 'Doe', avatar_url: expect.any(String) }, }), ) })