refactor: drop field

This commit is contained in:
Methapon Metanipat 2024-08-22 11:42:06 +07:00
parent 42a036c34f
commit c548386b56
3 changed files with 16 additions and 9 deletions

View file

@ -0,0 +1,8 @@
/*
Warnings:
- You are about to drop the column `zipCode` on the `Employee` table. All the data in the column will be lost.
*/
-- AlterTable
ALTER TABLE "Employee" DROP COLUMN "zipCode";

View file

@ -516,8 +516,6 @@ model Employee {
subDistrict SubDistrict? @relation(fields: [subDistrictId], references: [id], onDelete: SetNull)
subDistrictId String?
zipCode String
passportType String
passportNumber String
passportIssueDate DateTime @db.Date

View file

@ -56,7 +56,6 @@ type EmployeeCreate = {
addressEN: string;
address: string;
zipCode: string;
passportType: string;
passportNumber: string;
@ -139,7 +138,6 @@ type EmployeeUpdate = {
addressEN?: string;
address?: string;
zipCode?: string;
passportType?: string;
passportNumber?: string;
@ -275,13 +273,16 @@ export class EmployeeController extends Controller {
const where = {
OR: [
{ firstName: { contains: query }, zipCode, gender, ...filterStatus(status) },
{ firstNameEN: { contains: query }, zipCode, gender, ...filterStatus(status) },
{ lastName: { contains: query }, zipCode, gender, ...filterStatus(status) },
{ lastNameEN: { contains: query }, zipCode, gender, ...filterStatus(status) },
{ firstName: { contains: query } },
{ firstNameEN: { contains: query } },
{ lastName: { contains: query } },
{ lastNameEN: { contains: query } },
],
AND: {
customerBranch: customerId ? { customerId: customerId } : undefined,
...filterStatus(status),
customerBranch: customerId ? { customerId } : undefined,
subDistrict: zipCode ? { zipCode } : undefined,
gender,
},
} satisfies Prisma.EmployeeWhereInput;