From 0f8a320b6ad7fd215052bdafa1b71771f2a9d8cc Mon Sep 17 00:00:00 2001 From: "Quentin D.C" Date: Thu, 11 Apr 2024 07:59:41 +0100 Subject: [PATCH 1/8] Added new user fields in DB to fit offChain data --- .../migrations/20240411065853_new_user_fields/migration.sql | 4 ++++ prisma/schema.prisma | 3 +++ 2 files changed, 7 insertions(+) create mode 100644 prisma/migrations/20240411065853_new_user_fields/migration.sql diff --git a/prisma/migrations/20240411065853_new_user_fields/migration.sql b/prisma/migrations/20240411065853_new_user_fields/migration.sql new file mode 100644 index 00000000..b02cb31d --- /dev/null +++ b/prisma/migrations/20240411065853_new_user_fields/migration.sql @@ -0,0 +1,4 @@ +-- AlterTable +ALTER TABLE "User" ADD COLUMN "role" TEXT, +ADD COLUMN "title" TEXT, +ADD COLUMN "video" TEXT; diff --git a/prisma/schema.prisma b/prisma/schema.prisma index a8387072..2b95e0d4 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -43,6 +43,9 @@ model User { isEmailVerified Boolean @default(false) about String? picture String? + video String? + title String? + role String? counterStartDate Int @default(0) weeklyTransactionCounter Int @default(0) workerProfile WorkerProfile? @relation("WorkerProfile") From 730bea7ebeaab096ef4cc5b58d458df6b6209bdc Mon Sep 17 00:00:00 2001 From: "Quentin D.C" Date: Thu, 11 Apr 2024 10:03:33 +0100 Subject: [PATCH 2/8] Updated Form --- src/components/Form/ProfileForm.tsx | 60 +++++++++++++++++++++++++---- 1 file changed, 52 insertions(+), 8 deletions(-) diff --git a/src/components/Form/ProfileForm.tsx b/src/components/Form/ProfileForm.tsx index b8765312..a07af917 100644 --- a/src/components/Form/ProfileForm.tsx +++ b/src/components/Form/ProfileForm.tsx @@ -18,6 +18,7 @@ export interface IUpdateProfileFormValues { name?: string; about?: string; skills?: string; + email?: string; } const validationSchema = Yup.object({ @@ -36,14 +37,17 @@ function ProfileForm({ callback }: { callback?: () => void }) { return ; } + const initialSkills = user?.workerProfile?.skills.toString() || userDescription?.skills_raw || ''; + const initialValues: IUpdateProfileFormValues = { - title: userDescription?.title || '', - role: userDescription?.role || '', - image_url: userDescription?.image_url || user?.picture || '', - video_url: userDescription?.video_url || '', - name: userDescription?.name || user?.name || '', - about: userDescription?.about || '', - skills: userDescription?.skills_raw || '', + title: user?.title || userDescription?.title || '', + role: user?.role || userDescription?.role || '', + image_url: user?.picture || userDescription?.image_url || user?.picture || '', + video_url: user?.video || userDescription?.video_url || '', + name: user?.name || userDescription?.name || user?.name || '', + about: user?.about || userDescription?.about || '', + skills: initialSkills, + email: user?.email || '', }; const onSubmit = async ( @@ -99,6 +103,7 @@ function ProfileForm({ callback }: { callback?: () => void }) { + + + +