2024-04-01 13:28:43 +07:00
|
|
|
generator client {
|
|
|
|
|
provider = "prisma-client-js"
|
|
|
|
|
}
|
|
|
|
|
|
2024-06-26 11:22:48 +07:00
|
|
|
generator kysely {
|
|
|
|
|
provider = "prisma-kysely"
|
2024-06-26 11:53:25 +07:00
|
|
|
output = "../src/generated/kysely"
|
2024-06-26 11:22:48 +07:00
|
|
|
}
|
|
|
|
|
|
2024-04-01 13:28:43 +07:00
|
|
|
datasource db {
|
|
|
|
|
provider = "postgresql"
|
|
|
|
|
url = env("DATABASE_URL")
|
|
|
|
|
}
|
|
|
|
|
|
2024-10-29 15:11:43 +07:00
|
|
|
model Notification {
|
|
|
|
|
id String @id @default(cuid())
|
|
|
|
|
|
|
|
|
|
title String
|
|
|
|
|
detail String
|
|
|
|
|
|
2024-10-30 08:49:24 +07:00
|
|
|
groupReceiver NotificationGroup[]
|
2024-10-29 15:11:43 +07:00
|
|
|
|
|
|
|
|
receiver User? @relation(name: "NotificationReceiver", fields: [receiverId], references: [id], onDelete: Cascade)
|
|
|
|
|
receiverId String?
|
|
|
|
|
|
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
|
|
|
|
|
|
readByUser User[]
|
|
|
|
|
}
|
|
|
|
|
|
2024-10-30 08:49:24 +07:00
|
|
|
model NotificationGroup {
|
|
|
|
|
id String @id @default(cuid())
|
|
|
|
|
|
|
|
|
|
name String
|
|
|
|
|
|
|
|
|
|
notification Notification[]
|
|
|
|
|
}
|
|
|
|
|
|
2024-04-17 13:42:01 +07:00
|
|
|
model Menu {
|
2024-08-27 14:28:14 +07:00
|
|
|
id String @id @default(cuid())
|
2024-04-17 13:42:01 +07:00
|
|
|
|
|
|
|
|
caption String
|
|
|
|
|
captionEN String
|
|
|
|
|
menuType String
|
|
|
|
|
url String
|
|
|
|
|
|
|
|
|
|
createdBy String?
|
|
|
|
|
createdAt DateTime @default(now())
|
2024-07-01 13:24:02 +07:00
|
|
|
updatedBy String?
|
2024-04-17 13:42:01 +07:00
|
|
|
updatedAt DateTime @updatedAt
|
|
|
|
|
|
|
|
|
|
parent Menu? @relation(name: "MenuRelation", fields: [parentId], references: [id])
|
|
|
|
|
parentId String?
|
|
|
|
|
|
|
|
|
|
children Menu[] @relation(name: "MenuRelation")
|
|
|
|
|
roleMenuPermission RoleMenuPermission[]
|
|
|
|
|
userMenuPermission UserMenuPermission[]
|
|
|
|
|
userComponent MenuComponent[]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
model RoleMenuPermission {
|
2024-08-27 14:28:14 +07:00
|
|
|
id String @id @default(cuid())
|
2024-04-17 13:42:01 +07:00
|
|
|
|
|
|
|
|
userRole String
|
|
|
|
|
permission String
|
|
|
|
|
|
|
|
|
|
menu Menu @relation(fields: [menuId], references: [id])
|
|
|
|
|
menuId String
|
|
|
|
|
|
|
|
|
|
createdBy String?
|
|
|
|
|
createdAt DateTime @default(now())
|
2024-07-01 13:24:02 +07:00
|
|
|
updatedBy String?
|
2024-04-17 13:42:01 +07:00
|
|
|
updatedAt DateTime @updatedAt
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
model UserMenuPermission {
|
2024-08-27 14:28:14 +07:00
|
|
|
id String @id @default(cuid())
|
2024-04-17 13:42:01 +07:00
|
|
|
|
|
|
|
|
permission String
|
|
|
|
|
|
|
|
|
|
menu Menu @relation(fields: [menuId], references: [id])
|
|
|
|
|
menuId String
|
|
|
|
|
|
|
|
|
|
user User @relation(fields: [userId], references: [id])
|
|
|
|
|
userId String
|
|
|
|
|
|
|
|
|
|
createdBy String?
|
|
|
|
|
createdAt DateTime @default(now())
|
2024-07-01 13:24:02 +07:00
|
|
|
updatedBy String?
|
2024-04-17 13:42:01 +07:00
|
|
|
updatedAt DateTime @updatedAt
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
model MenuComponent {
|
2024-08-27 14:28:14 +07:00
|
|
|
id String @id @default(cuid())
|
2024-04-17 13:42:01 +07:00
|
|
|
|
|
|
|
|
componentId String
|
|
|
|
|
componentTag String
|
|
|
|
|
|
|
|
|
|
menu Menu @relation(fields: [menuId], references: [id])
|
|
|
|
|
menuId String
|
|
|
|
|
|
|
|
|
|
createdBy String?
|
|
|
|
|
createdAt DateTime @default(now())
|
2024-07-01 13:24:02 +07:00
|
|
|
updatedBy String?
|
2024-04-17 13:42:01 +07:00
|
|
|
updatedAt DateTime @updatedAt
|
|
|
|
|
roleMenuComponentPermission RoleMenuComponentPermission[]
|
|
|
|
|
userMennuComponentPermission UserMenuComponentPermission[]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
model RoleMenuComponentPermission {
|
2024-08-27 14:28:14 +07:00
|
|
|
id String @id @default(cuid())
|
2024-04-17 13:42:01 +07:00
|
|
|
|
2024-04-18 13:09:14 +07:00
|
|
|
userRole String
|
|
|
|
|
permission String
|
2024-04-17 13:42:01 +07:00
|
|
|
|
|
|
|
|
menuComponent MenuComponent @relation(fields: [menuComponentId], references: [id])
|
|
|
|
|
menuComponentId String
|
|
|
|
|
|
|
|
|
|
createdBy String?
|
|
|
|
|
createdAt DateTime @default(now())
|
2024-07-01 13:24:02 +07:00
|
|
|
updatedBy String?
|
2024-04-17 13:42:01 +07:00
|
|
|
updatedAt DateTime @updatedAt
|
|
|
|
|
}
|
|
|
|
|
|
2024-04-22 16:20:45 +07:00
|
|
|
model RunningNo {
|
|
|
|
|
key String @id @unique
|
|
|
|
|
value Int
|
|
|
|
|
}
|
|
|
|
|
|
2024-04-17 13:42:01 +07:00
|
|
|
model UserMenuComponentPermission {
|
2024-08-27 14:28:14 +07:00
|
|
|
id String @id @default(cuid())
|
2024-04-17 13:42:01 +07:00
|
|
|
|
|
|
|
|
userId String
|
|
|
|
|
user User @relation(fields: [userId], references: [id])
|
|
|
|
|
|
|
|
|
|
menuComponent MenuComponent @relation(fields: [menuComponentId], references: [id])
|
|
|
|
|
menuComponentId String
|
|
|
|
|
|
|
|
|
|
permission String
|
|
|
|
|
|
|
|
|
|
createdBy String?
|
|
|
|
|
createdAt DateTime @default(now())
|
2024-07-01 13:24:02 +07:00
|
|
|
updatedBy String?
|
2024-04-17 13:42:01 +07:00
|
|
|
updatedAt DateTime @updatedAt
|
|
|
|
|
}
|
|
|
|
|
|
2024-04-01 13:28:43 +07:00
|
|
|
model Province {
|
2024-08-27 14:28:14 +07:00
|
|
|
id String @id @default(cuid())
|
2024-04-04 13:42:46 +07:00
|
|
|
name String
|
2024-04-01 13:28:43 +07:00
|
|
|
nameEN String
|
|
|
|
|
|
|
|
|
|
createdBy String?
|
|
|
|
|
createdAt DateTime @default(now())
|
2024-07-01 13:24:02 +07:00
|
|
|
updatedBy String?
|
2024-04-01 13:28:43 +07:00
|
|
|
updatedAt DateTime @updatedAt
|
|
|
|
|
|
2024-09-17 10:39:22 +07:00
|
|
|
district District[]
|
|
|
|
|
branch Branch[]
|
|
|
|
|
user User[]
|
|
|
|
|
customerBranch CustomerBranch[]
|
|
|
|
|
employee Employee[]
|
|
|
|
|
employeeCheckup EmployeeCheckup[]
|
|
|
|
|
customerBranchCitizen CustomerBranchCitizen[]
|
|
|
|
|
customerBranchHouseRegis CustomerBranchHouseRegis[]
|
2024-11-05 09:36:01 +07:00
|
|
|
institution Institution[]
|
2024-04-01 13:28:43 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
model District {
|
2024-08-27 14:28:14 +07:00
|
|
|
id String @id @default(cuid())
|
2024-04-04 13:42:46 +07:00
|
|
|
name String
|
2024-04-01 13:28:43 +07:00
|
|
|
nameEN String
|
|
|
|
|
|
|
|
|
|
provinceId String
|
|
|
|
|
province Province @relation(fields: [provinceId], references: [id], onDelete: Cascade)
|
|
|
|
|
|
|
|
|
|
createdBy String?
|
|
|
|
|
createdAt DateTime @default(now())
|
2024-07-01 13:24:02 +07:00
|
|
|
updatedBy String?
|
2024-04-01 13:28:43 +07:00
|
|
|
updatedAt DateTime @updatedAt
|
|
|
|
|
|
2024-09-17 10:39:22 +07:00
|
|
|
subDistrict SubDistrict[]
|
|
|
|
|
branch Branch[]
|
|
|
|
|
user User[]
|
|
|
|
|
customerBranch CustomerBranch[]
|
|
|
|
|
employee Employee[]
|
|
|
|
|
CustomerBranchCitizen CustomerBranchCitizen[]
|
|
|
|
|
CustomerBranchHouseRegis CustomerBranchHouseRegis[]
|
2024-11-05 09:36:01 +07:00
|
|
|
institution Institution[]
|
2024-04-01 13:28:43 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
model SubDistrict {
|
2024-08-27 14:28:14 +07:00
|
|
|
id String @id @default(cuid())
|
2024-04-04 13:42:46 +07:00
|
|
|
name String
|
2024-04-01 13:28:43 +07:00
|
|
|
nameEN String
|
|
|
|
|
zipCode String
|
|
|
|
|
|
|
|
|
|
district District @relation(fields: [districtId], references: [id], onDelete: Cascade)
|
|
|
|
|
districtId String
|
|
|
|
|
|
|
|
|
|
createdBy String?
|
|
|
|
|
createdAt DateTime @default(now())
|
2024-07-01 13:24:02 +07:00
|
|
|
updatedBy String?
|
2024-04-01 13:28:43 +07:00
|
|
|
updatedAt DateTime @updatedAt
|
|
|
|
|
|
2024-09-17 10:39:22 +07:00
|
|
|
branch Branch[]
|
|
|
|
|
user User[]
|
|
|
|
|
customerBranch CustomerBranch[]
|
|
|
|
|
employee Employee[]
|
2024-11-05 09:35:05 +07:00
|
|
|
customerBranchCitizen CustomerBranchCitizen[]
|
|
|
|
|
customerBranchHouseRegis CustomerBranchHouseRegis[]
|
2024-11-05 09:36:01 +07:00
|
|
|
institution Institution[]
|
2024-04-01 13:28:43 +07:00
|
|
|
}
|
|
|
|
|
|
2024-04-02 10:48:35 +07:00
|
|
|
enum Status {
|
|
|
|
|
CREATED
|
2024-04-05 10:41:03 +07:00
|
|
|
ACTIVE
|
|
|
|
|
INACTIVE
|
2024-04-02 10:48:35 +07:00
|
|
|
}
|
|
|
|
|
|
2024-04-01 13:28:43 +07:00
|
|
|
model Branch {
|
2024-08-27 14:28:14 +07:00
|
|
|
id String @id @default(cuid())
|
2024-04-18 13:09:14 +07:00
|
|
|
code String
|
|
|
|
|
taxNo String
|
|
|
|
|
name String
|
|
|
|
|
nameEN String
|
2024-04-18 13:21:37 +07:00
|
|
|
telephoneNo String
|
2024-04-01 13:28:43 +07:00
|
|
|
|
2024-09-12 09:48:56 +07:00
|
|
|
permitNo String
|
|
|
|
|
permitIssueDate DateTime @db.Date
|
|
|
|
|
permitExpireDate DateTime @db.Date
|
|
|
|
|
|
2024-09-11 15:06:27 +07:00
|
|
|
address String
|
|
|
|
|
addressEN String
|
|
|
|
|
|
|
|
|
|
soi String?
|
|
|
|
|
soiEN String?
|
|
|
|
|
moo String?
|
|
|
|
|
mooEN String?
|
|
|
|
|
street String?
|
|
|
|
|
streetEN String?
|
|
|
|
|
|
2024-04-01 13:28:43 +07:00
|
|
|
province Province? @relation(fields: [provinceId], references: [id], onDelete: SetNull)
|
|
|
|
|
provinceId String?
|
|
|
|
|
|
|
|
|
|
district District? @relation(fields: [districtId], references: [id], onDelete: SetNull)
|
|
|
|
|
districtId String?
|
|
|
|
|
|
|
|
|
|
subDistrict SubDistrict? @relation(fields: [subDistrictId], references: [id], onDelete: SetNull)
|
|
|
|
|
subDistrictId String?
|
|
|
|
|
|
|
|
|
|
email String
|
2024-04-17 13:42:01 +07:00
|
|
|
contactName String?
|
2024-04-17 11:22:12 +07:00
|
|
|
lineId String?
|
2024-08-29 11:53:00 +07:00
|
|
|
webUrl String?
|
2024-04-01 13:28:43 +07:00
|
|
|
|
|
|
|
|
latitude String
|
|
|
|
|
longitude String
|
|
|
|
|
|
|
|
|
|
isHeadOffice Boolean @default(false)
|
|
|
|
|
|
|
|
|
|
headOffice Branch? @relation(name: "HeadOfficeRelation", fields: [headOfficeId], references: [id])
|
|
|
|
|
headOfficeId String?
|
|
|
|
|
|
2024-09-03 16:54:52 +07:00
|
|
|
virtual Boolean?
|
|
|
|
|
|
2024-09-09 14:58:42 +07:00
|
|
|
selectedImage String?
|
|
|
|
|
|
2024-09-24 09:56:05 +07:00
|
|
|
remark String?
|
|
|
|
|
|
2024-08-02 14:53:54 +07:00
|
|
|
bank BranchBank[]
|
|
|
|
|
|
2024-06-24 13:14:44 +07:00
|
|
|
status Status @default(CREATED)
|
|
|
|
|
statusOrder Int @default(0)
|
2024-04-01 13:28:43 +07:00
|
|
|
|
2024-07-01 13:24:02 +07:00
|
|
|
createdAt DateTime @default(now())
|
|
|
|
|
createdBy User? @relation(name: "BranchCreatedByUser", fields: [createdByUserId], references: [id], onDelete: SetNull)
|
|
|
|
|
createdByUserId String?
|
|
|
|
|
updatedAt DateTime @updatedAt
|
|
|
|
|
updatedBy User? @relation(name: "BranchUpdatedByUser", fields: [updatedByUserId], references: [id], onDelete: SetNull)
|
|
|
|
|
updatedByUserId String?
|
2024-04-01 13:28:43 +07:00
|
|
|
|
|
|
|
|
branch Branch[] @relation(name: "HeadOfficeRelation")
|
|
|
|
|
contact BranchContact[]
|
|
|
|
|
user BranchUser[]
|
2024-07-03 11:32:32 +07:00
|
|
|
|
|
|
|
|
customerRegistration Customer[]
|
2024-09-10 13:33:44 +07:00
|
|
|
productGroup ProductGroup[]
|
2024-10-15 17:09:05 +07:00
|
|
|
quotation Quotation[]
|
2024-10-24 15:56:03 +07:00
|
|
|
workflowTemplate WorkflowTemplate[]
|
2024-04-01 13:28:43 +07:00
|
|
|
}
|
|
|
|
|
|
2024-08-02 14:53:54 +07:00
|
|
|
model BranchBank {
|
2024-08-27 14:28:14 +07:00
|
|
|
id String @id @default(cuid())
|
2024-08-02 14:53:54 +07:00
|
|
|
bankName String
|
2024-08-02 17:30:29 +07:00
|
|
|
bankBranch String
|
2024-08-02 14:53:54 +07:00
|
|
|
accountName String
|
|
|
|
|
accountNumber String
|
2024-08-02 17:30:29 +07:00
|
|
|
accountType String
|
|
|
|
|
currentlyUse Boolean
|
2024-08-02 14:53:54 +07:00
|
|
|
|
2024-08-02 17:30:29 +07:00
|
|
|
branch Branch @relation(fields: [branchId], references: [id], onDelete: Cascade)
|
|
|
|
|
branchId String
|
2024-08-02 14:53:54 +07:00
|
|
|
}
|
|
|
|
|
|
2024-04-01 13:28:43 +07:00
|
|
|
model BranchContact {
|
2024-08-27 14:28:14 +07:00
|
|
|
id String @id @default(cuid())
|
2024-04-02 10:48:35 +07:00
|
|
|
telephoneNo String
|
2024-04-01 13:28:43 +07:00
|
|
|
|
|
|
|
|
branch Branch @relation(fields: [branchId], references: [id], onDelete: Cascade)
|
|
|
|
|
branchId String
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
model BranchUser {
|
2024-08-27 14:28:14 +07:00
|
|
|
id String @id @default(cuid())
|
2024-04-01 13:28:43 +07:00
|
|
|
|
|
|
|
|
branch Branch @relation(fields: [branchId], references: [id], onDelete: Cascade)
|
|
|
|
|
branchId String
|
|
|
|
|
|
|
|
|
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
|
|
|
userId String
|
|
|
|
|
|
2024-07-01 13:24:02 +07:00
|
|
|
createdAt DateTime @default(now())
|
|
|
|
|
createdBy User? @relation(name: "BranchUserCreatedByUser", fields: [createdByUserId], references: [id], onDelete: SetNull)
|
|
|
|
|
createdByUserId String?
|
|
|
|
|
updatedAt DateTime @updatedAt
|
|
|
|
|
updatedBy User? @relation(name: "BranchUserUpdatedByUser", fields: [updatedByUserId], references: [id], onDelete: SetNull)
|
|
|
|
|
updatedByUserId String?
|
2024-04-01 13:28:43 +07:00
|
|
|
}
|
|
|
|
|
|
2024-04-09 13:05:49 +07:00
|
|
|
enum UserType {
|
|
|
|
|
USER
|
|
|
|
|
MESSENGER
|
|
|
|
|
DELEGATE
|
|
|
|
|
AGENCY
|
|
|
|
|
}
|
|
|
|
|
|
2024-04-01 13:28:43 +07:00
|
|
|
model User {
|
2024-08-27 14:28:14 +07:00
|
|
|
id String @id @default(cuid())
|
2024-04-01 13:28:43 +07:00
|
|
|
|
2024-08-15 09:26:21 +07:00
|
|
|
code String?
|
|
|
|
|
namePrefix String?
|
|
|
|
|
firstName String
|
|
|
|
|
firstNameEN String
|
|
|
|
|
middleName String?
|
|
|
|
|
middleNameEN String?
|
|
|
|
|
lastName String
|
|
|
|
|
lastNameEN String
|
|
|
|
|
username String
|
|
|
|
|
gender String
|
2024-04-01 13:28:43 +07:00
|
|
|
|
2024-04-04 15:27:57 +07:00
|
|
|
address String
|
2024-04-01 13:28:43 +07:00
|
|
|
addressEN String
|
|
|
|
|
|
2024-09-11 15:06:27 +07:00
|
|
|
soi String?
|
|
|
|
|
soiEN String?
|
|
|
|
|
moo String?
|
|
|
|
|
mooEN String?
|
|
|
|
|
street String?
|
|
|
|
|
streetEN String?
|
|
|
|
|
|
2024-04-01 13:28:43 +07:00
|
|
|
province Province? @relation(fields: [provinceId], references: [id], onDelete: SetNull)
|
|
|
|
|
provinceId String?
|
|
|
|
|
|
|
|
|
|
district District? @relation(fields: [districtId], references: [id], onDelete: SetNull)
|
|
|
|
|
districtId String?
|
|
|
|
|
|
|
|
|
|
subDistrict SubDistrict? @relation(fields: [subDistrictId], references: [id], onDelete: SetNull)
|
|
|
|
|
subDistrictId String?
|
|
|
|
|
|
|
|
|
|
email String
|
|
|
|
|
telephoneNo String
|
|
|
|
|
|
2024-04-04 16:08:22 +07:00
|
|
|
registrationNo String?
|
2024-04-01 13:28:43 +07:00
|
|
|
|
2024-08-21 13:05:02 +07:00
|
|
|
startDate DateTime? @db.Date
|
|
|
|
|
retireDate DateTime? @db.Date
|
2024-04-01 13:28:43 +07:00
|
|
|
|
2024-04-17 16:21:53 +07:00
|
|
|
checkpoint String?
|
|
|
|
|
checkpointEN String?
|
|
|
|
|
|
2024-04-09 13:05:49 +07:00
|
|
|
userType UserType
|
2024-04-01 13:28:43 +07:00
|
|
|
userRole String
|
|
|
|
|
|
2024-09-12 09:48:56 +07:00
|
|
|
citizenId String
|
|
|
|
|
citizenIssue DateTime @db.Date
|
|
|
|
|
citizenExpire DateTime? @db.Date
|
2024-09-11 15:06:27 +07:00
|
|
|
|
2024-04-04 16:08:22 +07:00
|
|
|
discountCondition String?
|
2024-04-01 13:28:43 +07:00
|
|
|
|
2024-04-04 16:08:22 +07:00
|
|
|
licenseNo String?
|
2024-08-21 13:05:02 +07:00
|
|
|
licenseIssueDate DateTime? @db.Date
|
|
|
|
|
licenseExpireDate DateTime? @db.Date
|
2024-04-01 13:28:43 +07:00
|
|
|
|
2024-04-04 16:08:22 +07:00
|
|
|
sourceNationality String?
|
|
|
|
|
importNationality String?
|
2024-04-01 13:28:43 +07:00
|
|
|
|
2024-04-10 11:37:12 +07:00
|
|
|
trainingPlace String?
|
2024-11-05 09:33:45 +07:00
|
|
|
responsibleArea UserResponsibleArea[]
|
2024-04-10 11:37:12 +07:00
|
|
|
|
2024-08-21 13:05:02 +07:00
|
|
|
birthDate DateTime? @db.Date
|
2024-04-01 13:28:43 +07:00
|
|
|
|
2024-09-05 16:15:11 +07:00
|
|
|
selectedImage String?
|
|
|
|
|
|
2024-06-24 13:14:44 +07:00
|
|
|
status Status @default(CREATED)
|
|
|
|
|
statusOrder Int @default(0)
|
2024-04-01 13:28:43 +07:00
|
|
|
|
2024-07-01 13:24:02 +07:00
|
|
|
createdAt DateTime @default(now())
|
|
|
|
|
createdBy User? @relation(name: "UserCreatedByUser", fields: [createdByUserId], references: [id], onDelete: SetNull)
|
|
|
|
|
createdByUserId String?
|
|
|
|
|
updatedAt DateTime @updatedAt
|
|
|
|
|
updatedBy User? @relation(name: "UserUpdatedByUser", fields: [updatedByUserId], references: [id], onDelete: SetNull)
|
|
|
|
|
updatedByUserId String?
|
2024-04-01 13:28:43 +07:00
|
|
|
|
2024-04-17 13:42:01 +07:00
|
|
|
branch BranchUser[]
|
|
|
|
|
userMenuPermission UserMenuPermission[]
|
|
|
|
|
userMenuComponentPermission UserMenuComponentPermission[]
|
2024-10-07 11:58:43 +07:00
|
|
|
workflowTemplateStepUser WorkflowTemplateStepUser[]
|
2024-10-10 13:21:11 +07:00
|
|
|
requestWork RequestWork[]
|
2024-10-28 10:51:51 +07:00
|
|
|
customerBranch CustomerBranch[]
|
2024-07-01 13:24:02 +07:00
|
|
|
|
|
|
|
|
userCreated User[] @relation("UserCreatedByUser")
|
|
|
|
|
userUpdated User[] @relation("UserUpdatedByUser")
|
|
|
|
|
branchCreated Branch[] @relation("BranchCreatedByUser")
|
|
|
|
|
branchUpdated Branch[] @relation("BranchUpdatedByUser")
|
|
|
|
|
branchUserCreated BranchUser[] @relation("BranchUserCreatedByUser")
|
|
|
|
|
branchUserUpdated BranchUser[] @relation("BranchUserUpdatedByUser")
|
|
|
|
|
customerCreated Customer[] @relation("CustomerCreatedByUser")
|
|
|
|
|
customerUpdated Customer[] @relation("CustomerUpdatedByUser")
|
|
|
|
|
customerBranchCreated CustomerBranch[] @relation("CustomerBranchCreatedByUser")
|
|
|
|
|
customerBranchUpdated CustomerBranch[] @relation("CustomerBranchUpdatedByUser")
|
2024-10-29 14:52:51 +07:00
|
|
|
employeeCreated Employee[] @relation("EmployeeCreatedByUser")
|
2024-07-01 13:24:02 +07:00
|
|
|
employeUpdated Employee[] @relation("EmployeeUpdatedByUser")
|
|
|
|
|
employeeHistoryUpdated EmployeeHistory[] @relation("EmployeeHistoryUpdatedByUser")
|
|
|
|
|
employeeCheckupCreated EmployeeCheckup[] @relation("EmployeeCheckupCreatedByUser")
|
|
|
|
|
employeeCheckupUpdated EmployeeCheckup[] @relation("EmployeeCheckupUpdatedByUser")
|
|
|
|
|
employeeWorkCreated EmployeeWork[] @relation("EmployeeWorkCreatedByUser")
|
|
|
|
|
employeeWorkUpdated EmployeeWork[] @relation("EmployeeWorkUpdatedByUser")
|
|
|
|
|
employeeOtherInfoCreated EmployeeOtherInfo[] @relation("EmployeeOtherInfoCreatedByUser")
|
|
|
|
|
employeeOtherInfoUpdated EmployeeOtherInfo[] @relation("EmployeeOtherInfoUpdatedByUser")
|
|
|
|
|
serviceCreated Service[] @relation("ServiceCreatedByUser")
|
|
|
|
|
serviceUpdated Service[] @relation("ServiceUpdatedByUser")
|
|
|
|
|
workCreated Work[] @relation("WorkCreatedByUser")
|
|
|
|
|
workUpdated Work[] @relation("WorkUpdatedByUser")
|
|
|
|
|
workProductCreated WorkProduct[] @relation("WorkProductCreatedByUser")
|
|
|
|
|
workProductUpdated WorkProduct[] @relation("WorkProductUpdatedByUser")
|
|
|
|
|
productGroupCreated ProductGroup[] @relation("ProductGroupCreatedByUser")
|
|
|
|
|
productGroupUpdated ProductGroup[] @relation("ProductGroupUpdatedByUser")
|
|
|
|
|
productCreated Product[] @relation("ProductCreatedByUser")
|
|
|
|
|
productUpdated Product[] @relation("ProductUpdatedByUser")
|
2024-07-18 17:23:41 +07:00
|
|
|
quotationCreated Quotation[] @relation("QuotationCreatedByUser")
|
|
|
|
|
quotationUpdated Quotation[] @relation("QuotationUpdatedByUser")
|
2024-10-07 11:58:43 +07:00
|
|
|
flowCreated WorkflowTemplate[] @relation("FlowCreatedByUser")
|
|
|
|
|
flowUpdated WorkflowTemplate[] @relation("FlowUpdatedByUser")
|
2024-10-25 13:58:29 +07:00
|
|
|
invoiceCreated Invoice[]
|
|
|
|
|
paymentCreated Payment[]
|
2024-10-29 15:11:43 +07:00
|
|
|
notificationReceive Notification[] @relation("NotificationReceiver")
|
|
|
|
|
notificationRead Notification[]
|
2024-04-01 13:28:43 +07:00
|
|
|
}
|
|
|
|
|
|
2024-11-05 09:33:45 +07:00
|
|
|
model UserResponsibleArea {
|
|
|
|
|
id String @id @default(cuid())
|
|
|
|
|
area String
|
|
|
|
|
|
|
|
|
|
user User[]
|
|
|
|
|
}
|
|
|
|
|
|
2024-04-09 13:56:15 +07:00
|
|
|
enum CustomerType {
|
|
|
|
|
CORP
|
|
|
|
|
PERS
|
|
|
|
|
}
|
|
|
|
|
|
2024-04-01 13:28:43 +07:00
|
|
|
model Customer {
|
2024-08-27 14:28:14 +07:00
|
|
|
id String @id @default(cuid())
|
2024-08-20 15:41:48 +07:00
|
|
|
|
|
|
|
|
customerType CustomerType
|
2024-04-01 13:28:43 +07:00
|
|
|
|
2024-06-24 13:14:44 +07:00
|
|
|
status Status @default(CREATED)
|
|
|
|
|
statusOrder Int @default(0)
|
2024-04-01 13:28:43 +07:00
|
|
|
|
2024-09-12 15:08:07 +07:00
|
|
|
registeredBranchId String
|
|
|
|
|
registeredBranch Branch @relation(fields: [registeredBranchId], references: [id])
|
2024-07-03 11:32:32 +07:00
|
|
|
|
2024-09-10 09:56:46 +07:00
|
|
|
selectedImage String?
|
|
|
|
|
|
2024-07-01 13:24:02 +07:00
|
|
|
createdAt DateTime @default(now())
|
|
|
|
|
createdBy User? @relation(name: "CustomerCreatedByUser", fields: [createdByUserId], references: [id], onDelete: SetNull)
|
|
|
|
|
createdByUserId String?
|
|
|
|
|
updatedAt DateTime @updatedAt
|
|
|
|
|
updatedBy User? @relation(name: "CustomerUpdatedByUser", fields: [updatedByUserId], references: [id], onDelete: SetNull)
|
|
|
|
|
updatedByUserId String?
|
2024-04-01 13:28:43 +07:00
|
|
|
|
2024-09-30 09:48:35 +07:00
|
|
|
branch CustomerBranch[]
|
2024-04-01 13:28:43 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
model CustomerBranch {
|
2024-09-16 13:31:47 +07:00
|
|
|
id String @id @default(cuid())
|
|
|
|
|
customer Customer @relation(fields: [customerId], references: [id], onDelete: Cascade)
|
|
|
|
|
customerId String
|
2024-09-16 14:00:46 +07:00
|
|
|
customerName String?
|
2024-04-01 13:28:43 +07:00
|
|
|
|
2024-08-23 10:33:53 +07:00
|
|
|
code String
|
|
|
|
|
codeCustomer String
|
2024-04-01 13:28:43 +07:00
|
|
|
|
2024-09-13 13:27:12 +07:00
|
|
|
telephoneNo String
|
|
|
|
|
|
2024-08-20 15:41:48 +07:00
|
|
|
// NOTE: About (Natural Person)
|
2024-09-13 13:27:12 +07:00
|
|
|
namePrefix String?
|
|
|
|
|
firstName String?
|
|
|
|
|
firstNameEN String?
|
|
|
|
|
lastName String?
|
|
|
|
|
lastNameEN String?
|
|
|
|
|
gender String?
|
|
|
|
|
birthDate DateTime? @db.Date
|
|
|
|
|
citizenId String?
|
|
|
|
|
|
2024-08-20 15:41:48 +07:00
|
|
|
// NOTE: About (Legal Entity)
|
|
|
|
|
legalPersonNo String?
|
|
|
|
|
registerName String?
|
|
|
|
|
registerNameEN String?
|
2024-08-21 13:05:02 +07:00
|
|
|
registerDate DateTime? @db.Date
|
2024-08-20 15:41:48 +07:00
|
|
|
authorizedCapital String?
|
2024-09-16 11:03:34 +07:00
|
|
|
authorizedName String?
|
|
|
|
|
authorizedNameEN String?
|
2024-08-20 15:41:48 +07:00
|
|
|
|
2024-09-16 11:03:34 +07:00
|
|
|
// NOTE: Address
|
|
|
|
|
homeCode String
|
|
|
|
|
employmentOffice String
|
|
|
|
|
employmentOfficeEN String
|
|
|
|
|
address String
|
|
|
|
|
addressEN String
|
2024-04-01 13:28:43 +07:00
|
|
|
|
2024-09-11 15:06:27 +07:00
|
|
|
soi String?
|
|
|
|
|
soiEN String?
|
|
|
|
|
moo String?
|
|
|
|
|
mooEN String?
|
|
|
|
|
street String?
|
|
|
|
|
streetEN String?
|
|
|
|
|
|
2024-04-01 13:28:43 +07:00
|
|
|
province Province? @relation(fields: [provinceId], references: [id], onDelete: SetNull)
|
|
|
|
|
provinceId String?
|
|
|
|
|
|
|
|
|
|
district District? @relation(fields: [districtId], references: [id], onDelete: SetNull)
|
|
|
|
|
districtId String?
|
|
|
|
|
|
|
|
|
|
subDistrict SubDistrict? @relation(fields: [subDistrictId], references: [id], onDelete: SetNull)
|
|
|
|
|
subDistrictId String?
|
|
|
|
|
|
2024-09-16 11:03:34 +07:00
|
|
|
// NOTE: contact
|
2024-04-01 13:28:43 +07:00
|
|
|
email String
|
2024-09-16 11:03:34 +07:00
|
|
|
contactTel String
|
|
|
|
|
officeTel String
|
2024-08-21 16:52:59 +07:00
|
|
|
contactName String
|
2024-10-28 10:51:51 +07:00
|
|
|
agentUserId String?
|
|
|
|
|
agentUser User? @relation(fields: [agentUserId], references: [id], onDelete: SetNull)
|
2024-09-16 11:03:34 +07:00
|
|
|
|
|
|
|
|
// NOTE: Business
|
|
|
|
|
businessType String
|
|
|
|
|
jobPosition String
|
|
|
|
|
jobDescription String
|
|
|
|
|
payDate String
|
|
|
|
|
payDateEN String
|
|
|
|
|
wageRate Int
|
|
|
|
|
wageRateText String
|
2024-04-01 13:28:43 +07:00
|
|
|
|
2024-06-24 13:14:44 +07:00
|
|
|
status Status @default(CREATED)
|
|
|
|
|
statusOrder Int @default(0)
|
2024-04-04 17:42:52 +07:00
|
|
|
|
2024-07-01 13:24:02 +07:00
|
|
|
createdAt DateTime @default(now())
|
|
|
|
|
createdBy User? @relation(name: "CustomerBranchCreatedByUser", fields: [createdByUserId], references: [id], onDelete: SetNull)
|
|
|
|
|
createdByUserId String?
|
|
|
|
|
updatedAt DateTime @updatedAt
|
|
|
|
|
updatedBy User? @relation(name: "CustomerBranchUpdatedByUser", fields: [updatedByUserId], references: [id], onDelete: SetNull)
|
|
|
|
|
updatedByUserId String?
|
2024-04-01 13:28:43 +07:00
|
|
|
|
2024-07-18 17:23:41 +07:00
|
|
|
employee Employee[]
|
|
|
|
|
quotation Quotation[]
|
2024-09-17 10:57:42 +07:00
|
|
|
|
|
|
|
|
citizen CustomerBranchCitizen[]
|
|
|
|
|
poa CustomerBranchPoa[]
|
|
|
|
|
houseRegis CustomerBranchHouseRegis[]
|
|
|
|
|
commercialRegis CustomerBranchCommercialRegis[]
|
|
|
|
|
vatRegis CustomerBranchVatRegis[]
|
2024-04-01 13:28:43 +07:00
|
|
|
}
|
|
|
|
|
|
2024-09-17 10:39:22 +07:00
|
|
|
model CustomerBranchCitizen {
|
2024-09-19 14:06:36 +07:00
|
|
|
id String @id @default(cuid())
|
|
|
|
|
citizenId String
|
|
|
|
|
birthDate DateTime? @db.Date
|
2024-09-17 10:39:22 +07:00
|
|
|
namePrefix String?
|
|
|
|
|
firstName String
|
|
|
|
|
firstNameEN String?
|
|
|
|
|
middleName String?
|
|
|
|
|
middleNameEN String?
|
|
|
|
|
lastName String
|
|
|
|
|
lastNameEN String?
|
2024-09-19 14:06:36 +07:00
|
|
|
issueDate DateTime @db.Date
|
|
|
|
|
expireDate DateTime @db.Date
|
2024-09-17 10:39:22 +07:00
|
|
|
nationality String
|
|
|
|
|
religion String
|
|
|
|
|
gender String
|
|
|
|
|
|
|
|
|
|
address String?
|
|
|
|
|
addressEN String?
|
|
|
|
|
soi String?
|
|
|
|
|
soiEN String?
|
|
|
|
|
moo String?
|
|
|
|
|
mooEN String?
|
|
|
|
|
street String?
|
|
|
|
|
streetEN String?
|
|
|
|
|
province Province? @relation(fields: [provinceId], references: [id], onDelete: SetNull)
|
|
|
|
|
provinceId String?
|
|
|
|
|
district District? @relation(fields: [districtId], references: [id], onDelete: SetNull)
|
|
|
|
|
districtId String?
|
|
|
|
|
subDistrict SubDistrict? @relation(fields: [subDistrictId], references: [id], onDelete: SetNull)
|
|
|
|
|
subDistrictId String?
|
2024-09-17 10:45:21 +07:00
|
|
|
createdAt DateTime @default(now())
|
|
|
|
|
updatedAt DateTime @updatedAt
|
2024-09-17 10:57:42 +07:00
|
|
|
|
|
|
|
|
customerBranchId String
|
2024-09-25 16:42:02 +07:00
|
|
|
customerBranch CustomerBranch @relation(fields: [customerBranchId], references: [id], onDelete: Cascade)
|
2024-09-17 10:39:22 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
model CustomerBranchPoa {
|
2024-09-17 10:45:21 +07:00
|
|
|
id String @id @default(cuid())
|
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
|
updatedAt DateTime @updatedAt
|
2024-09-17 10:57:42 +07:00
|
|
|
|
|
|
|
|
customerBranchId String
|
2024-09-25 16:42:02 +07:00
|
|
|
customerBranch CustomerBranch @relation(fields: [customerBranchId], references: [id], onDelete: Cascade)
|
2024-09-17 10:39:22 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
model CustomerBranchHouseRegis {
|
|
|
|
|
id String @id @default(cuid())
|
|
|
|
|
|
|
|
|
|
registrationOffice String
|
|
|
|
|
houseId String
|
|
|
|
|
houseNo String
|
|
|
|
|
villageNo String
|
|
|
|
|
|
|
|
|
|
address String?
|
|
|
|
|
addressEN String?
|
|
|
|
|
soi String?
|
|
|
|
|
soiEN String?
|
|
|
|
|
moo String?
|
|
|
|
|
mooEN String?
|
|
|
|
|
street String?
|
|
|
|
|
streetEN String?
|
|
|
|
|
province Province? @relation(fields: [provinceId], references: [id], onDelete: SetNull)
|
|
|
|
|
provinceId String?
|
|
|
|
|
district District? @relation(fields: [districtId], references: [id], onDelete: SetNull)
|
|
|
|
|
districtId String?
|
|
|
|
|
subDistrict SubDistrict? @relation(fields: [subDistrictId], references: [id], onDelete: SetNull)
|
|
|
|
|
subDistrictId String?
|
|
|
|
|
|
|
|
|
|
namePrefix String?
|
|
|
|
|
firstName String
|
|
|
|
|
firstNameEN String?
|
|
|
|
|
middleName String?
|
|
|
|
|
middleNameEN String?
|
|
|
|
|
lastName String
|
|
|
|
|
lastNameEN String?
|
|
|
|
|
issueDate DateTime @db.Date
|
|
|
|
|
expireDate DateTime @db.Date
|
|
|
|
|
nationality String
|
|
|
|
|
religion String
|
|
|
|
|
gender String
|
|
|
|
|
marriageStatus String
|
|
|
|
|
citizenId String
|
|
|
|
|
birthDate DateTime @db.Date
|
|
|
|
|
motherFullName String
|
|
|
|
|
motherFullNameEN String?
|
|
|
|
|
motherCitizenId String
|
|
|
|
|
motherNationality String?
|
|
|
|
|
fatherFullName String
|
|
|
|
|
fatherFullNameEN String?
|
|
|
|
|
fatherCitizenId String
|
|
|
|
|
fatherNationality String?
|
2024-09-17 10:45:21 +07:00
|
|
|
createdAt DateTime @default(now())
|
|
|
|
|
updatedAt DateTime @updatedAt
|
2024-09-17 10:57:42 +07:00
|
|
|
|
|
|
|
|
customerBranchId String
|
2024-09-25 16:42:02 +07:00
|
|
|
customerBranch CustomerBranch @relation(fields: [customerBranchId], references: [id], onDelete: Cascade)
|
2024-09-17 10:39:22 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
enum CommercialType {
|
|
|
|
|
CORP
|
|
|
|
|
PERS
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
model CustomerBranchCommercialRegis {
|
|
|
|
|
id String @id @default(cuid())
|
|
|
|
|
registrationNo String
|
|
|
|
|
registrationType CommercialType
|
|
|
|
|
requestNo String? // NOTE: CORP only
|
|
|
|
|
namePrefix String? // NOTE: PERS only
|
|
|
|
|
fullName String
|
|
|
|
|
fullNameEN String
|
|
|
|
|
registrationDate String
|
|
|
|
|
romanLetter String?
|
2024-09-17 10:45:21 +07:00
|
|
|
createdAt DateTime @default(now())
|
|
|
|
|
updatedAt DateTime @updatedAt
|
2024-09-17 10:57:42 +07:00
|
|
|
|
|
|
|
|
customerBranchId String
|
2024-09-25 16:42:02 +07:00
|
|
|
customerBranch CustomerBranch @relation(fields: [customerBranchId], references: [id], onDelete: Cascade)
|
2024-09-17 10:39:22 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
model CustomerBranchVatRegis {
|
2024-09-17 10:45:21 +07:00
|
|
|
id String @id @default(cuid())
|
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
|
updatedAt DateTime @updatedAt
|
2024-09-17 10:57:42 +07:00
|
|
|
|
|
|
|
|
customerBranchId String
|
2024-09-25 16:42:02 +07:00
|
|
|
customerBranch CustomerBranch @relation(fields: [customerBranchId], references: [id], onDelete: Cascade)
|
2024-09-17 10:39:22 +07:00
|
|
|
}
|
|
|
|
|
|
2024-04-01 13:28:43 +07:00
|
|
|
model Employee {
|
2024-08-27 14:28:14 +07:00
|
|
|
id String @id @default(cuid())
|
2024-04-01 13:28:43 +07:00
|
|
|
|
2024-08-27 14:27:39 +07:00
|
|
|
code String
|
|
|
|
|
nrcNo String?
|
|
|
|
|
|
|
|
|
|
namePrefix String?
|
|
|
|
|
firstName String
|
|
|
|
|
firstNameEN String
|
|
|
|
|
middleName String?
|
|
|
|
|
middleNameEN String?
|
|
|
|
|
lastName String
|
|
|
|
|
lastNameEN String
|
2024-04-04 17:42:52 +07:00
|
|
|
|
2024-08-21 13:05:02 +07:00
|
|
|
dateOfBirth DateTime @db.Date
|
2024-04-01 13:28:43 +07:00
|
|
|
gender String
|
|
|
|
|
nationality String
|
|
|
|
|
|
2024-06-12 17:01:42 +07:00
|
|
|
address String?
|
|
|
|
|
addressEN String?
|
2024-04-01 13:28:43 +07:00
|
|
|
|
2024-09-11 15:06:27 +07:00
|
|
|
soi String?
|
|
|
|
|
soiEN String?
|
|
|
|
|
moo String?
|
|
|
|
|
mooEN String?
|
|
|
|
|
street String?
|
|
|
|
|
streetEN String?
|
|
|
|
|
|
2024-04-01 13:28:43 +07:00
|
|
|
province Province? @relation(fields: [provinceId], references: [id], onDelete: SetNull)
|
|
|
|
|
provinceId String?
|
|
|
|
|
|
|
|
|
|
district District? @relation(fields: [districtId], references: [id], onDelete: SetNull)
|
|
|
|
|
districtId String?
|
|
|
|
|
|
|
|
|
|
subDistrict SubDistrict? @relation(fields: [subDistrictId], references: [id], onDelete: SetNull)
|
|
|
|
|
subDistrictId String?
|
|
|
|
|
|
2024-09-13 17:39:12 +07:00
|
|
|
workerType String?
|
|
|
|
|
workerStatus String?
|
2024-04-01 13:28:43 +07:00
|
|
|
|
2024-09-06 11:56:37 +07:00
|
|
|
customerBranch CustomerBranch @relation(fields: [customerBranchId], references: [id], onDelete: Cascade)
|
|
|
|
|
customerBranchId String
|
2024-04-01 13:28:43 +07:00
|
|
|
|
2024-09-11 13:30:56 +07:00
|
|
|
status Status @default(CREATED)
|
|
|
|
|
statusOrder Int @default(0)
|
|
|
|
|
selectedImage String?
|
2024-04-01 13:28:43 +07:00
|
|
|
|
2024-07-01 13:24:02 +07:00
|
|
|
createdAt DateTime @default(now())
|
|
|
|
|
createdBy User? @relation(name: "EmployeeCreatedByUser", fields: [createdByUserId], references: [id], onDelete: SetNull)
|
|
|
|
|
createdByUserId String?
|
|
|
|
|
updatedAt DateTime @updatedAt
|
|
|
|
|
updatedBy User? @relation(name: "EmployeeUpdatedByUser", fields: [updatedByUserId], references: [id], onDelete: SetNull)
|
|
|
|
|
updatedByUserId String?
|
2024-04-01 13:28:43 +07:00
|
|
|
|
2024-09-13 17:39:12 +07:00
|
|
|
employeePassport EmployeePassport[]
|
|
|
|
|
employeeVisa EmployeeVisa[]
|
|
|
|
|
employeeInCountryNotice EmployeeInCountryNotice[]
|
|
|
|
|
employeeCheckup EmployeeCheckup[]
|
|
|
|
|
employeeWork EmployeeWork[]
|
|
|
|
|
employeeOtherInfo EmployeeOtherInfo?
|
2024-06-28 08:57:53 +07:00
|
|
|
|
2024-10-04 16:39:37 +07:00
|
|
|
editHistory EmployeeHistory[]
|
|
|
|
|
quotationWorker QuotationWorker[]
|
|
|
|
|
quotationProductServiceWorker QuotationProductServiceWorker[]
|
2024-10-09 15:04:59 +07:00
|
|
|
requestData RequestData[]
|
2024-06-28 08:57:53 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
model EmployeeHistory {
|
2024-08-27 14:28:14 +07:00
|
|
|
id String @id @default(cuid())
|
2024-06-28 08:57:53 +07:00
|
|
|
field String
|
|
|
|
|
valueBefore Json
|
|
|
|
|
valueAfter Json
|
|
|
|
|
|
2024-07-01 13:24:02 +07:00
|
|
|
updatedAt DateTime @updatedAt
|
|
|
|
|
updatedBy User? @relation(name: "EmployeeHistoryUpdatedByUser", fields: [updatedByUserId], references: [id], onDelete: SetNull)
|
2024-06-28 09:31:17 +07:00
|
|
|
updatedByUserId String?
|
|
|
|
|
|
2024-06-28 08:57:53 +07:00
|
|
|
masterId String
|
|
|
|
|
master Employee @relation(fields: [masterId], references: [id], onDelete: Cascade)
|
2024-04-01 13:28:43 +07:00
|
|
|
}
|
|
|
|
|
|
2024-09-13 17:39:12 +07:00
|
|
|
model EmployeePassport {
|
|
|
|
|
id String @id @default(cuid())
|
|
|
|
|
|
|
|
|
|
number String
|
|
|
|
|
type String
|
|
|
|
|
issueDate DateTime @db.Date
|
|
|
|
|
expireDate DateTime @db.Date
|
|
|
|
|
issueCountry String
|
|
|
|
|
issuePlace String
|
|
|
|
|
previousPassportRef String?
|
|
|
|
|
|
2024-09-18 09:25:19 +07:00
|
|
|
employee Employee @relation(fields: [employeeId], references: [id], onDelete: Cascade)
|
2024-09-13 17:39:12 +07:00
|
|
|
employeeId String
|
|
|
|
|
|
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
|
updatedAt DateTime @updatedAt
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
model EmployeeVisa {
|
|
|
|
|
id String @id @default(cuid())
|
|
|
|
|
|
|
|
|
|
number String
|
|
|
|
|
type String
|
|
|
|
|
entryCount Int
|
|
|
|
|
issueCountry String
|
|
|
|
|
issuePlace String
|
|
|
|
|
issueDate DateTime @db.Date
|
|
|
|
|
expireDate DateTime @db.Date
|
|
|
|
|
mrz String?
|
|
|
|
|
remark String?
|
|
|
|
|
|
2024-09-18 09:25:19 +07:00
|
|
|
employee Employee @relation(fields: [employeeId], references: [id], onDelete: Cascade)
|
2024-09-13 17:39:12 +07:00
|
|
|
employeeId String
|
|
|
|
|
|
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
|
updatedAt DateTime @updatedAt
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
model EmployeeInCountryNotice {
|
|
|
|
|
id String @id @default(cuid())
|
|
|
|
|
|
|
|
|
|
noticeNumber String
|
|
|
|
|
noticeDate String
|
|
|
|
|
nextNoticeDate DateTime @db.Date
|
|
|
|
|
tmNumber String
|
|
|
|
|
|
|
|
|
|
entryDate DateTime @db.Date
|
|
|
|
|
travelBy String
|
|
|
|
|
travelFrom String
|
|
|
|
|
|
2024-09-18 09:25:19 +07:00
|
|
|
employee Employee @relation(fields: [employeeId], references: [id], onDelete: Cascade)
|
2024-09-13 17:39:12 +07:00
|
|
|
employeeId String
|
|
|
|
|
|
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
|
updatedAt DateTime @updatedAt
|
|
|
|
|
}
|
|
|
|
|
|
2024-04-01 13:28:43 +07:00
|
|
|
model EmployeeCheckup {
|
2024-08-27 14:28:14 +07:00
|
|
|
id String @id @default(cuid())
|
2024-04-01 13:28:43 +07:00
|
|
|
|
|
|
|
|
employee Employee @relation(fields: [employeeId], references: [id], onDelete: Cascade)
|
|
|
|
|
employeeId String
|
|
|
|
|
|
2024-06-11 11:27:00 +07:00
|
|
|
checkupResult String?
|
|
|
|
|
checkupType String?
|
2024-04-01 13:28:43 +07:00
|
|
|
|
|
|
|
|
province Province? @relation(fields: [provinceId], references: [id], onDelete: SetNull)
|
|
|
|
|
provinceId String?
|
|
|
|
|
|
2024-06-11 11:27:00 +07:00
|
|
|
hospitalName String?
|
|
|
|
|
remark String?
|
|
|
|
|
medicalBenefitScheme String?
|
|
|
|
|
insuranceCompany String?
|
2024-08-21 13:05:02 +07:00
|
|
|
coverageStartDate DateTime? @db.Date
|
|
|
|
|
coverageExpireDate DateTime? @db.Date
|
2024-04-01 13:28:43 +07:00
|
|
|
|
2024-07-01 13:24:02 +07:00
|
|
|
createdAt DateTime @default(now())
|
|
|
|
|
createdBy User? @relation(name: "EmployeeCheckupCreatedByUser", fields: [createdByUserId], references: [id], onDelete: SetNull)
|
|
|
|
|
createdByUserId String?
|
|
|
|
|
updatedAt DateTime @updatedAt
|
|
|
|
|
updatedBy User? @relation(name: "EmployeeCheckupUpdatedByUser", fields: [updatedByUserId], references: [id], onDelete: SetNull)
|
|
|
|
|
updatedByUserId String?
|
2024-04-01 13:28:43 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
model EmployeeWork {
|
2024-08-27 14:28:14 +07:00
|
|
|
id String @id @default(cuid())
|
2024-04-01 13:28:43 +07:00
|
|
|
|
|
|
|
|
employee Employee @relation(fields: [employeeId], references: [id], onDelete: Cascade)
|
|
|
|
|
employeeId String
|
|
|
|
|
|
2024-06-11 11:27:00 +07:00
|
|
|
ownerName String?
|
|
|
|
|
positionName String?
|
|
|
|
|
jobType String?
|
|
|
|
|
workplace String?
|
|
|
|
|
workPermitNo String?
|
2024-10-30 09:02:29 +07:00
|
|
|
workPermitIssueDate DateTime? @db.Date
|
2024-08-21 13:05:02 +07:00
|
|
|
workPermitExpireDate DateTime? @db.Date
|
|
|
|
|
workEndDate DateTime? @db.Date
|
2024-06-10 16:06:33 +07:00
|
|
|
remark String?
|
2024-04-01 13:28:43 +07:00
|
|
|
|
2024-07-01 13:24:02 +07:00
|
|
|
createdAt DateTime @default(now())
|
|
|
|
|
createdBy User? @relation(name: "EmployeeWorkCreatedByUser", fields: [createdByUserId], references: [id], onDelete: SetNull)
|
|
|
|
|
createdByUserId String?
|
|
|
|
|
updatedAt DateTime @updatedAt
|
|
|
|
|
updatedBy User? @relation(name: "EmployeeWorkUpdatedByUser", fields: [updatedByUserId], references: [id], onDelete: SetNull)
|
|
|
|
|
updatedByUserId String?
|
2024-04-01 13:28:43 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
model EmployeeOtherInfo {
|
2024-08-27 14:28:14 +07:00
|
|
|
id String @id @default(cuid())
|
2024-04-01 13:28:43 +07:00
|
|
|
|
|
|
|
|
employee Employee @relation(fields: [employeeId], references: [id], onDelete: Cascade)
|
2024-08-05 10:59:44 +07:00
|
|
|
employeeId String @unique
|
2024-04-01 13:28:43 +07:00
|
|
|
|
2024-06-11 11:27:00 +07:00
|
|
|
citizenId String?
|
|
|
|
|
fatherBirthPlace String?
|
|
|
|
|
fatherFirstName String?
|
|
|
|
|
fatherLastName String?
|
|
|
|
|
motherBirthPlace String?
|
|
|
|
|
motherFirstName String?
|
|
|
|
|
motherLastName String?
|
|
|
|
|
|
|
|
|
|
fatherFirstNameEN String?
|
|
|
|
|
fatherLastNameEN String?
|
|
|
|
|
motherFirstNameEN String?
|
|
|
|
|
motherLastNameEN String?
|
2024-04-01 13:28:43 +07:00
|
|
|
|
2024-07-01 13:24:02 +07:00
|
|
|
createdAt DateTime @default(now())
|
|
|
|
|
createdBy User? @relation(name: "EmployeeOtherInfoCreatedByUser", fields: [createdByUserId], references: [id], onDelete: SetNull)
|
|
|
|
|
createdByUserId String?
|
|
|
|
|
updatedAt DateTime @updatedAt
|
|
|
|
|
updatedBy User? @relation(name: "EmployeeOtherInfoUpdatedByUser", fields: [updatedByUserId], references: [id], onDelete: SetNull)
|
|
|
|
|
updatedByUserId String?
|
2024-04-01 13:28:43 +07:00
|
|
|
}
|
|
|
|
|
|
2024-11-05 09:36:01 +07:00
|
|
|
model Institution {
|
2024-11-07 08:45:46 +07:00
|
|
|
id String @id @default(cuid())
|
|
|
|
|
code String
|
|
|
|
|
group String // Use for grouping, but not use relation
|
|
|
|
|
name String
|
2024-11-05 09:36:01 +07:00
|
|
|
|
|
|
|
|
address String
|
|
|
|
|
addressEN String
|
|
|
|
|
|
|
|
|
|
soi String?
|
|
|
|
|
soiEN String?
|
|
|
|
|
moo String?
|
|
|
|
|
mooEN String?
|
|
|
|
|
street String?
|
|
|
|
|
streetEN String?
|
|
|
|
|
|
|
|
|
|
province Province @relation(fields: [provinceId], references: [id], onDelete: Cascade)
|
|
|
|
|
provinceId String
|
|
|
|
|
|
|
|
|
|
district District @relation(fields: [districtId], references: [id], onDelete: Cascade)
|
|
|
|
|
districtId String
|
|
|
|
|
|
|
|
|
|
subDistrict SubDistrict @relation(fields: [subDistrictId], references: [id], onDelete: Cascade)
|
|
|
|
|
subDistrictId String
|
|
|
|
|
}
|
|
|
|
|
|
2024-10-07 11:58:43 +07:00
|
|
|
model WorkflowTemplate {
|
|
|
|
|
id String @id @default(cuid())
|
|
|
|
|
name String
|
|
|
|
|
|
|
|
|
|
step WorkflowTemplateStep[]
|
|
|
|
|
|
2024-10-24 15:56:03 +07:00
|
|
|
registeredBranch Branch @relation(fields: [registeredBranchId], references: [id])
|
|
|
|
|
registeredBranchId String
|
|
|
|
|
|
2024-10-07 11:58:43 +07:00
|
|
|
status Status @default(CREATED)
|
|
|
|
|
statusOrder Int @default(0)
|
|
|
|
|
|
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
|
createdBy User? @relation(name: "FlowCreatedByUser", fields: [createdByUserId], references: [id], onDelete: SetNull)
|
|
|
|
|
createdByUserId String?
|
|
|
|
|
updatedAt DateTime @updatedAt
|
|
|
|
|
updatedBy User? @relation(name: "FlowUpdatedByUser", fields: [updatedByUserId], references: [id], onDelete: SetNull)
|
|
|
|
|
updatedByUserId String?
|
2024-10-10 12:03:40 +07:00
|
|
|
|
|
|
|
|
service Service[]
|
2024-10-07 11:58:43 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
model WorkflowTemplateStep {
|
|
|
|
|
id String @id @default(cuid())
|
|
|
|
|
|
|
|
|
|
order Int
|
|
|
|
|
name String
|
2024-11-05 08:31:57 +07:00
|
|
|
detail String?
|
2024-10-07 11:58:43 +07:00
|
|
|
type String?
|
|
|
|
|
value WorkflowTemplateStepValue[] // NOTE: For enum or options type
|
|
|
|
|
responsiblePerson WorkflowTemplateStepUser[]
|
|
|
|
|
|
|
|
|
|
workflowTemplate WorkflowTemplate? @relation(fields: [workflowTemplateId], references: [id])
|
|
|
|
|
workflowTemplateId String?
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
model WorkflowTemplateStepValue {
|
|
|
|
|
id String @id @default(cuid())
|
|
|
|
|
|
|
|
|
|
value String
|
|
|
|
|
|
|
|
|
|
workflowTemplateStep WorkflowTemplateStep @relation(fields: [workflowTemplateStepId], references: [id])
|
|
|
|
|
workflowTemplateStepId String
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
model WorkflowTemplateStepUser {
|
|
|
|
|
userId String
|
|
|
|
|
user User @relation(fields: [userId], references: [id])
|
|
|
|
|
|
2024-10-28 10:34:00 +07:00
|
|
|
workflowTemplateStep WorkflowTemplateStep @relation(fields: [workflowTemplateStepId], references: [id], onDelete: Cascade)
|
2024-10-07 11:58:43 +07:00
|
|
|
workflowTemplateStepId String
|
|
|
|
|
|
|
|
|
|
@@id([userId, workflowTemplateStepId])
|
|
|
|
|
}
|
|
|
|
|
|
2024-04-01 13:28:43 +07:00
|
|
|
model ProductGroup {
|
2024-08-27 14:28:14 +07:00
|
|
|
id String @id @default(cuid())
|
2024-04-01 13:28:43 +07:00
|
|
|
|
|
|
|
|
code String
|
|
|
|
|
name String
|
|
|
|
|
detail String
|
|
|
|
|
remark String
|
2024-10-28 10:51:51 +07:00
|
|
|
shared Boolean @default(false)
|
2024-04-02 11:54:11 +07:00
|
|
|
|
2024-06-24 13:14:44 +07:00
|
|
|
status Status @default(CREATED)
|
|
|
|
|
statusOrder Int @default(0)
|
2024-04-01 13:28:43 +07:00
|
|
|
|
2024-09-10 14:36:26 +07:00
|
|
|
registeredBranchId String
|
|
|
|
|
registeredBranch Branch @relation(fields: [registeredBranchId], references: [id])
|
2024-09-06 11:56:37 +07:00
|
|
|
|
2024-07-01 13:24:02 +07:00
|
|
|
createdAt DateTime @default(now())
|
|
|
|
|
createdBy User? @relation(name: "ProductGroupCreatedByUser", fields: [createdByUserId], references: [id], onDelete: SetNull)
|
|
|
|
|
createdByUserId String?
|
|
|
|
|
updatedAt DateTime @updatedAt
|
|
|
|
|
updatedBy User? @relation(name: "ProductGroupUpdatedByUser", fields: [updatedByUserId], references: [id], onDelete: SetNull)
|
|
|
|
|
updatedByUserId String?
|
2024-06-11 13:01:20 +07:00
|
|
|
|
2024-07-03 11:32:32 +07:00
|
|
|
service Service[]
|
2024-09-03 14:06:02 +07:00
|
|
|
product Product[]
|
2024-04-01 13:28:43 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
model Product {
|
2024-08-27 14:28:14 +07:00
|
|
|
id String @id @default(cuid())
|
2024-04-01 13:28:43 +07:00
|
|
|
|
|
|
|
|
code String
|
|
|
|
|
name String
|
|
|
|
|
detail String
|
2024-06-14 16:53:48 +07:00
|
|
|
process Int
|
2024-06-26 11:22:48 +07:00
|
|
|
price Float
|
|
|
|
|
agentPrice Float
|
|
|
|
|
serviceCharge Float
|
2024-09-03 14:06:02 +07:00
|
|
|
vatIncluded Boolean?
|
|
|
|
|
expenseType String?
|
2024-04-02 11:54:11 +07:00
|
|
|
|
2024-10-15 09:42:16 +07:00
|
|
|
calcVat Boolean @default(true)
|
|
|
|
|
|
2024-06-24 13:14:44 +07:00
|
|
|
status Status @default(CREATED)
|
|
|
|
|
statusOrder Int @default(0)
|
2024-04-01 13:28:43 +07:00
|
|
|
|
2024-09-10 13:33:44 +07:00
|
|
|
shared Boolean @default(false)
|
|
|
|
|
|
2024-09-10 15:51:22 +07:00
|
|
|
remark String?
|
|
|
|
|
selectedImage String?
|
2024-06-14 16:53:48 +07:00
|
|
|
|
2024-09-10 14:36:26 +07:00
|
|
|
productGroup ProductGroup @relation(fields: [productGroupId], references: [id], onDelete: Cascade)
|
|
|
|
|
productGroupId String
|
2024-07-03 11:32:32 +07:00
|
|
|
|
2024-07-18 17:23:41 +07:00
|
|
|
workProduct WorkProduct[]
|
2024-10-01 15:36:45 +07:00
|
|
|
quotationProductServiceList QuotationProductServiceList[]
|
2024-04-01 13:28:43 +07:00
|
|
|
|
2024-07-01 13:24:02 +07:00
|
|
|
createdAt DateTime @default(now())
|
|
|
|
|
createdBy User? @relation(name: "ProductCreatedByUser", fields: [createdByUserId], references: [id], onDelete: SetNull)
|
|
|
|
|
createdByUserId String?
|
|
|
|
|
updatedAt DateTime @updatedAt
|
|
|
|
|
updatedBy User? @relation(name: "ProductUpdatedByUser", fields: [updatedByUserId], references: [id], onDelete: SetNull)
|
|
|
|
|
updatedByUserId String?
|
2024-04-01 13:28:43 +07:00
|
|
|
}
|
2024-07-03 11:32:32 +07:00
|
|
|
|
|
|
|
|
model Service {
|
2024-08-27 14:28:14 +07:00
|
|
|
id String @id @default(cuid())
|
2024-07-03 11:32:32 +07:00
|
|
|
|
2024-10-21 17:26:35 +07:00
|
|
|
code String
|
|
|
|
|
name String
|
|
|
|
|
detail String
|
|
|
|
|
attributes Json?
|
|
|
|
|
installments Int @default(0)
|
2024-07-03 11:32:32 +07:00
|
|
|
|
|
|
|
|
status Status @default(CREATED)
|
|
|
|
|
statusOrder Int @default(0)
|
|
|
|
|
|
2024-10-10 12:03:40 +07:00
|
|
|
workflowTemplateId String?
|
|
|
|
|
workflowTemplate WorkflowTemplate? @relation(fields: [workflowTemplateId], references: [id])
|
|
|
|
|
|
2024-09-10 15:51:22 +07:00
|
|
|
shared Boolean @default(false)
|
|
|
|
|
selectedImage String?
|
2024-09-10 13:33:44 +07:00
|
|
|
|
2024-10-01 15:36:45 +07:00
|
|
|
work Work[]
|
|
|
|
|
quotationProductServiceList QuotationProductServiceList[]
|
2024-07-03 11:32:32 +07:00
|
|
|
|
2024-09-10 14:36:26 +07:00
|
|
|
productGroup ProductGroup @relation(fields: [productGroupId], references: [id], onDelete: Cascade)
|
|
|
|
|
productGroupId String
|
2024-07-03 11:32:32 +07:00
|
|
|
|
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
|
createdBy User? @relation(name: "ServiceCreatedByUser", fields: [createdByUserId], references: [id], onDelete: SetNull)
|
|
|
|
|
createdByUserId String?
|
|
|
|
|
updatedAt DateTime @updatedAt
|
|
|
|
|
updatedBy User? @relation(name: "ServiceUpdatedByUser", fields: [updatedByUserId], references: [id], onDelete: SetNull)
|
|
|
|
|
updatedByUserId String?
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
model Work {
|
2024-08-27 14:28:14 +07:00
|
|
|
id String @id @default(cuid())
|
2024-07-03 11:32:32 +07:00
|
|
|
|
|
|
|
|
order Int
|
|
|
|
|
name String
|
|
|
|
|
attributes Json?
|
|
|
|
|
|
|
|
|
|
status Status @default(CREATED)
|
|
|
|
|
statusOrder Int @default(0)
|
|
|
|
|
|
|
|
|
|
service Service? @relation(fields: [serviceId], references: [id], onDelete: Cascade)
|
|
|
|
|
serviceId String?
|
|
|
|
|
|
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
|
createdBy User? @relation(name: "WorkCreatedByUser", fields: [createdByUserId], references: [id], onDelete: SetNull)
|
|
|
|
|
createdByUserId String?
|
|
|
|
|
updatedAt DateTime @updatedAt
|
|
|
|
|
updatedBy User? @relation(name: "WorkUpdatedByUser", fields: [updatedByUserId], references: [id], onDelete: SetNull)
|
|
|
|
|
updatedByUserId String?
|
|
|
|
|
|
2024-10-01 15:36:45 +07:00
|
|
|
productOnWork WorkProduct[]
|
|
|
|
|
quotationProductServiceList QuotationProductServiceList[]
|
2024-07-03 11:32:32 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
model WorkProduct {
|
2024-10-21 17:26:35 +07:00
|
|
|
order Int
|
|
|
|
|
work Work @relation(fields: [workId], references: [id], onDelete: Cascade)
|
|
|
|
|
workId String
|
|
|
|
|
product Product @relation(fields: [productId], references: [id], onDelete: Cascade)
|
|
|
|
|
productId String
|
|
|
|
|
installmentNo Int @default(0)
|
2024-10-25 16:26:12 +07:00
|
|
|
attributes Json?
|
2024-07-03 11:32:32 +07:00
|
|
|
|
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
|
createdBy User? @relation(name: "WorkProductCreatedByUser", fields: [createdByUserId], references: [id], onDelete: SetNull)
|
|
|
|
|
createdByUserId String?
|
|
|
|
|
updatedAt DateTime @updatedAt
|
|
|
|
|
updatedBy User? @relation(name: "WorkProductUpdatedByUser", fields: [updatedByUserId], references: [id], onDelete: SetNull)
|
|
|
|
|
updatedByUserId String?
|
|
|
|
|
|
|
|
|
|
@@id([workId, productId])
|
|
|
|
|
}
|
2024-07-18 17:23:41 +07:00
|
|
|
|
2024-10-04 09:22:52 +07:00
|
|
|
enum QuotationStatus {
|
2024-10-25 16:42:34 +07:00
|
|
|
Issued
|
2024-10-25 16:37:59 +07:00
|
|
|
Accepted
|
2024-10-04 15:17:24 +07:00
|
|
|
PaymentPending
|
2024-10-15 13:29:40 +07:00
|
|
|
PaymentInProcess // For Installments / Split Payment
|
2024-10-04 09:22:52 +07:00
|
|
|
PaymentSuccess
|
2024-10-04 13:29:38 +07:00
|
|
|
ProcessComplete
|
2024-10-15 13:29:40 +07:00
|
|
|
Canceled
|
2024-10-04 09:22:52 +07:00
|
|
|
}
|
|
|
|
|
|
2024-07-18 17:23:41 +07:00
|
|
|
enum PayCondition {
|
|
|
|
|
Full
|
|
|
|
|
Split
|
2024-10-29 10:05:25 +07:00
|
|
|
SplitCustom
|
2024-07-18 17:23:41 +07:00
|
|
|
BillFull
|
|
|
|
|
BillSplit
|
2024-10-29 10:05:25 +07:00
|
|
|
BillSplitCustom
|
2024-07-18 17:23:41 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
model Quotation {
|
2024-08-27 14:28:14 +07:00
|
|
|
id String @id @default(cuid())
|
2024-07-18 17:23:41 +07:00
|
|
|
|
2024-10-15 17:09:05 +07:00
|
|
|
registeredBranch Branch @relation(fields: [registeredBranchId], references: [id])
|
|
|
|
|
registeredBranchId String
|
|
|
|
|
|
2024-07-18 17:23:41 +07:00
|
|
|
customerBranchId String
|
|
|
|
|
customerBranch CustomerBranch @relation(fields: [customerBranchId], references: [id])
|
|
|
|
|
|
2024-07-19 10:49:38 +07:00
|
|
|
status Status @default(CREATED)
|
|
|
|
|
statusOrder Int @default(0)
|
|
|
|
|
|
2024-10-25 16:42:34 +07:00
|
|
|
quotationStatus QuotationStatus @default(Issued)
|
2024-10-04 09:22:52 +07:00
|
|
|
|
2024-10-18 11:03:29 +07:00
|
|
|
remark String?
|
|
|
|
|
|
2024-09-26 14:32:44 +07:00
|
|
|
code String
|
|
|
|
|
|
|
|
|
|
workName String
|
|
|
|
|
contactName String
|
|
|
|
|
contactTel String
|
|
|
|
|
documentReceivePoint String
|
|
|
|
|
dueDate DateTime @db.Date
|
|
|
|
|
|
2024-07-18 17:23:41 +07:00
|
|
|
date DateTime @default(now())
|
|
|
|
|
payCondition PayCondition
|
|
|
|
|
|
|
|
|
|
paySplitCount Int?
|
|
|
|
|
paySplit QuotationPaySplit[]
|
|
|
|
|
|
2024-08-21 13:05:02 +07:00
|
|
|
payBillDate DateTime? @db.Date
|
2024-07-18 17:23:41 +07:00
|
|
|
|
2024-10-04 09:22:52 +07:00
|
|
|
worker QuotationWorker[]
|
2024-07-18 17:23:41 +07:00
|
|
|
|
2024-10-18 14:48:50 +07:00
|
|
|
workerMax Int?
|
|
|
|
|
|
2024-07-18 17:23:41 +07:00
|
|
|
urgent Boolean @default(false)
|
|
|
|
|
|
2024-10-01 15:36:45 +07:00
|
|
|
productServiceList QuotationProductServiceList[]
|
|
|
|
|
|
2024-10-04 13:29:38 +07:00
|
|
|
agentPrice Boolean @default(false)
|
|
|
|
|
|
2024-07-18 17:23:41 +07:00
|
|
|
totalPrice Float
|
|
|
|
|
totalDiscount Float
|
2024-07-19 17:59:44 +07:00
|
|
|
vat Float
|
2024-10-17 13:04:42 +07:00
|
|
|
vatExcluded Float @default(0)
|
2024-10-04 13:29:38 +07:00
|
|
|
discount Float @default(0)
|
2024-07-19 17:59:44 +07:00
|
|
|
finalPrice Float
|
2024-07-18 17:23:41 +07:00
|
|
|
|
2024-10-09 15:04:59 +07:00
|
|
|
requestData RequestData[]
|
|
|
|
|
|
2024-09-30 09:48:35 +07:00
|
|
|
createdAt DateTime @default(now())
|
|
|
|
|
createdBy User? @relation(name: "QuotationCreatedByUser", fields: [createdByUserId], references: [id], onDelete: SetNull)
|
2024-07-18 17:23:41 +07:00
|
|
|
createdByUserId String?
|
2024-09-30 09:48:35 +07:00
|
|
|
updatedAt DateTime @updatedAt
|
|
|
|
|
updatedBy User? @relation(name: "QuotationUpdatedByUser", fields: [updatedByUserId], references: [id], onDelete: SetNull)
|
2024-07-18 17:23:41 +07:00
|
|
|
updatedByUserId String?
|
2024-10-15 13:29:40 +07:00
|
|
|
|
2024-10-25 13:58:29 +07:00
|
|
|
invoice Invoice[]
|
2024-10-15 13:29:40 +07:00
|
|
|
}
|
|
|
|
|
|
2024-07-18 17:23:41 +07:00
|
|
|
model QuotationPaySplit {
|
2024-08-27 14:28:14 +07:00
|
|
|
id String @id @default(cuid())
|
2024-07-18 17:23:41 +07:00
|
|
|
|
2024-10-30 17:32:46 +07:00
|
|
|
no Int
|
2024-10-31 09:43:50 +07:00
|
|
|
name String?
|
2024-10-30 17:32:46 +07:00
|
|
|
amount Float
|
2024-07-18 17:23:41 +07:00
|
|
|
|
2024-10-18 09:56:06 +07:00
|
|
|
quotation Quotation? @relation(fields: [quotationId], references: [id], onDelete: Cascade)
|
2024-07-18 17:23:41 +07:00
|
|
|
quotationId String?
|
2024-10-30 17:32:46 +07:00
|
|
|
|
|
|
|
|
invoice Invoice? @relation(fields: [invoiceId], references: [id])
|
|
|
|
|
invoiceId String?
|
2024-07-18 17:23:41 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
model QuotationWorker {
|
2024-08-27 14:28:14 +07:00
|
|
|
id String @id @default(cuid())
|
2024-07-18 17:23:41 +07:00
|
|
|
|
|
|
|
|
no Int
|
|
|
|
|
employee Employee @relation(fields: [employeeId], references: [id])
|
|
|
|
|
employeeId String
|
2024-10-01 15:41:23 +07:00
|
|
|
quotation Quotation @relation(fields: [quotationId], references: [id], onDelete: Cascade)
|
2024-07-18 17:23:41 +07:00
|
|
|
quotationId String
|
|
|
|
|
}
|
|
|
|
|
|
2024-10-01 15:36:45 +07:00
|
|
|
model QuotationProductServiceList {
|
|
|
|
|
id String @id @default(cuid())
|
2024-07-18 17:23:41 +07:00
|
|
|
quotationId String
|
2024-10-01 15:41:23 +07:00
|
|
|
quotation Quotation @relation(fields: [quotationId], references: [id], onDelete: Cascade)
|
2024-07-18 17:23:41 +07:00
|
|
|
|
2024-10-01 15:36:45 +07:00
|
|
|
order Int
|
2024-07-18 17:23:41 +07:00
|
|
|
|
2024-07-23 10:28:47 +07:00
|
|
|
vat Float
|
2024-07-18 17:23:41 +07:00
|
|
|
amount Int
|
|
|
|
|
discount Float
|
|
|
|
|
pricePerUnit Float
|
|
|
|
|
|
2024-10-25 09:01:32 +07:00
|
|
|
installmentNo Int?
|
|
|
|
|
|
2024-10-01 15:36:45 +07:00
|
|
|
productId String
|
|
|
|
|
product Product @relation(fields: [productId], references: [id])
|
|
|
|
|
|
|
|
|
|
workId String?
|
|
|
|
|
work Work? @relation(fields: [workId], references: [id])
|
|
|
|
|
|
|
|
|
|
serviceId String?
|
|
|
|
|
service Service? @relation(fields: [serviceId], references: [id])
|
2024-10-04 16:39:37 +07:00
|
|
|
|
2024-10-09 15:04:59 +07:00
|
|
|
worker QuotationProductServiceWorker[]
|
2024-10-10 11:56:52 +07:00
|
|
|
requestWork RequestWork[]
|
2024-10-04 16:39:37 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
model QuotationProductServiceWorker {
|
|
|
|
|
productService QuotationProductServiceList @relation(fields: [productServiceId], references: [id], onDelete: Cascade)
|
|
|
|
|
productServiceId String
|
|
|
|
|
|
|
|
|
|
employee Employee @relation(fields: [employeeId], references: [id], onDelete: Cascade)
|
|
|
|
|
employeeId String
|
|
|
|
|
|
|
|
|
|
@@id([productServiceId, employeeId])
|
2024-07-18 17:23:41 +07:00
|
|
|
}
|
2024-10-09 15:04:59 +07:00
|
|
|
|
2024-10-25 13:58:29 +07:00
|
|
|
model Invoice {
|
|
|
|
|
id String @id @default(cuid())
|
|
|
|
|
|
2024-11-01 10:27:26 +07:00
|
|
|
quotation Quotation @relation(fields: [quotationId], references: [id], onDelete: Cascade)
|
2024-10-25 13:58:29 +07:00
|
|
|
quotationId String
|
|
|
|
|
|
2024-10-30 17:32:46 +07:00
|
|
|
installments QuotationPaySplit[]
|
2024-10-25 13:58:29 +07:00
|
|
|
|
|
|
|
|
amount Float?
|
|
|
|
|
|
|
|
|
|
payment Payment?
|
|
|
|
|
|
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
|
createdBy User @relation(fields: [createdByUserId], references: [id])
|
|
|
|
|
createdByUserId String
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
enum PaymentStatus {
|
|
|
|
|
PaymentWait
|
|
|
|
|
PaymentInProcess
|
|
|
|
|
PaymentRetry
|
|
|
|
|
PaymentSuccess
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
model Payment {
|
|
|
|
|
id String @id @default(cuid())
|
|
|
|
|
|
2024-11-01 10:27:26 +07:00
|
|
|
invoice Invoice @relation(fields: [invoiceId], references: [id], onDelete: Cascade)
|
2024-10-25 13:58:29 +07:00
|
|
|
invoiceId String @unique
|
|
|
|
|
|
|
|
|
|
paymentStatus PaymentStatus
|
|
|
|
|
|
|
|
|
|
amount Float
|
|
|
|
|
date DateTime?
|
|
|
|
|
|
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
|
createdBy User? @relation(fields: [createdByUserId], references: [id])
|
|
|
|
|
createdByUserId String?
|
|
|
|
|
}
|
|
|
|
|
|
2024-10-09 15:04:59 +07:00
|
|
|
model RequestData {
|
|
|
|
|
id String @id @default(cuid())
|
|
|
|
|
|
2024-10-18 09:56:06 +07:00
|
|
|
employee Employee @relation(fields: [employeeId], references: [id], onDelete: Cascade)
|
2024-10-09 15:04:59 +07:00
|
|
|
employeeId String
|
|
|
|
|
|
2024-10-18 09:56:06 +07:00
|
|
|
quotation Quotation @relation(fields: [quotationId], references: [id], onDelete: Cascade)
|
2024-10-09 15:04:59 +07:00
|
|
|
quotationId String
|
|
|
|
|
|
2024-10-10 16:43:09 +07:00
|
|
|
flow Json?
|
|
|
|
|
|
2024-10-09 15:04:59 +07:00
|
|
|
requestWork RequestWork[]
|
|
|
|
|
}
|
|
|
|
|
|
2024-10-10 13:21:11 +07:00
|
|
|
enum RequestWorkStatus {
|
|
|
|
|
Pending
|
|
|
|
|
InProgress
|
|
|
|
|
Completed
|
|
|
|
|
}
|
|
|
|
|
|
2024-10-09 15:04:59 +07:00
|
|
|
model RequestWork {
|
|
|
|
|
id String @id @default(cuid())
|
|
|
|
|
|
|
|
|
|
request RequestData @relation(fields: [requestDataId], references: [id])
|
|
|
|
|
requestDataId String
|
|
|
|
|
|
|
|
|
|
productService QuotationProductServiceList @relation(fields: [productServiceId], references: [id])
|
|
|
|
|
productServiceId String
|
2024-10-10 13:21:11 +07:00
|
|
|
|
|
|
|
|
workStatus RequestWorkStatus @default(Pending)
|
|
|
|
|
|
|
|
|
|
processByUser User? @relation(fields: [processByUserId], references: [id])
|
|
|
|
|
processByUserId String?
|
2024-10-21 17:26:35 +07:00
|
|
|
|
|
|
|
|
attributes Json?
|
2024-10-09 15:04:59 +07:00
|
|
|
}
|