initial commit
This commit is contained in:
commit
c5e3107e03
26 changed files with 3828 additions and 0 deletions
3
prisma/migrations/migration_lock.toml
Normal file
3
prisma/migrations/migration_lock.toml
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
# Please do not edit this file manually
|
||||
# It should be added in your version-control system (i.e. Git)
|
||||
provider = "postgresql"
|
||||
469
prisma/schema.prisma
Normal file
469
prisma/schema.prisma
Normal file
|
|
@ -0,0 +1,469 @@
|
|||
generator client {
|
||||
provider = "prisma-client-js"
|
||||
}
|
||||
|
||||
datasource db {
|
||||
provider = "postgresql"
|
||||
url = env("DATABASE_URL")
|
||||
}
|
||||
|
||||
model Province {
|
||||
id String @id @default(uuid())
|
||||
nameTH String
|
||||
nameEN String
|
||||
status 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 {
|
||||
id String @id @default(uuid())
|
||||
nameTH String
|
||||
nameEN String
|
||||
status 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 {
|
||||
id String @id @default(uuid())
|
||||
nameTH String
|
||||
nameEN String
|
||||
zipCode String
|
||||
status 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[]
|
||||
}
|
||||
|
||||
model Branch {
|
||||
id String @id @default(uuid())
|
||||
code String
|
||||
taxNo String
|
||||
nameTH String
|
||||
nameEN String
|
||||
addressTH String
|
||||
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
|
||||
|
||||
latitude String
|
||||
longitude String
|
||||
|
||||
isHeadOffice Boolean @default(false)
|
||||
|
||||
headOffice Branch? @relation(name: "HeadOfficeRelation", fields: [headOfficeId], references: [id])
|
||||
headOfficeId String?
|
||||
|
||||
status String?
|
||||
|
||||
createdBy String?
|
||||
createdAt DateTime @default(now())
|
||||
updateBy String?
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
branch Branch[] @relation(name: "HeadOfficeRelation")
|
||||
contact BranchContact[]
|
||||
user BranchUser[]
|
||||
}
|
||||
|
||||
model BranchContact {
|
||||
id String @id @default(uuid())
|
||||
telephoneNo String
|
||||
lineId String
|
||||
qrCodeImageUrl String?
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
model User {
|
||||
id String @id @default(uuid())
|
||||
|
||||
code String
|
||||
fullNameTH String
|
||||
fullNameEN String
|
||||
|
||||
addressTH String
|
||||
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
|
||||
|
||||
registrationNo String
|
||||
|
||||
startDate DateTime
|
||||
retireDate DateTime
|
||||
|
||||
profileImageUrl String?
|
||||
|
||||
userType String
|
||||
userRole String
|
||||
|
||||
discountCondition String
|
||||
|
||||
licenseNo String
|
||||
licenseIssueDate DateTime
|
||||
licenseExpireDate DateTime
|
||||
|
||||
sourceNationality String
|
||||
importNationality String
|
||||
|
||||
trainingPlace String
|
||||
|
||||
status String?
|
||||
|
||||
createdBy String?
|
||||
createdAt DateTime @default(now())
|
||||
updateBy String?
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
branch BranchUser[]
|
||||
}
|
||||
|
||||
model Customer {
|
||||
id String @id @default(uuid())
|
||||
code String
|
||||
customerType String
|
||||
customerNameTH String
|
||||
customerNameEN String
|
||||
imageUrl String
|
||||
|
||||
status String?
|
||||
|
||||
createdBy String?
|
||||
createdAt DateTime @default(now())
|
||||
updateBy String?
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
branch CustomerBranch[]
|
||||
}
|
||||
|
||||
model CustomerBranch {
|
||||
id String @id @default(uuid())
|
||||
branchNo String
|
||||
legalPersonNo String
|
||||
|
||||
nameTH String
|
||||
nameEN String
|
||||
|
||||
customer Customer @relation(fields: [customerId], references: [id], onDelete: Cascade)
|
||||
customerId String
|
||||
|
||||
taxNo String
|
||||
registerName String
|
||||
registerDate DateTime
|
||||
authorizedCapital String
|
||||
|
||||
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
|
||||
|
||||
latitude String
|
||||
longitude String
|
||||
|
||||
createdBy String?
|
||||
createdAt DateTime @default(now())
|
||||
updateBy String?
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
employee Employee[]
|
||||
}
|
||||
|
||||
model Employee {
|
||||
id String @id @default(uuid())
|
||||
|
||||
code String
|
||||
fullNameTH String
|
||||
fullNameEN String
|
||||
dateOfBirth DateTime
|
||||
gender String
|
||||
nationality String
|
||||
|
||||
addressTH String
|
||||
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
|
||||
|
||||
arrivalBarricade String
|
||||
arrivalCardNo String
|
||||
profileImageUrl String
|
||||
|
||||
customerBranch CustomerBranch? @relation(fields: [customerBranchId], references: [id], onDelete: SetNull)
|
||||
customerBranchId String?
|
||||
|
||||
status String?
|
||||
|
||||
createdBy String?
|
||||
createdAt DateTime @default(now())
|
||||
updateBy String?
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
employeeCheckup EmployeeCheckup[]
|
||||
employeeWork EmployeeWork[]
|
||||
EmployeeOtherInfo EmployeeOtherInfo[]
|
||||
}
|
||||
|
||||
model EmployeeCheckup {
|
||||
id String @id @default(uuid())
|
||||
|
||||
employee Employee @relation(fields: [employeeId], references: [id], onDelete: Cascade)
|
||||
employeeId String
|
||||
|
||||
checkupResult String
|
||||
checkupType String
|
||||
|
||||
province Province? @relation(fields: [provinceId], references: [id], onDelete: SetNull)
|
||||
provinceId String?
|
||||
|
||||
hospitalName String
|
||||
remark String
|
||||
medicalBenefitScheme String
|
||||
insuranceCompany String
|
||||
coverageStartDate DateTime
|
||||
coverageExpireDate DateTime
|
||||
|
||||
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
|
||||
|
||||
ownerName String
|
||||
positionName String
|
||||
jobType String
|
||||
workplace String
|
||||
workPermitNo String
|
||||
workPermitIssuDate DateTime
|
||||
workPermitExpireDate DateTime
|
||||
workEndDate DateTime
|
||||
|
||||
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
|
||||
|
||||
citizenId String
|
||||
fatherFullName String
|
||||
motherFullName String
|
||||
birthPlace String
|
||||
|
||||
createdBy String?
|
||||
createdAt DateTime @default(now())
|
||||
updateBy String?
|
||||
updatedAt DateTime @updatedAt
|
||||
}
|
||||
|
||||
model Service {
|
||||
id String @id @default(uuid())
|
||||
|
||||
code String
|
||||
name String
|
||||
detail String
|
||||
imageUrl String
|
||||
status String?
|
||||
|
||||
createdBy String?
|
||||
createdAt DateTime @default(now())
|
||||
updateBy String?
|
||||
updatedAt DateTime @updatedAt
|
||||
work Work[]
|
||||
}
|
||||
|
||||
model Work {
|
||||
id String @id @default(uuid())
|
||||
|
||||
order String
|
||||
name String
|
||||
|
||||
service Service @relation(fields: [serviceId], references: [id], onDelete: Cascade)
|
||||
serviceId String
|
||||
|
||||
createdBy String?
|
||||
createdAt DateTime @default(now())
|
||||
updateBy String?
|
||||
updatedAt DateTime @updatedAt
|
||||
WorkProduct WorkProduct[]
|
||||
}
|
||||
|
||||
model WorkProduct {
|
||||
id String @id @default(uuid())
|
||||
|
||||
work Work @relation(fields: [workId], references: [id], onDelete: Cascade)
|
||||
workId String
|
||||
|
||||
createdBy String?
|
||||
createdAt DateTime @default(now())
|
||||
updateBy String?
|
||||
updatedAt DateTime @updatedAt
|
||||
}
|
||||
|
||||
model ProductGroup {
|
||||
id String @id @default(uuid())
|
||||
|
||||
code String
|
||||
name String
|
||||
detail String
|
||||
remark String
|
||||
status String?
|
||||
|
||||
createdBy String?
|
||||
createdAt DateTime @default(now())
|
||||
updateBy String?
|
||||
updatedAt DateTime @updatedAt
|
||||
Product Product[]
|
||||
}
|
||||
|
||||
model ProductType {
|
||||
id String @id @default(uuid())
|
||||
|
||||
code String
|
||||
name String
|
||||
detail String
|
||||
remark String
|
||||
status String?
|
||||
|
||||
createdBy String?
|
||||
createdAt DateTime @default(now())
|
||||
updateBy String?
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
product Product[]
|
||||
}
|
||||
|
||||
model Product {
|
||||
id String @id @default(uuid())
|
||||
|
||||
code String
|
||||
name String
|
||||
detail String
|
||||
process String
|
||||
price Int
|
||||
agentPrice Int
|
||||
serviceCharge Int
|
||||
imageUrl String
|
||||
status String?
|
||||
|
||||
productType ProductType? @relation(fields: [productTypeId], references: [id], onDelete: SetNull)
|
||||
productTypeId String?
|
||||
|
||||
productGroup ProductGroup? @relation(fields: [productGroupId], references: [id], onDelete: SetNull)
|
||||
productGroupId String?
|
||||
|
||||
createdBy String?
|
||||
createdAt DateTime @default(now())
|
||||
updateBy String?
|
||||
updatedAt DateTime @updatedAt
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue