From aae7c4640e5582de79e7f5ed3e888240fbedbc40 Mon Sep 17 00:00:00 2001 From: Methapon Metanipat Date: Mon, 11 Nov 2024 13:54:47 +0700 Subject: [PATCH] feat: add employee work fields --- .../migration.sql | 18 ++++++++++++++++++ prisma/schema.prisma | 3 +-- src/controllers/03-employee-work-controller.ts | 3 +-- 3 files changed, 20 insertions(+), 4 deletions(-) create mode 100644 prisma/migrations/20241111065430_add_employee_work_fields/migration.sql diff --git a/prisma/migrations/20241111065430_add_employee_work_fields/migration.sql b/prisma/migrations/20241111065430_add_employee_work_fields/migration.sql new file mode 100644 index 0000000..efa0627 --- /dev/null +++ b/prisma/migrations/20241111065430_add_employee_work_fields/migration.sql @@ -0,0 +1,18 @@ +/* + Warnings: + + - You are about to drop the column `remark` on the `EmployeeWork` table. All the data in the column will be lost. + - You are about to drop the column `workEndDate` on the `EmployeeWork` table. All the data in the column will be lost. + - You are about to drop the `EmployeeInCountryNotice` table. If the table is not empty, all the data it contains will be lost. + +*/ +-- DropForeignKey +ALTER TABLE "EmployeeInCountryNotice" DROP CONSTRAINT "EmployeeInCountryNotice_employeeId_fkey"; + +-- AlterTable +ALTER TABLE "EmployeeWork" DROP COLUMN "remark", +DROP COLUMN "workEndDate", +ADD COLUMN "identityNo" TEXT; + +-- DropTable +DROP TABLE "EmployeeInCountryNotice"; diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 2193233..a547211 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -886,11 +886,10 @@ model EmployeeWork { positionName String? jobType String? workplace String? + identityNo String? workPermitNo String? workPermitIssueDate DateTime? @db.Date workPermitExpireDate DateTime? @db.Date - workEndDate DateTime? @db.Date - remark String? createdAt DateTime @default(now()) createdBy User? @relation(name: "EmployeeWorkCreatedByUser", fields: [createdByUserId], references: [id], onDelete: SetNull) diff --git a/src/controllers/03-employee-work-controller.ts b/src/controllers/03-employee-work-controller.ts index 3587b8c..7613a91 100644 --- a/src/controllers/03-employee-work-controller.ts +++ b/src/controllers/03-employee-work-controller.ts @@ -37,11 +37,10 @@ type EmployeeWorkPayload = { positionName?: string | null; jobType?: string | null; workplace?: string | null; + identityNo?: string | null; workPermitNo?: string | null; workPermitIssueDate?: Date | null; workPermitExpireDate?: Date | null; - workEndDate?: Date | null; - remark?: string | null; }; @Route("api/v1/employee/{employeeId}/work")