From f8423afe2a7ca708284b1444e9fe7b751267100e Mon Sep 17 00:00:00 2001 From: Ai Ling <50992674+ailing35@users.noreply.github.com> Date: Tue, 25 Oct 2022 00:24:44 +0800 Subject: [PATCH] [offers][fix] Fix UI and remove specialization on the backend (#426) * [offers][fix] Remove specialization on the frontend * [offers][fix] Rename refresh OEA button * [offers][chore] Remove specialisation and make bonus, stocks and baseSalary optional * [offers][fix] Fix OEA profile job title Co-authored-by: Bryann Yeap Kok Keong --- .../migration.sql | 19 ++ apps/portal/prisma/schema.prisma | 21 +- .../offers/offerAnalysis/OfferProfileCard.tsx | 7 +- .../offersSubmission/OffersSubmissionForm.tsx | 2 +- .../submissionForm/BackgroundForm.tsx | 14 +- .../components/offers/profile/OfferCard.tsx | 21 +- .../offers/profile/ProfileDetails.tsx | 2 +- apps/portal/src/components/offers/types.ts | 9 +- apps/portal/src/mappers/offers-mappers.ts | 64 ++--- .../pages/offers/profile/[offerProfileId].tsx | 15 +- .../src/pages/offers/test/createProfile.tsx | 229 +---------------- .../router/offers/offers-analysis-router.ts | 6 +- .../router/offers/offers-profile-router.ts | 231 +++++++++--------- .../portal/src/server/router/offers/offers.ts | 51 ++-- apps/portal/src/types/offers.d.ts | 11 +- 15 files changed, 244 insertions(+), 458 deletions(-) create mode 100644 apps/portal/prisma/migrations/20221024154046_remove_specialization_and_make_base_bonus_and_stocks_optional/migration.sql diff --git a/apps/portal/prisma/migrations/20221024154046_remove_specialization_and_make_base_bonus_and_stocks_optional/migration.sql b/apps/portal/prisma/migrations/20221024154046_remove_specialization_and_make_base_bonus_and_stocks_optional/migration.sql new file mode 100644 index 00000000..b6002921 --- /dev/null +++ b/apps/portal/prisma/migrations/20221024154046_remove_specialization_and_make_base_bonus_and_stocks_optional/migration.sql @@ -0,0 +1,19 @@ +/* + Warnings: + + - You are about to drop the column `specialization` on the `OffersExperience` table. All the data in the column will be lost. + - You are about to drop the column `specialization` on the `OffersFullTime` table. All the data in the column will be lost. + - You are about to drop the column `specialization` on the `OffersIntern` table. All the data in the column will be lost. + +*/ +-- AlterTable +ALTER TABLE "OffersExperience" DROP COLUMN "specialization"; + +-- AlterTable +ALTER TABLE "OffersFullTime" DROP COLUMN "specialization", +ALTER COLUMN "baseSalaryId" DROP NOT NULL, +ALTER COLUMN "bonusId" DROP NOT NULL, +ALTER COLUMN "stocksId" DROP NOT NULL; + +-- AlterTable +ALTER TABLE "OffersIntern" DROP COLUMN "specialization"; diff --git a/apps/portal/prisma/schema.prisma b/apps/portal/prisma/schema.prisma index ae5a9f16..c2c6938b 100644 --- a/apps/portal/prisma/schema.prisma +++ b/apps/portal/prisma/schema.prisma @@ -234,7 +234,6 @@ model OffersExperience { // Add more fields durationInMonths Int? - specialization String? location String? // FULLTIME fields @@ -340,7 +339,6 @@ model OffersIntern { id String @id @default(cuid()) title String - specialization String internshipCycle String startYear Int monthlySalary OffersCurrency @relation(fields: [monthlySalaryId], references: [id], onDelete: Cascade) @@ -350,18 +348,17 @@ model OffersIntern { } model OffersFullTime { - id String @id @default(cuid()) + id String @id @default(cuid()) title String - specialization String level String - totalCompensation OffersCurrency @relation("OfferTotalCompensation", fields: [totalCompensationId], references: [id], onDelete: Cascade) - totalCompensationId String @unique - baseSalary OffersCurrency @relation("OfferBaseSalary", fields: [baseSalaryId], references: [id], onDelete: Cascade) - baseSalaryId String @unique - bonus OffersCurrency @relation("OfferBonus", fields: [bonusId], references: [id], onDelete: Cascade) - bonusId String @unique - stocks OffersCurrency @relation("OfferStocks", fields: [stocksId], references: [id], onDelete: Cascade) - stocksId String @unique + totalCompensation OffersCurrency @relation("OfferTotalCompensation", fields: [totalCompensationId], references: [id], onDelete: Cascade) + totalCompensationId String @unique + baseSalary OffersCurrency? @relation("OfferBaseSalary", fields: [baseSalaryId], references: [id], onDelete: Cascade) + baseSalaryId String? @unique + bonus OffersCurrency? @relation("OfferBonus", fields: [bonusId], references: [id], onDelete: Cascade) + bonusId String? @unique + stocks OffersCurrency? @relation("OfferStocks", fields: [stocksId], references: [id], onDelete: Cascade) + stocksId String? @unique OffersOffer OffersOffer? } diff --git a/apps/portal/src/components/offers/offerAnalysis/OfferProfileCard.tsx b/apps/portal/src/components/offers/offerAnalysis/OfferProfileCard.tsx index af786c4b..13cbd2d8 100644 --- a/apps/portal/src/components/offers/offerAnalysis/OfferProfileCard.tsx +++ b/apps/portal/src/components/offers/offerAnalysis/OfferProfileCard.tsx @@ -4,6 +4,9 @@ import { } from '@heroicons/react/24/outline'; import { JobType } from '@prisma/client'; +import type { JobTitleType } from '~/components/shared/JobTitles'; +import { getLabelForJobTitleType } from '~/components/shared/JobTitles'; + import { HorizontalDivider } from '~/../../../packages/ui/dist'; import { convertMoneyToString } from '~/utils/offers/currency'; import { formatDate } from '~/utils/offers/time'; @@ -54,7 +57,9 @@ export default function OfferProfileCard({
-

{title}

+

+ {getLabelForJobTitleType(title as JobTitleType)} +

Company: {company.name}, {location}

diff --git a/apps/portal/src/components/offers/offersSubmission/OffersSubmissionForm.tsx b/apps/portal/src/components/offers/offersSubmission/OffersSubmissionForm.tsx index 0e1127ab..39544921 100644 --- a/apps/portal/src/components/offers/offersSubmission/OffersSubmissionForm.tsx +++ b/apps/portal/src/components/offers/offersSubmission/OffersSubmissionForm.tsx @@ -236,7 +236,7 @@ export default function OffersSubmissionForm({
{formSteps[formStep].component} -
{JSON.stringify(formMethods.watch(), null, 2)}
+ {/*
{JSON.stringify(formMethods.watch(), null, 2)}
*/} {formSteps[formStep].hasNext && (