fix: change structure

This commit is contained in:
Methapon2001 2024-06-10 16:50:17 +07:00
parent 9c4e47105d
commit aba68af123
3 changed files with 95 additions and 15 deletions

View file

@ -0,0 +1,45 @@
/*
Warnings:
- You are about to drop the column `arrivalBarricade` on the `Employee` table. All the data in the column will be lost.
- You are about to drop the column `arrivalCardNo` on the `Employee` table. All the data in the column will be lost.
- You are about to drop the column `email` on the `Employee` table. All the data in the column will be lost.
- You are about to drop the column `telephoneNo` on the `Employee` table. All the data in the column will be lost.
- Added the required column `entryDate` to the `Employee` table without a default value. This is not possible if the table is not empty.
- Added the required column `passportExpiryDate` to the `Employee` table without a default value. This is not possible if the table is not empty.
- Added the required column `passportIssueDate` to the `Employee` table without a default value. This is not possible if the table is not empty.
- Added the required column `passportIssuingCountry` to the `Employee` table without a default value. This is not possible if the table is not empty.
- Added the required column `passportIssuingPlace` to the `Employee` table without a default value. This is not possible if the table is not empty.
- Added the required column `passportNumber` to the `Employee` table without a default value. This is not possible if the table is not empty.
- Added the required column `passportType` to the `Employee` table without a default value. This is not possible if the table is not empty.
- Added the required column `tm6Number` to the `Employee` table without a default value. This is not possible if the table is not empty.
- Added the required column `visaExpiryDate` to the `Employee` table without a default value. This is not possible if the table is not empty.
- Added the required column `visaIssueDate` to the `Employee` table without a default value. This is not possible if the table is not empty.
- Added the required column `visaIssuingPlace` to the `Employee` table without a default value. This is not possible if the table is not empty.
- Added the required column `visaNumber` to the `Employee` table without a default value. This is not possible if the table is not empty.
- Added the required column `visaStayUntilDate` to the `Employee` table without a default value. This is not possible if the table is not empty.
- Added the required column `visaType` to the `Employee` table without a default value. This is not possible if the table is not empty.
- Added the required column `workerStatus` to the `Employee` table without a default value. This is not possible if the table is not empty.
*/
-- AlterTable
ALTER TABLE "Employee" DROP COLUMN "arrivalBarricade",
DROP COLUMN "arrivalCardNo",
DROP COLUMN "email",
DROP COLUMN "telephoneNo",
ADD COLUMN "entryDate" TIMESTAMP(3) NOT NULL,
ADD COLUMN "passportExpiryDate" TIMESTAMP(3) NOT NULL,
ADD COLUMN "passportIssueDate" TIMESTAMP(3) NOT NULL,
ADD COLUMN "passportIssuingCountry" TEXT NOT NULL,
ADD COLUMN "passportIssuingPlace" TEXT NOT NULL,
ADD COLUMN "passportNumber" TEXT NOT NULL,
ADD COLUMN "passportType" TEXT NOT NULL,
ADD COLUMN "previousPassportReference" TEXT,
ADD COLUMN "tm6Number" TEXT NOT NULL,
ADD COLUMN "visaExpiryDate" TIMESTAMP(3) NOT NULL,
ADD COLUMN "visaIssueDate" TIMESTAMP(3) NOT NULL,
ADD COLUMN "visaIssuingPlace" TEXT NOT NULL,
ADD COLUMN "visaNumber" TEXT NOT NULL,
ADD COLUMN "visaStayUntilDate" TIMESTAMP(3) NOT NULL,
ADD COLUMN "visaType" TEXT NOT NULL,
ADD COLUMN "workerStatus" TEXT NOT NULL;

View file

@ -428,11 +428,23 @@ model Employee {
zipCode String
email String
telephoneNo String
passportType String
passportNumber String
passportIssueDate DateTime
passportExpiryDate DateTime
passportIssuingCountry String
passportIssuingPlace String
previousPassportReference String?
arrivalBarricade String
arrivalCardNo String
visaType String
visaNumber String
visaIssueDate DateTime
visaExpiryDate DateTime
visaIssuingPlace String
visaStayUntilDate DateTime
tm6Number String
entryDate DateTime
workerStatus String
customerBranch CustomerBranch? @relation(fields: [customerBranchId], references: [id], onDelete: SetNull)
customerBranchId String?

View file

@ -34,7 +34,6 @@ type EmployeeCreate = {
status?: Status;
code: string;
nrcNo: string;
dateOfBirth: Date;
@ -49,11 +48,24 @@ type EmployeeCreate = {
addressEN: string;
address: string;
zipCode: string;
email: string;
telephoneNo: string;
arrivalBarricade: string;
arrivalCardNo: string;
passportType: string;
passportNumber: string;
passportIssueDate: Date;
passportExpiryDate: Date;
passportIssuingCountry: string;
passportIssuingPlace: string;
previousPassportReference?: string;
visaType: string;
visaNumber: string;
visaIssueDate: Date;
visaExpiryDate: Date;
visaIssuingPlace: string;
visaStayUntilDate: Date;
tm6Number: string;
entryDate: Date;
workerStatus: string;
subDistrictId?: string | null;
districtId?: string | null;
@ -104,7 +116,6 @@ type EmployeeUpdate = {
customerBranchId?: string;
status?: "ACTIVE" | "INACTIVE";
code?: string;
nrcNo?: string;
dateOfBirth?: Date;
@ -119,11 +130,24 @@ type EmployeeUpdate = {
addressEN?: string;
address?: string;
zipCode?: string;
email?: string;
telephoneNo?: string;
arrivalBarricade?: string;
arrivalCardNo?: string;
passportType?: string;
passportNumber?: string;
passportIssueDate?: Date;
passportExpiryDate?: Date;
passportIssuingCountry?: string;
passportIssuingPlace?: string;
previousPassportReference?: string;
visaType?: string;
visaNumber?: string;
visaIssueDate?: Date;
visaExpiryDate?: Date;
visaIssuingPlace?: string;
visaStayUntilDate?: Date;
tm6Number?: string;
entryDate?: Date;
workerStatus?: string;
subDistrictId?: string | null;
districtId?: string | null;
@ -189,7 +213,6 @@ export class EmployeeController extends Controller {
{ firstNameEN: { contains: query }, zipCode },
{ lastName: { contains: query }, zipCode },
{ lastNameEN: { contains: query }, zipCode },
{ email: { contains: query }, zipCode },
],
} satisfies Prisma.EmployeeWhereInput;