From 236ee48eab8e79d3dae2861be14706cd7e2dc2c8 Mon Sep 17 00:00:00 2001 From: Methapon2001 <61303214+Methapon2001@users.noreply.github.com> Date: Wed, 16 Jul 2025 09:38:30 +0700 Subject: [PATCH] feat: foreign address --- prisma/schema.prisma | 19 +++++++++++++------ src/controllers/02-user-controller.ts | 8 ++++++++ 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/prisma/schema.prisma b/prisma/schema.prisma index e444ae1..db3ea95 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -398,14 +398,21 @@ model User { street String? streetEN String? - province Province? @relation(fields: [provinceId], references: [id], onDelete: SetNull) - provinceId String? + addressForeign Boolean @default(false) - district District? @relation(fields: [districtId], references: [id], onDelete: SetNull) - districtId String? + provinceText String? + province Province? @relation(fields: [provinceId], references: [id], onDelete: SetNull) + provinceId String? - subDistrict SubDistrict? @relation(fields: [subDistrictId], references: [id], onDelete: SetNull) - subDistrictId String? + districtText String? + district District? @relation(fields: [districtId], references: [id], onDelete: SetNull) + districtId String? + + subDistrictText String? + subDistrict SubDistrict? @relation(fields: [subDistrictId], references: [id], onDelete: SetNull) + subDistrictId String? + + zipCodeText String? email String telephoneNo String diff --git a/src/controllers/02-user-controller.ts b/src/controllers/02-user-controller.ts index 143eb71..b00f650 100644 --- a/src/controllers/02-user-controller.ts +++ b/src/controllers/02-user-controller.ts @@ -111,6 +111,7 @@ type UserCreate = { responsibleArea?: string[] | null; birthDate?: Date | null; + addressForeign?: boolean; address: string; addressEN: string; soi?: string | null; @@ -122,8 +123,11 @@ type UserCreate = { email: string; telephoneNo: string; + subDistrictText?: string | null; subDistrictId?: string | null; + districtText?: string | null; districtId?: string | null; + provinceText?: string | null; provinceId?: string | null; selectedImage?: string; @@ -173,6 +177,7 @@ type UserUpdate = { responsibleArea?: string[] | null; birthDate?: Date | null; + addressForeign?: boolean; address?: string; addressEN?: string; soi?: string | null; @@ -186,8 +191,11 @@ type UserUpdate = { selectedImage?: string; + subDistrictText?: string | null; subDistrictId?: string | null; + districtText?: string | null; districtId?: string | null; + provinceText?: string | null; provinceId?: string | null; branchId?: string | string[];