From 8a745fefa8b6d81c4d06c163e13f5864ea05caf5 Mon Sep 17 00:00:00 2001 From: Methapon Metanipat Date: Thu, 12 Sep 2024 09:48:56 +0700 Subject: [PATCH] refactor: input fields (branch, user) --- prisma/schema.prisma | 10 +++++++--- src/app.ts | 2 ++ src/controllers/01-branch-controller.ts | 6 ++++++ src/controllers/02-user-controller.ts | 8 ++++++++ 4 files changed, 23 insertions(+), 3 deletions(-) diff --git a/prisma/schema.prisma b/prisma/schema.prisma index bed5d87..f7d5f16 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -192,6 +192,10 @@ model Branch { nameEN String telephoneNo String + permitNo String + permitIssueDate DateTime @db.Date + permitExpireDate DateTime @db.Date + address String addressEN String @@ -340,9 +344,9 @@ model User { userType UserType userRole String - // citizenId String? - // citizenIssue DateTime? @db.Date - // citizenExpire DateTime? @db.Date + citizenId String + citizenIssue DateTime @db.Date + citizenExpire DateTime? @db.Date discountCondition String? diff --git a/src/app.ts b/src/app.ts index a13d83f..0f761a2 100644 --- a/src/app.ts +++ b/src/app.ts @@ -60,6 +60,8 @@ const APP_PORT = +(process.env.APP_PORT || 3000); lastNameEN: "System", statusOrder: 0, username: "admin", + citizenId: "", + citizenIssue: new Date(), }, }); } diff --git a/src/controllers/01-branch-controller.ts b/src/controllers/01-branch-controller.ts index 20b58dd..bceb729 100644 --- a/src/controllers/01-branch-controller.ts +++ b/src/controllers/01-branch-controller.ts @@ -44,6 +44,9 @@ type BranchCreate = { taxNo: string; nameEN: string; name: string; + permitNo: string; + permitIssueDate: Date; + permitExpireDate: Date; addressEN: string; address: string; soi?: string | null; @@ -83,6 +86,9 @@ type BranchUpdate = { taxNo?: string; nameEN?: string; name?: string; + permitNo?: string; + permitIssueDate?: Date; + permitExpireDate?: Date; addressEN?: string; address?: string; soi?: string | null; diff --git a/src/controllers/02-user-controller.ts b/src/controllers/02-user-controller.ts index 903d1d2..7290077 100644 --- a/src/controllers/02-user-controller.ts +++ b/src/controllers/02-user-controller.ts @@ -59,6 +59,10 @@ type UserCreate = { username: string; + citizenId: string; + citizenIssue: Date; + citizenExpire?: Date | null; + namePrefix?: string | null; firstName: string; firstNameEN: string; @@ -111,6 +115,10 @@ type UserUpdate = { userType?: UserType; userRole?: string; + citizenId?: string; + citizenIssue?: Date; + citizenExpire?: Date | null; + namePrefix?: string | null; firstName?: string; firstNameEN?: string;