2024-04-01 13:28:43 +07:00
|
|
|
generator client {
|
|
|
|
|
provider = "prisma-client-js"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
datasource db {
|
|
|
|
|
provider = "postgresql"
|
|
|
|
|
url = env("DATABASE_URL")
|
|
|
|
|
}
|
|
|
|
|
|
2024-04-17 13:42:01 +07:00
|
|
|
model Menu {
|
|
|
|
|
id String @id @default(uuid())
|
|
|
|
|
|
|
|
|
|
caption String
|
|
|
|
|
captionEN String
|
|
|
|
|
menuType String
|
|
|
|
|
url String
|
|
|
|
|
|
|
|
|
|
createdBy String?
|
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
|
updateBy String?
|
|
|
|
|
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 {
|
|
|
|
|
id String @id @default(uuid())
|
|
|
|
|
|
|
|
|
|
userRole String
|
|
|
|
|
permission String
|
|
|
|
|
|
|
|
|
|
menu Menu @relation(fields: [menuId], references: [id])
|
|
|
|
|
menuId String
|
|
|
|
|
|
|
|
|
|
createdBy String?
|
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
|
updateBy String?
|
|
|
|
|
updatedAt DateTime @updatedAt
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
model UserMenuPermission {
|
|
|
|
|
id String @id @default(uuid())
|
|
|
|
|
|
|
|
|
|
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())
|
|
|
|
|
updateBy String?
|
|
|
|
|
updatedAt DateTime @updatedAt
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
model MenuComponent {
|
|
|
|
|
id String @id @default(uuid())
|
|
|
|
|
|
|
|
|
|
componentId String
|
|
|
|
|
componentTag String
|
|
|
|
|
|
|
|
|
|
menu Menu @relation(fields: [menuId], references: [id])
|
|
|
|
|
menuId String
|
|
|
|
|
|
|
|
|
|
createdBy String?
|
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
|
updateBy String?
|
|
|
|
|
updatedAt DateTime @updatedAt
|
|
|
|
|
roleMenuComponentPermission RoleMenuComponentPermission[]
|
|
|
|
|
userMennuComponentPermission UserMenuComponentPermission[]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
model RoleMenuComponentPermission {
|
|
|
|
|
id String @id @default(uuid())
|
|
|
|
|
|
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())
|
|
|
|
|
updateBy String?
|
|
|
|
|
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 {
|
|
|
|
|
id String @id @default(uuid())
|
|
|
|
|
|
|
|
|
|
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())
|
|
|
|
|
updateBy String?
|
|
|
|
|
updatedAt DateTime @updatedAt
|
|
|
|
|
}
|
|
|
|
|
|
2024-04-01 13:28:43 +07:00
|
|
|
model Province {
|
2024-04-01 19:47:56 +07:00
|
|
|
id String @id @default(uuid())
|
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())
|
|
|
|
|
updateBy String?
|
|
|
|
|
updatedAt DateTime @updatedAt
|
|
|
|
|
|
|
|
|
|
district District[]
|
|
|
|
|
branch Branch[]
|
|
|
|
|
user User[]
|
|
|
|
|
customerBranch CustomerBranch[]
|
|
|
|
|
employee Employee[]
|
|
|
|
|
employeeCheckup EmployeeCheckup[]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
model District {
|
2024-04-01 19:47:56 +07:00
|
|
|
id String @id @default(uuid())
|
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())
|
|
|
|
|
updateBy String?
|
|
|
|
|
updatedAt DateTime @updatedAt
|
|
|
|
|
|
|
|
|
|
subDistrict SubDistrict[]
|
|
|
|
|
branch Branch[]
|
|
|
|
|
user User[]
|
|
|
|
|
customerBranch CustomerBranch[]
|
|
|
|
|
employee Employee[]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
model SubDistrict {
|
2024-04-01 19:47:56 +07:00
|
|
|
id String @id @default(uuid())
|
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())
|
|
|
|
|
updateBy String?
|
|
|
|
|
updatedAt DateTime @updatedAt
|
|
|
|
|
|
|
|
|
|
branch Branch[]
|
|
|
|
|
user User[]
|
|
|
|
|
customerBranch CustomerBranch[]
|
|
|
|
|
employee Employee[]
|
|
|
|
|
}
|
|
|
|
|
|
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-04-18 13:09:14 +07:00
|
|
|
id String @id @default(uuid())
|
|
|
|
|
code String
|
|
|
|
|
taxNo String
|
|
|
|
|
name String
|
|
|
|
|
nameEN String
|
|
|
|
|
address String
|
|
|
|
|
addressEN String
|
2024-04-18 13:21:37 +07:00
|
|
|
telephoneNo 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?
|
|
|
|
|
|
|
|
|
|
zipCode String
|
|
|
|
|
|
|
|
|
|
email String
|
2024-04-17 13:42:01 +07:00
|
|
|
contactName String?
|
2024-04-17 11:22:12 +07:00
|
|
|
lineId 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-04-02 10:48:35 +07:00
|
|
|
status Status @default(CREATED)
|
2024-04-01 13:28:43 +07:00
|
|
|
|
|
|
|
|
createdBy String?
|
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
|
updateBy String?
|
|
|
|
|
updatedAt DateTime @updatedAt
|
|
|
|
|
|
|
|
|
|
branch Branch[] @relation(name: "HeadOfficeRelation")
|
|
|
|
|
contact BranchContact[]
|
|
|
|
|
user BranchUser[]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
model BranchContact {
|
2024-04-02 10:48:35 +07:00
|
|
|
id String @id @default(uuid())
|
|
|
|
|
telephoneNo String
|
2024-04-01 13:28:43 +07:00
|
|
|
|
|
|
|
|
branch Branch @relation(fields: [branchId], references: [id], onDelete: Cascade)
|
|
|
|
|
branchId String
|
|
|
|
|
|
|
|
|
|
createdBy String?
|
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
|
updateBy String?
|
|
|
|
|
updatedAt DateTime @updatedAt
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
model BranchUser {
|
|
|
|
|
id String @id @default(uuid())
|
|
|
|
|
|
|
|
|
|
branch Branch @relation(fields: [branchId], references: [id], onDelete: Cascade)
|
|
|
|
|
branchId String
|
|
|
|
|
|
|
|
|
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
|
|
|
userId String
|
|
|
|
|
|
|
|
|
|
createdBy String?
|
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
|
updateBy String?
|
|
|
|
|
updatedAt DateTime @updatedAt
|
|
|
|
|
}
|
|
|
|
|
|
2024-04-09 13:05:49 +07:00
|
|
|
enum UserType {
|
|
|
|
|
USER
|
|
|
|
|
MESSENGER
|
|
|
|
|
DELEGATE
|
|
|
|
|
AGENCY
|
|
|
|
|
}
|
|
|
|
|
|
2024-04-01 13:28:43 +07:00
|
|
|
model User {
|
|
|
|
|
id String @id @default(uuid())
|
|
|
|
|
|
2024-04-09 13:05:49 +07:00
|
|
|
code String?
|
2024-04-04 13:42:46 +07:00
|
|
|
firstName String
|
2024-04-01 19:47:56 +07:00
|
|
|
firstNameEN String
|
2024-04-04 13:42:46 +07:00
|
|
|
lastName String
|
2024-04-01 19:47:56 +07:00
|
|
|
lastNameEN String
|
2024-04-17 16:48:41 +07:00
|
|
|
username String
|
2024-04-05 16:46:47 +07:00
|
|
|
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
|
|
|
|
|
|
|
|
|
|
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?
|
|
|
|
|
|
|
|
|
|
zipCode String
|
|
|
|
|
|
|
|
|
|
email String
|
|
|
|
|
telephoneNo String
|
|
|
|
|
|
2024-04-04 16:08:22 +07:00
|
|
|
registrationNo String?
|
2024-04-01 13:28:43 +07:00
|
|
|
|
2024-04-04 16:08:22 +07:00
|
|
|
startDate DateTime?
|
|
|
|
|
retireDate DateTime?
|
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-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?
|
|
|
|
|
licenseIssueDate DateTime?
|
|
|
|
|
licenseExpireDate DateTime?
|
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?
|
|
|
|
|
responsibleArea String?
|
|
|
|
|
|
2024-04-10 12:32:40 +07:00
|
|
|
birthDate DateTime?
|
2024-04-01 13:28:43 +07:00
|
|
|
|
2024-04-02 10:48:35 +07:00
|
|
|
status Status @default(CREATED)
|
2024-04-01 13:28:43 +07:00
|
|
|
|
|
|
|
|
createdBy String?
|
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
|
updateBy String?
|
|
|
|
|
updatedAt DateTime @updatedAt
|
|
|
|
|
|
2024-04-17 13:42:01 +07:00
|
|
|
branch BranchUser[]
|
|
|
|
|
userMenuPermission UserMenuPermission[]
|
|
|
|
|
userMenuComponentPermission UserMenuComponentPermission[]
|
2024-04-01 13:28:43 +07:00
|
|
|
}
|
|
|
|
|
|
2024-04-09 13:56:15 +07:00
|
|
|
enum CustomerType {
|
|
|
|
|
CORP
|
|
|
|
|
PERS
|
|
|
|
|
}
|
|
|
|
|
|
2024-04-01 13:28:43 +07:00
|
|
|
model Customer {
|
2024-04-09 13:56:15 +07:00
|
|
|
id String @id @default(uuid())
|
2024-04-09 13:05:49 +07:00
|
|
|
code String
|
2024-04-09 13:56:15 +07:00
|
|
|
customerType CustomerType
|
2024-04-04 15:27:57 +07:00
|
|
|
customerName String
|
2024-04-01 13:28:43 +07:00
|
|
|
customerNameEN String
|
2024-04-23 18:09:08 +07:00
|
|
|
taxNo String?
|
2024-04-01 13:28:43 +07:00
|
|
|
|
2024-04-02 11:54:11 +07:00
|
|
|
status Status @default(CREATED)
|
2024-04-01 13:28:43 +07:00
|
|
|
|
|
|
|
|
createdBy String?
|
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
|
updateBy String?
|
|
|
|
|
updatedAt DateTime @updatedAt
|
|
|
|
|
|
|
|
|
|
branch CustomerBranch[]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
model CustomerBranch {
|
|
|
|
|
id String @id @default(uuid())
|
2024-06-07 13:54:02 +07:00
|
|
|
branchNo Int
|
2024-06-11 15:12:09 +07:00
|
|
|
code String
|
2024-04-01 13:28:43 +07:00
|
|
|
legalPersonNo String
|
|
|
|
|
|
2024-04-04 13:42:46 +07:00
|
|
|
name String
|
2024-04-01 13:28:43 +07:00
|
|
|
nameEN String
|
|
|
|
|
|
|
|
|
|
customer Customer @relation(fields: [customerId], references: [id], onDelete: Cascade)
|
|
|
|
|
customerId String
|
|
|
|
|
|
2024-04-23 18:09:08 +07:00
|
|
|
taxNo String?
|
2024-04-01 13:28:43 +07:00
|
|
|
registerName String
|
|
|
|
|
registerDate DateTime
|
|
|
|
|
authorizedCapital String
|
|
|
|
|
|
2024-04-04 17:42:52 +07:00
|
|
|
address String
|
2024-04-01 13:28:43 +07:00
|
|
|
addressEN 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?
|
|
|
|
|
|
|
|
|
|
zipCode String
|
|
|
|
|
|
|
|
|
|
email String
|
|
|
|
|
telephoneNo String
|
|
|
|
|
|
2024-04-23 18:09:08 +07:00
|
|
|
employmentOffice String
|
|
|
|
|
bussinessType String
|
2024-04-24 10:01:24 +07:00
|
|
|
bussinessTypeEN String
|
2024-04-23 18:09:08 +07:00
|
|
|
jobPosition String
|
2024-04-24 10:01:24 +07:00
|
|
|
jobPositionEN String
|
2024-04-23 18:09:08 +07:00
|
|
|
jobDescription String
|
|
|
|
|
saleEmployee String
|
2024-06-07 13:54:02 +07:00
|
|
|
payDate DateTime
|
2024-06-07 14:02:31 +07:00
|
|
|
wageRate Int
|
2024-04-01 13:28:43 +07:00
|
|
|
|
2024-04-04 17:42:52 +07:00
|
|
|
status Status @default(CREATED)
|
|
|
|
|
|
2024-04-01 13:28:43 +07:00
|
|
|
createdBy String?
|
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
|
updateBy String?
|
|
|
|
|
updatedAt DateTime @updatedAt
|
|
|
|
|
|
|
|
|
|
employee Employee[]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
model Employee {
|
|
|
|
|
id String @id @default(uuid())
|
|
|
|
|
|
|
|
|
|
code String
|
2024-04-04 17:42:52 +07:00
|
|
|
nrcNo String
|
|
|
|
|
firstName String
|
|
|
|
|
firstNameEN String
|
|
|
|
|
lastName String
|
|
|
|
|
lastNameEN String
|
|
|
|
|
|
2024-04-01 13:28:43 +07:00
|
|
|
dateOfBirth DateTime
|
|
|
|
|
gender String
|
|
|
|
|
nationality String
|
|
|
|
|
|
2024-06-12 17:01:42 +07:00
|
|
|
address String?
|
|
|
|
|
addressEN 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?
|
|
|
|
|
|
|
|
|
|
zipCode String
|
|
|
|
|
|
2024-06-10 16:50:17 +07:00
|
|
|
passportType String
|
|
|
|
|
passportNumber String
|
|
|
|
|
passportIssueDate DateTime
|
|
|
|
|
passportExpiryDate DateTime
|
|
|
|
|
passportIssuingCountry String
|
|
|
|
|
passportIssuingPlace String
|
|
|
|
|
previousPassportReference String?
|
|
|
|
|
|
2024-06-12 17:01:42 +07:00
|
|
|
visaType String?
|
|
|
|
|
visaNumber String?
|
|
|
|
|
visaIssueDate DateTime?
|
|
|
|
|
visaExpiryDate DateTime?
|
|
|
|
|
visaIssuingPlace String?
|
|
|
|
|
visaStayUntilDate DateTime?
|
|
|
|
|
tm6Number String?
|
|
|
|
|
entryDate DateTime?
|
|
|
|
|
workerStatus String?
|
2024-04-01 13:28:43 +07:00
|
|
|
|
|
|
|
|
customerBranch CustomerBranch? @relation(fields: [customerBranchId], references: [id], onDelete: SetNull)
|
|
|
|
|
customerBranchId String?
|
|
|
|
|
|
2024-04-02 11:54:11 +07:00
|
|
|
status Status @default(CREATED)
|
2024-04-01 13:28:43 +07:00
|
|
|
|
|
|
|
|
createdBy String?
|
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
|
updateBy String?
|
|
|
|
|
updatedAt DateTime @updatedAt
|
|
|
|
|
|
|
|
|
|
employeeCheckup EmployeeCheckup[]
|
|
|
|
|
employeeWork EmployeeWork[]
|
2024-04-04 17:42:52 +07:00
|
|
|
employeeOtherInfo EmployeeOtherInfo[]
|
2024-04-01 13:28:43 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
model EmployeeCheckup {
|
|
|
|
|
id String @id @default(uuid())
|
|
|
|
|
|
|
|
|
|
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?
|
|
|
|
|
coverageStartDate DateTime?
|
|
|
|
|
coverageExpireDate DateTime?
|
2024-04-01 13:28:43 +07:00
|
|
|
|
|
|
|
|
createdBy String?
|
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
|
updateBy String?
|
|
|
|
|
updatedAt DateTime @updatedAt
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
model EmployeeWork {
|
|
|
|
|
id String @id @default(uuid())
|
|
|
|
|
|
|
|
|
|
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?
|
|
|
|
|
workPermitIssuDate DateTime?
|
|
|
|
|
workPermitExpireDate DateTime?
|
|
|
|
|
workEndDate DateTime?
|
2024-06-10 16:06:33 +07:00
|
|
|
remark String?
|
2024-04-01 13:28:43 +07:00
|
|
|
|
|
|
|
|
createdBy String?
|
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
|
updateBy String?
|
|
|
|
|
updatedAt DateTime @updatedAt
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
model EmployeeOtherInfo {
|
|
|
|
|
id String @id @default(uuid())
|
|
|
|
|
|
|
|
|
|
employee Employee @relation(fields: [employeeId], references: [id], onDelete: Cascade)
|
|
|
|
|
employeeId String
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
createdBy String?
|
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
|
updateBy String?
|
|
|
|
|
updatedAt DateTime @updatedAt
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
model Service {
|
|
|
|
|
id String @id @default(uuid())
|
|
|
|
|
|
2024-04-02 11:54:11 +07:00
|
|
|
code String
|
|
|
|
|
name String
|
|
|
|
|
detail String
|
|
|
|
|
|
|
|
|
|
status Status @default(CREATED)
|
2024-04-01 13:28:43 +07:00
|
|
|
|
|
|
|
|
createdBy String?
|
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
|
updateBy String?
|
|
|
|
|
updatedAt DateTime @updatedAt
|
2024-06-12 14:09:08 +07:00
|
|
|
|
|
|
|
|
workOnService WorkService[]
|
2024-04-01 13:28:43 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
model Work {
|
|
|
|
|
id String @id @default(uuid())
|
|
|
|
|
|
2024-06-12 14:09:08 +07:00
|
|
|
name String
|
|
|
|
|
|
|
|
|
|
status Status @default(CREATED)
|
|
|
|
|
|
|
|
|
|
createdBy String?
|
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
|
updateBy String?
|
|
|
|
|
updatedAt DateTime @updatedAt
|
|
|
|
|
|
|
|
|
|
productOnWork WorkProduct[]
|
|
|
|
|
serviceOnWork WorkService[]
|
|
|
|
|
}
|
2024-04-01 13:28:43 +07:00
|
|
|
|
2024-06-12 14:09:08 +07:00
|
|
|
model WorkService {
|
|
|
|
|
order Int
|
|
|
|
|
work Work @relation(fields: [workId], references: [id], onDelete: Cascade)
|
|
|
|
|
workId String
|
2024-04-01 13:28:43 +07:00
|
|
|
service Service @relation(fields: [serviceId], references: [id], onDelete: Cascade)
|
|
|
|
|
serviceId String
|
|
|
|
|
|
2024-06-12 14:09:08 +07:00
|
|
|
createdBy String?
|
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
|
updateBy String?
|
|
|
|
|
updatedAt DateTime @updatedAt
|
|
|
|
|
productId String?
|
2024-04-02 11:54:11 +07:00
|
|
|
|
2024-06-12 14:09:08 +07:00
|
|
|
@@id([workId, serviceId])
|
2024-04-01 13:28:43 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
model WorkProduct {
|
2024-06-12 14:09:08 +07:00
|
|
|
order Int
|
2024-06-11 13:01:20 +07:00
|
|
|
work Work @relation(fields: [workId], references: [id], onDelete: Cascade)
|
|
|
|
|
workId String
|
|
|
|
|
product Product @relation(fields: [productId], references: [id], onDelete: Cascade)
|
|
|
|
|
productId String
|
2024-04-01 13:28:43 +07:00
|
|
|
|
|
|
|
|
createdBy String?
|
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
|
updateBy String?
|
|
|
|
|
updatedAt DateTime @updatedAt
|
2024-06-12 14:09:08 +07:00
|
|
|
|
|
|
|
|
@@id([workId, productId])
|
2024-04-01 13:28:43 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
model ProductGroup {
|
|
|
|
|
id String @id @default(uuid())
|
|
|
|
|
|
|
|
|
|
code String
|
|
|
|
|
name String
|
|
|
|
|
detail String
|
|
|
|
|
remark String
|
2024-04-02 11:54:11 +07:00
|
|
|
|
|
|
|
|
status Status @default(CREATED)
|
2024-04-01 13:28:43 +07:00
|
|
|
|
|
|
|
|
createdBy String?
|
2024-06-11 13:01:20 +07:00
|
|
|
createdAt DateTime @default(now())
|
2024-04-01 13:28:43 +07:00
|
|
|
updateBy String?
|
2024-06-11 13:01:20 +07:00
|
|
|
updatedAt DateTime @updatedAt
|
|
|
|
|
|
|
|
|
|
type ProductType[]
|
2024-04-01 13:28:43 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
model ProductType {
|
|
|
|
|
id String @id @default(uuid())
|
|
|
|
|
|
|
|
|
|
code String
|
|
|
|
|
name String
|
|
|
|
|
detail String
|
|
|
|
|
remark String
|
2024-04-02 11:54:11 +07:00
|
|
|
|
|
|
|
|
status Status @default(CREATED)
|
2024-04-01 13:28:43 +07:00
|
|
|
|
|
|
|
|
createdBy String?
|
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
|
updateBy String?
|
|
|
|
|
updatedAt DateTime @updatedAt
|
|
|
|
|
|
2024-06-11 13:01:20 +07:00
|
|
|
productGroup ProductGroup @relation(fields: [productGroupId], references: [id], onDelete: Cascade)
|
|
|
|
|
productGroupId String
|
|
|
|
|
|
2024-04-01 13:28:43 +07:00
|
|
|
product Product[]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
model Product {
|
|
|
|
|
id String @id @default(uuid())
|
|
|
|
|
|
|
|
|
|
code String
|
|
|
|
|
name String
|
|
|
|
|
detail String
|
|
|
|
|
process String
|
|
|
|
|
price Int
|
|
|
|
|
agentPrice Int
|
|
|
|
|
serviceCharge Int
|
2024-04-02 11:54:11 +07:00
|
|
|
|
|
|
|
|
status Status @default(CREATED)
|
2024-04-01 13:28:43 +07:00
|
|
|
|
|
|
|
|
productType ProductType? @relation(fields: [productTypeId], references: [id], onDelete: SetNull)
|
|
|
|
|
productTypeId String?
|
|
|
|
|
|
2024-06-11 13:01:20 +07:00
|
|
|
workProduct WorkProduct[]
|
2024-04-01 13:28:43 +07:00
|
|
|
|
2024-06-11 15:12:09 +07:00
|
|
|
attributes Json?
|
|
|
|
|
|
2024-04-01 13:28:43 +07:00
|
|
|
createdBy String?
|
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
|
updateBy String?
|
|
|
|
|
updatedAt DateTime @updatedAt
|
|
|
|
|
}
|