diff --git a/apps/portal/src/pages/offers/test/createProfile.tsx b/apps/portal/src/pages/offers/test/createProfile.tsx index ad891ce1..8c3f0ff9 100644 --- a/apps/portal/src/pages/offers/test/createProfile.tsx +++ b/apps/portal/src/pages/offers/test/createProfile.tsx @@ -192,7 +192,7 @@ function Test() { }); }; - const profileId = 'cl9efyn9p004ww3u42mjgl1vn'; // Remember to change this filed after testing deleting + const profileId = 'cl9i68fv60000tthj8t3zkox0'; // Remember to change this filed after testing deleting const data = trpc.useQuery( [ `offers.profile.listOne`, @@ -241,10 +241,10 @@ function Test() { background: { educations: [ { - backgroundId: 'cl96stky6002fw32g6vj4meyr', + backgroundId: 'cl9i68fv60001tthj23g9tuv4', endDate: new Date('2018-09-30T07:58:54.000Z'), field: 'Computer Science', - id: 'cl96stky6002gw32gey2ffawd', + id: 'cl9i68fv60002tthjq4eux7kn', school: 'National University of Singapore', startDate: new Date('2014-09-30T07:58:54.000Z'), type: 'Bachelors', @@ -252,20 +252,20 @@ function Test() { ], experiences: [ { - backgroundId: 'cl96stky6002fw32g6vj4meyr', + backgroundId: 'cl9i68fv60001tthj23g9tuv4', company: { createdAt: new Date('2022-10-12T16:19:05.196Z'), description: 'Meta Platforms, Inc., doing business as Meta and formerly named Facebook, Inc., and TheFacebook, Inc., is an American multinational technology conglomerate based in Menlo Park, California. The company owns Facebook, Instagram, and WhatsApp, among other products and services.', - id: 'cl95u79f000007im531ysjg79', + id: 'cl9h0bqug0003txxwgkac0x40', logoUrl: 'https://logo.clearbit.com/meta.com', name: 'Meta', slug: 'meta', updatedAt: new Date('2022-10-12T16:19:05.196Z'), }, - companyId: 'cl9h0bqu50000txxwkhmshhxz', + companyId: 'cl9h0bqug0003txxwgkac0x40', durationInMonths: 24, - id: 'cl96stky6002iw32gpt6t87s2', + id: 'cl9i68fvc0004tthjo5jbr0yg', jobType: 'FULLTIME', level: 'Junior', monthlySalary: null, @@ -274,57 +274,57 @@ function Test() { title: 'Software Engineer', totalCompensation: { currency: 'SGD', - id: 'cl96stky6002jw32g73svfacr', - value: 104100, + id: 'cl9i68fvc0005tthj7r1rhvb1', + value: 100, }, - totalCompensationId: 'cl96stky6002jw32g73svfacr', + totalCompensationId: 'cl9i68fvc0005tthj7r1rhvb1', }, ], - id: 'cl96stky6002fw32g6vj4meyr', - offersProfileId: 'cl96stky5002ew32gx2kale2x', + id: 'cl9i68fv60001tthj23g9tuv4', + offersProfileId: 'cl9i68fv60000tthj8t3zkox0', specificYoes: [ { - backgroundId: 'cl96stky6002fw32g6vj4meyr', + backgroundId: 'cl9i68fv60001tthj23g9tuv4', domain: 'Backend', - id: 'cl96t7890004tw32g5in3px5j', + id: 'cl9i68fvc0008tthjlxslzfo4', yoe: 2, }, { - backgroundId: 'cl96stky6002fw32g6vj4meyr', + backgroundId: 'cl9i68fv60001tthj23g9tuv4', domain: 'Backend', - id: 'cl96tb87x004xw32gnu17jbzv', + id: 'cl9i68fvc0009tthjwol3285l', yoe: 2, }, { - backgroundId: 'cl96stky6002fw32g6vj4meyr', + // BackgroundId: 'cl9i68fv60001tthj23g9tuv4', domain: 'Backend', - id: 'cl976t39z00007iygt3np3cgo', + // Id: 'cl976t39z00007iygt3np3cgo', yoe: 2, }, { - backgroundId: 'cl96stky6002fw32g6vj4meyr', + // BackgroundId: 'cl96stky6002fw32g6vj4meyr', domain: 'Front End', - id: 'cl96stky7002mw32gn4jc7uml', + // Id: 'cl96stky7002mw32gn4jc7uml', yoe: 2, }, { - backgroundId: 'cl96stky6002fw32g6vj4meyr', + // BackgroundId: 'cl96stky6002fw32g6vj4meyr', domain: 'Full Stack', - id: 'cl96stky7002nw32gpprghtxr', + // Id: 'cl96stky7002nw32gpprghtxr', yoe: 2, }, { - backgroundId: 'cl96stky6002fw32g6vj4meyr', + // BackgroundId: 'cl96stky6002fw32g6vj4meyr', domain: 'Backend', - id: 'cl976we5h000p7iygiomdo9fh', + // Id: 'cl976we5h000p7iygiomdo9fh', yoe: 2, }, ], totalYoe: 6, }, createdAt: '2022-10-13T08:28:13.518Z', - discussion: [], - id: 'cl96stky5002ew32gx2kale2x', + // Discussion: [], + id: 'cl9i68fv60000tthj8t3zkox0', isEditable: true, offers: [ { @@ -333,14 +333,14 @@ function Test() { createdAt: new Date('2022-10-12T16:19:05.196Z'), description: 'Meta Platforms, Inc., doing business as Meta and formerly named Facebook, Inc., and TheFacebook, Inc., is an American multinational technology conglomerate based in Menlo Park, California. The company owns Facebook, Instagram, and WhatsApp, among other products and services.', - id: 'cl95u79f000007im531ysjg79', + id: 'cl9h0bqug0003txxwgkac0x40', logoUrl: 'https://logo.clearbit.com/meta.com', name: 'Meta', slug: 'meta', updatedAt: new Date('2022-10-12T16:19:05.196Z'), }, - companyId: 'cl9h0bqu50000txxwkhmshhxz', - id: 'cl976t4de00047iygl0zbce11', + companyId: 'cl9h0bqug0003txxwgkac0x40', + id: 'cl9i68fve000ntthj5h9yvqnh', jobType: 'FULLTIME', location: 'Singapore, Singapore', monthYearReceived: new Date('2022-09-30T07:58:54.000Z'), @@ -348,37 +348,37 @@ function Test() { offersFullTime: { baseSalary: { currency: 'SGD', - id: 'cl976t4de00067iyg3pjir7k9', + id: 'cl9i68fve000ptthjn55hpoe4', value: 1999999999, }, - baseSalaryId: 'cl976t4de00067iyg3pjir7k9', + baseSalaryId: 'cl9i68fve000ptthjn55hpoe4', bonus: { currency: 'SGD', - id: 'cl976t4de00087iygcnlmh8aw', + id: 'cl9i68fve000rtthjqo2ktljt', value: 1410065407, }, - bonusId: 'cl976t4de00087iygcnlmh8aw', - id: 'cl976t4de00057iygq3ktce3v', + bonusId: 'cl9i68fve000rtthjqo2ktljt', + id: 'cl9i68fve000otthjqk0g01k0', level: 'EXPERT', specialization: 'FRONTEND', stocks: { currency: 'SGD', - id: 'cl976t4df000a7iygkrsgr1xh', + id: 'cl9i68fvf000ttthjt2ode0cc', value: -558038585, }, - stocksId: 'cl976t4df000a7iygkrsgr1xh', + stocksId: 'cl9i68fvf000ttthjt2ode0cc', title: 'Software Engineer', totalCompensation: { currency: 'SGD', - id: 'cl976t4df000c7iyg73ryf5uw', + id: 'cl9i68fvf000vtthjg90s48nj', value: 55555555, }, - totalCompensationId: 'cl976t4df000c7iyg73ryf5uw', + totalCompensationId: 'cl9i68fvf000vtthjg90s48nj', }, - offersFullTimeId: 'cl976t4de00057iygq3ktce3v', + offersFullTimeId: 'cl9i68fve000otthjqk0g01k0', offersIntern: null, offersInternId: null, - profileId: 'cl96stky5002ew32gx2kale2x', + profileId: 'cl9i68fv60000tthj8t3zkox0', }, { comments: '', @@ -386,14 +386,14 @@ function Test() { createdAt: new Date('2022-10-12T16:19:05.196Z'), description: 'Meta Platforms, Inc., doing business as Meta and formerly named Facebook, Inc., and TheFacebook, Inc., is an American multinational technology conglomerate based in Menlo Park, California. The company owns Facebook, Instagram, and WhatsApp, among other products and services.', - id: 'cl95u79f000007im531ysjg79', + id: 'cl9h0bqug0003txxwgkac0x40', logoUrl: 'https://logo.clearbit.com/meta.com', name: 'Meta', slug: 'meta', updatedAt: new Date('2022-10-12T16:19:05.196Z'), }, - companyId: 'cl9h0bqu50000txxwkhmshhxz', - id: 'cl96stky80031w32gau9mu1gs', + companyId: 'cl9h0bqug0003txxwgkac0x40', + id: 'cl9i68fvf000ytthj0ltsqt1d', jobType: 'FULLTIME', location: 'Singapore, Singapore', monthYearReceived: new Date('2022-09-30T07:58:54.000Z'), @@ -401,200 +401,200 @@ function Test() { offersFullTime: { baseSalary: { currency: 'SGD', - id: 'cl96stky80033w32gxw5goc4z', + id: 'cl9i68fvf0010tthj0iym6woh', value: 84000, }, - baseSalaryId: 'cl96stky80033w32gxw5goc4z', + baseSalaryId: 'cl9i68fvf0010tthj0iym6woh', bonus: { currency: 'SGD', - id: 'cl96stky80035w32gajjwdo1p', + id: 'cl9i68fvf0012tthjioltnspk', value: 123456789, }, - bonusId: 'cl96stky80035w32gajjwdo1p', - id: 'cl96stky80032w32gep9ovgj3', + bonusId: 'cl9i68fvf0012tthjioltnspk', + id: 'cl9i68fvf000ztthjcovbiehc', level: 'Junior', specialization: 'Front End', stocks: { currency: 'SGD', - id: 'cl96stky90037w32gu04t6ybh', + id: 'cl9i68fvf0014tthjz2gff3hs', value: 100, }, - stocksId: 'cl96stky90037w32gu04t6ybh', + stocksId: 'cl9i68fvf0014tthjz2gff3hs', title: 'Software Engineer', totalCompensation: { currency: 'SGD', - id: 'cl96stky90039w32glbpktd0o', + id: 'cl9i68fvf0016tthjrtb7iuvj', value: 104100, }, - totalCompensationId: 'cl96stky90039w32glbpktd0o', - }, - offersFullTimeId: 'cl96stky80032w32gep9ovgj3', - offersIntern: null, - offersInternId: null, - profileId: 'cl96stky5002ew32gx2kale2x', - }, - { - comments: '', - company: { - createdAt: new Date('2022-10-12T16:19:05.196Z'), - description: - 'Meta Platforms, Inc., doing business as Meta and formerly named Facebook, Inc., and TheFacebook, Inc., is an American multinational technology conglomerate based in Menlo Park, California. The company owns Facebook, Instagram, and WhatsApp, among other products and services.', - id: 'cl95u79f000007im531ysjg79', - logoUrl: 'https://logo.clearbit.com/meta.com', - name: 'Meta', - slug: 'meta', - updatedAt: new Date('2022-10-12T16:19:05.196Z'), - }, - companyId: 'cl9h0bqu50000txxwkhmshhxz', - id: 'cl96stky9003bw32gc3l955vr', - jobType: 'FULLTIME', - location: 'Singapore, Singapore', - monthYearReceived: new Date('2022-09-30T07:58:54.000Z'), - negotiationStrategy: 'LOst out having multiple offers', - offersFullTime: { - baseSalary: { - currency: 'SGD', - id: 'cl96stky9003dw32gcvqbijlo', - value: 1, - }, - baseSalaryId: 'cl96stky9003dw32gcvqbijlo', - bonus: { - currency: 'SGD', - id: 'cl96stky9003fw32goc3zqxwr', - value: 0, - }, - bonusId: 'cl96stky9003fw32goc3zqxwr', - id: 'cl96stky9003cw32g5v10izfu', - level: 'Senior', - specialization: 'Front End', - stocks: { - currency: 'SGD', - id: 'cl96stky9003hw32g1lbbkqqr', - value: 999999, - }, - stocksId: 'cl96stky9003hw32g1lbbkqqr', - title: 'Software Engineer DOG', - totalCompensation: { - currency: 'SGD', - id: 'cl96stky9003jw32gzumcoi7v', - value: 999999, - }, - totalCompensationId: 'cl96stky9003jw32gzumcoi7v', + totalCompensationId: 'cl9i68fvf0016tthjrtb7iuvj', }, - offersFullTimeId: 'cl96stky9003cw32g5v10izfu', + offersFullTimeId: 'cl9i68fvf000ztthjcovbiehc', offersIntern: null, offersInternId: null, - profileId: 'cl96stky5002ew32gx2kale2x', - }, - { - comments: 'this IS SO COOL', - company: { - createdAt: new Date('2022-10-12T16:19:05.196Z'), - description: - 'Meta Platforms, Inc., doing business as Meta and formerly named Facebook, Inc., and TheFacebook, Inc., is an American multinational technology conglomerate based in Menlo Park, California. The company owns Facebook, Instagram, and WhatsApp, among other products and services.', - id: 'cl95u79f000007im531ysjg79', - logoUrl: 'https://logo.clearbit.com/meta.com', - name: 'Meta', - slug: 'meta', - updatedAt: new Date('2022-10-12T16:19:05.196Z'), - }, - companyId: 'cl9h0bqu50000txxwkhmshhxz', - id: 'cl976wf28000t7iyga4noyz7s', - jobType: 'FULLTIME', - location: 'Singapore, Singapore', - monthYearReceived: new Date('2022-09-30T07:58:54.000Z'), - negotiationStrategy: 'Charmed the guy with my face', - offersFullTime: { - baseSalary: { - currency: 'SGD', - id: 'cl976wf28000v7iygmk1b7qaq', - value: 1999999999, - }, - baseSalaryId: 'cl976wf28000v7iygmk1b7qaq', - bonus: { - currency: 'SGD', - id: 'cl976wf28000x7iyg63w7kcli', - value: 1410065407, - }, - bonusId: 'cl976wf28000x7iyg63w7kcli', - id: 'cl976wf28000u7iyg6euei8e9', - level: 'EXPERT', - specialization: 'FRONTEND', - stocks: { - currency: 'SGD', - id: 'cl976wf28000z7iyg9ivun6ap', - value: 111222333, - }, - stocksId: 'cl976wf28000z7iyg9ivun6ap', - title: 'Software Engineer', - totalCompensation: { - currency: 'SGD', - id: 'cl976wf2800117iygmzsc0xit', - value: 55555555, - }, - totalCompensationId: 'cl976wf2800117iygmzsc0xit', - }, - offersFullTimeId: 'cl976wf28000u7iyg6euei8e9', - offersIntern: null, - offersInternId: null, - profileId: 'cl96stky5002ew32gx2kale2x', - }, - { - comments: 'this rocks', - company: { - createdAt: new Date('2022-10-12T16:19:05.196Z'), - description: - 'Meta Platforms, Inc., doing business as Meta and formerly named Facebook, Inc., and TheFacebook, Inc., is an American multinational technology conglomerate based in Menlo Park, California. The company owns Facebook, Instagram, and WhatsApp, among other products and services.', - id: 'cl95u79f000007im531ysjg79', - logoUrl: 'https://logo.clearbit.com/meta.com', - name: 'Meta', - slug: 'meta', - updatedAt: new Date('2022-10-12T16:19:05.196Z'), - }, - companyId: 'cl9h0bqu50000txxwkhmshhxz', - id: 'cl96tbb3o0051w32gjrpaiiit', - jobType: 'FULLTIME', - location: 'Singapore, Singapore', - monthYearReceived: new Date('2022-09-30T07:58:54.000Z'), - negotiationStrategy: 'Charmed the guy with my face', - offersFullTime: { - baseSalary: { - currency: 'SGD', - id: 'cl96tbb3o0053w32gz11paaxu', - value: 1999999999, - }, - baseSalaryId: 'cl96tbb3o0053w32gz11paaxu', - bonus: { - currency: 'SGD', - id: 'cl96tbb3o0055w32gpyqgz5hx', - value: 1410065407, - }, - bonusId: 'cl96tbb3o0055w32gpyqgz5hx', - id: 'cl96tbb3o0052w32guguajzin', - level: 'EXPERT', - specialization: 'FRONTEND', - stocks: { - currency: 'SGD', - id: 'cl96tbb3o0057w32gu4nyxguf', - value: 500, - }, - stocksId: 'cl96tbb3o0057w32gu4nyxguf', - title: 'Software Engineer', - totalCompensation: { - currency: 'SGD', - id: 'cl96tbb3o0059w32gm3iy1zk4', - value: 55555555, - }, - totalCompensationId: 'cl96tbb3o0059w32gm3iy1zk4', - }, - offersFullTimeId: 'cl96tbb3o0052w32guguajzin', - offersIntern: null, - offersInternId: null, - profileId: 'cl96stky5002ew32gx2kale2x', + profileId: 'cl9i68fv60000tthj8t3zkox0', }, + // { + // comments: '', + // company: { + // createdAt: new Date('2022-10-12T16:19:05.196Z'), + // description: + // 'Meta Platforms, Inc., doing business as Meta and formerly named Facebook, Inc., and TheFacebook, Inc., is an American multinational technology conglomerate based in Menlo Park, California. The company owns Facebook, Instagram, and WhatsApp, among other products and services.', + // id: 'cl9h0bqug0003txxwgkac0x40', + // logoUrl: 'https://logo.clearbit.com/meta.com', + // name: 'Meta', + // slug: 'meta', + // updatedAt: new Date('2022-10-12T16:19:05.196Z'), + // }, + // companyId: 'cl9h0bqug0003txxwgkac0x40', + // id: 'cl96stky9003bw32gc3l955vr', + // jobType: 'FULLTIME', + // location: 'Singapore, Singapore', + // monthYearReceived: new Date('2022-09-30T07:58:54.000Z'), + // negotiationStrategy: 'LOst out having multiple offers', + // offersFullTime: { + // baseSalary: { + // currency: 'SGD', + // id: 'cl96stky9003dw32gcvqbijlo', + // value: 1, + // }, + // baseSalaryId: 'cl96stky9003dw32gcvqbijlo', + // bonus: { + // currency: 'SGD', + // id: 'cl96stky9003fw32goc3zqxwr', + // value: 0, + // }, + // bonusId: 'cl96stky9003fw32goc3zqxwr', + // id: 'cl96stky9003cw32g5v10izfu', + // level: 'Senior', + // specialization: 'Front End', + // stocks: { + // currency: 'SGD', + // id: 'cl96stky9003hw32g1lbbkqqr', + // value: 999999, + // }, + // stocksId: 'cl96stky9003hw32g1lbbkqqr', + // title: 'Software Engineer DOG', + // totalCompensation: { + // currency: 'SGD', + // id: 'cl96stky9003jw32gzumcoi7v', + // value: 999999, + // }, + // totalCompensationId: 'cl96stky9003jw32gzumcoi7v', + // }, + // offersFullTimeId: 'cl96stky9003cw32g5v10izfu', + // offersIntern: null, + // offersInternId: null, + // profileId: 'cl96stky5002ew32gx2kale2x', + // }, + // { + // comments: 'this IS SO COOL', + // company: { + // createdAt: new Date('2022-10-12T16:19:05.196Z'), + // description: + // 'Meta Platforms, Inc., doing business as Meta and formerly named Facebook, Inc., and TheFacebook, Inc., is an American multinational technology conglomerate based in Menlo Park, California. The company owns Facebook, Instagram, and WhatsApp, among other products and services.', + // id: 'cl9h0bqug0003txxwgkac0x40', + // logoUrl: 'https://logo.clearbit.com/meta.com', + // name: 'Meta', + // slug: 'meta', + // updatedAt: new Date('2022-10-12T16:19:05.196Z'), + // }, + // companyId: 'cl9h0bqug0003txxwgkac0x40', + // id: 'cl976wf28000t7iyga4noyz7s', + // jobType: 'FULLTIME', + // location: 'Singapore, Singapore', + // monthYearReceived: new Date('2022-09-30T07:58:54.000Z'), + // negotiationStrategy: 'Charmed the guy with my face', + // offersFullTime: { + // baseSalary: { + // currency: 'SGD', + // id: 'cl976wf28000v7iygmk1b7qaq', + // value: 1999999999, + // }, + // baseSalaryId: 'cl976wf28000v7iygmk1b7qaq', + // bonus: { + // currency: 'SGD', + // id: 'cl976wf28000x7iyg63w7kcli', + // value: 1410065407, + // }, + // bonusId: 'cl976wf28000x7iyg63w7kcli', + // id: 'cl976wf28000u7iyg6euei8e9', + // level: 'EXPERT', + // specialization: 'FRONTEND', + // stocks: { + // currency: 'SGD', + // id: 'cl976wf28000z7iyg9ivun6ap', + // value: 111222333, + // }, + // stocksId: 'cl976wf28000z7iyg9ivun6ap', + // title: 'Software Engineer', + // totalCompensation: { + // currency: 'SGD', + // id: 'cl976wf2800117iygmzsc0xit', + // value: 55555555, + // }, + // totalCompensationId: 'cl976wf2800117iygmzsc0xit', + // }, + // offersFullTimeId: 'cl976wf28000u7iyg6euei8e9', + // offersIntern: null, + // offersInternId: null, + // profileId: 'cl96stky5002ew32gx2kale2x', + // }, + // { + // comments: 'this rocks', + // company: { + // createdAt: new Date('2022-10-12T16:19:05.196Z'), + // description: + // 'Meta Platforms, Inc., doing business as Meta and formerly named Facebook, Inc., and TheFacebook, Inc., is an American multinational technology conglomerate based in Menlo Park, California. The company owns Facebook, Instagram, and WhatsApp, among other products and services.', + // id: 'cl9h0bqug0003txxwgkac0x40', + // logoUrl: 'https://logo.clearbit.com/meta.com', + // name: 'Meta', + // slug: 'meta', + // updatedAt: new Date('2022-10-12T16:19:05.196Z'), + // }, + // companyId: 'cl9h0bqug0003txxwgkac0x40', + // id: 'cl96tbb3o0051w32gjrpaiiit', + // jobType: 'FULLTIME', + // location: 'Singapore, Singapore', + // monthYearReceived: new Date('2022-09-30T07:58:54.000Z'), + // negotiationStrategy: 'Charmed the guy with my face', + // offersFullTime: { + // baseSalary: { + // currency: 'SGD', + // id: 'cl96tbb3o0053w32gz11paaxu', + // value: 1999999999, + // }, + // baseSalaryId: 'cl96tbb3o0053w32gz11paaxu', + // bonus: { + // currency: 'SGD', + // id: 'cl96tbb3o0055w32gpyqgz5hx', + // value: 1410065407, + // }, + // bonusId: 'cl96tbb3o0055w32gpyqgz5hx', + // id: 'cl96tbb3o0052w32guguajzin', + // level: 'EXPERT', + // specialization: 'FRONTEND', + // stocks: { + // currency: 'SGD', + // id: 'cl96tbb3o0057w32gu4nyxguf', + // value: 500, + // }, + // stocksId: 'cl96tbb3o0057w32gu4nyxguf', + // title: 'Software Engineer', + // totalCompensation: { + // currency: 'SGD', + // id: 'cl96tbb3o0059w32gm3iy1zk4', + // value: 55555555, + // }, + // totalCompensationId: 'cl96tbb3o0059w32gm3iy1zk4', + // }, + // offersFullTimeId: 'cl96tbb3o0052w32guguajzin', + // offersIntern: null, + // offersInternId: null, + // profileId: 'cl96stky5002ew32gx2kale2x', + // }, ], - profileName: 'ailing bryann stuart ziqing', - token: 'afca11e436d21bde24543718fa957c6c625335439dc504f24ee35eae7b5ef1ba', + // ProfileName: 'ailing bryann stuart ziqing', + token: 'd3509cb890f0bae0a785afdd6c1c074a140706ab1d155ed338ec22dcca5c92f1', userId: null, }); }; diff --git a/apps/portal/src/server/router/offers/offers-profile-router.ts b/apps/portal/src/server/router/offers/offers-profile-router.ts index debf6096..207c6500 100644 --- a/apps/portal/src/server/router/offers/offers-profile-router.ts +++ b/apps/portal/src/server/router/offers/offers-profile-router.ts @@ -94,14 +94,14 @@ const education = z.object({ type: z.string().nullish(), }); -const reply = z.object({ - createdAt: z.date().nullish(), - id: z.string().optional(), - messages: z.string().nullish(), - profileId: z.string().nullish(), - replyingToId: z.string().nullish(), - userId: z.string().nullish(), -}); +// Const reply = z.object({ +// createdAt: z.date().nullish(), +// id: z.string().optional(), +// messages: z.string().nullish(), +// profileId: z.string().nullish(), +// replyingToId: z.string().nullish(), +// userId: z.string().nullish(), +// }); export const offersProfileRouter = createRouter() .query('listOne', { @@ -535,11 +535,11 @@ export const offersProfileRouter = createRouter() totalYoe: z.number(), }), createdAt: z.string().optional(), - discussion: z.array(reply), + // Discussion: z.array(reply), id: z.string(), isEditable: z.boolean().nullish(), offers: z.array(offer), - profileName: z.string(), + profileName: z.string().optional(), token: z.string(), userId: z.string().nullish(), }), @@ -552,14 +552,16 @@ export const offersProfileRouter = createRouter() const profileEditToken = profileToUpdate?.editToken; if (profileEditToken === input.token) { - await ctx.prisma.offersProfile.update({ - data: { - profileName: input.profileName, - }, - where: { - id: input.id, - }, - }); + if (input.profileName) { + await ctx.prisma.offersProfile.update({ + data: { + profileName: input.profileName, + }, + where: { + id: input.id, + }, + }); + } await ctx.prisma.offersBackground.update({ data: { @@ -572,6 +574,7 @@ export const offersProfileRouter = createRouter() for (const edu of input.background.educations) { if (edu.id) { + // Update existing education await ctx.prisma.offersEducation.update({ data: { endDate: edu.endDate, @@ -585,6 +588,7 @@ export const offersProfileRouter = createRouter() }, }); } else { + // Create new education await ctx.prisma.offersBackground.update({ data: { educations: { @@ -606,6 +610,7 @@ export const offersProfileRouter = createRouter() for (const exp of input.background.experiences) { if (exp.id) { + // Update existing experience await ctx.prisma.offersExperience.update({ data: { companyId: exp.companyId, @@ -642,6 +647,7 @@ export const offersProfileRouter = createRouter() }); } } else if (!exp.id) { + // Create new experience if ( exp.jobType === 'FULLTIME' && exp.totalCompensation?.currency !== undefined && @@ -760,6 +766,7 @@ export const offersProfileRouter = createRouter() for (const yoe of input.background.specificYoes) { if (yoe.id) { + // Update existing yoe await ctx.prisma.offersSpecificYoe.update({ data: { ...yoe, @@ -769,6 +776,7 @@ export const offersProfileRouter = createRouter() }, }); } else { + // Create new yoe await ctx.prisma.offersBackground.update({ data: { specificYoes: { @@ -787,6 +795,7 @@ export const offersProfileRouter = createRouter() for (const offerToUpdate of input.offers) { if (offerToUpdate.id) { + // Update existing offer await ctx.prisma.offersOffer.update({ data: { comments: offerToUpdate.comments, @@ -894,6 +903,7 @@ export const offersProfileRouter = createRouter() }); } } else { + // Create new offer if ( offerToUpdate.jobType === 'INTERN' && offerToUpdate.offersIntern &&