From 5b9f388ad2f437fcceaabb4331097eb023094786 Mon Sep 17 00:00:00 2001 From: Dev Sharma Date: Thu, 31 Oct 2024 12:21:04 +0530 Subject: [PATCH] fix conflicts and build --- .../20241031064849_company/migration.sql | 26 +++++++++++++++++++ src/actions/user.profile.actions.ts | 7 ++--- 2 files changed, 30 insertions(+), 3 deletions(-) create mode 100644 prisma/migrations/20241031064849_company/migration.sql diff --git a/prisma/migrations/20241031064849_company/migration.sql b/prisma/migrations/20241031064849_company/migration.sql new file mode 100644 index 00000000..13bf066d --- /dev/null +++ b/prisma/migrations/20241031064849_company/migration.sql @@ -0,0 +1,26 @@ +/* + Warnings: + + - A unique constraint covering the columns `[companyId]` on the table `User` will be added. If there are existing duplicate values, this will fail. + +*/ +-- AlterTable +ALTER TABLE "User" ADD COLUMN "companyId" TEXT, +ADD COLUMN "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP; + +-- CreateTable +CREATE TABLE "Company" ( + "id" TEXT NOT NULL, + "companyName" TEXT NOT NULL, + "companyLogo" TEXT, + "companyEmail" TEXT NOT NULL, + "companyBio" TEXT NOT NULL, + + CONSTRAINT "Company_pkey" PRIMARY KEY ("id") +); + +-- CreateIndex +CREATE UNIQUE INDEX "User_companyId_key" ON "User"("companyId"); + +-- AddForeignKey +ALTER TABLE "User" ADD CONSTRAINT "User_companyId_fkey" FOREIGN KEY ("companyId") REFERENCES "Company"("id") ON DELETE SET NULL ON UPDATE CASCADE; diff --git a/src/actions/user.profile.actions.ts b/src/actions/user.profile.actions.ts index 8f48915d..e4e1219b 100644 --- a/src/actions/user.profile.actions.ts +++ b/src/actions/user.profile.actions.ts @@ -362,7 +362,6 @@ export const getUserDetails = async () => { } }; - export const getUserDetailsWithId = async (id: string) => { try { const res = await prisma.user.findFirst({ @@ -622,7 +621,10 @@ export const deleteEducation = async (educationId: number) => { }); revalidatePath(`/newProfile/${auth.user.id}`); return new SuccessResponse('Project Deleted Successfully', 200).serialize(); - + } catch (_error) { + return new ErrorHandler('Internal server error', 'DATABASE_ERROR'); + } +}; export const getUserRecruiters = async () => { const auth = await getServerSession(authOptions); @@ -654,7 +656,6 @@ export const getUserRecruiters = async () => { return new SuccessResponse('Recruiter SuccessFully Fetched', 200, { recruiters: res, }).serialize(); - } catch (_error) { return new ErrorHandler('Internal server error', 'DATABASE_ERROR'); }