refactor: employee

This commit is contained in:
Methapon Metanipat 2024-09-13 17:39:12 +07:00
parent 77739da154
commit c51a403f2a
7 changed files with 637 additions and 277 deletions

View file

@ -552,23 +552,8 @@ model Employee {
subDistrict SubDistrict? @relation(fields: [subDistrictId], references: [id], onDelete: SetNull)
subDistrictId String?
passportType String
passportNumber String
passportIssueDate DateTime @db.Date
passportExpiryDate DateTime @db.Date
passportIssuingCountry String
passportIssuingPlace String
previousPassportReference String?
visaType String?
visaNumber String?
visaIssueDate DateTime? @db.Date
visaExpiryDate DateTime? @db.Date
visaIssuingPlace String?
visaStayUntilDate DateTime? @db.Date
tm6Number String?
entryDate DateTime? @db.Date
workerStatus String?
workerType String?
workerStatus String?
customerBranch CustomerBranch @relation(fields: [customerBranchId], references: [id], onDelete: Cascade)
customerBranchId String
@ -584,9 +569,12 @@ model Employee {
updatedBy User? @relation(name: "EmployeeUpdatedByUser", fields: [updatedByUserId], references: [id], onDelete: SetNull)
updatedByUserId String?
employeeCheckup EmployeeCheckup[]
employeeWork EmployeeWork[]
employeeOtherInfo EmployeeOtherInfo?
employeePassport EmployeePassport[]
employeeVisa EmployeeVisa[]
employeeInCountryNotice EmployeeInCountryNotice[]
employeeCheckup EmployeeCheckup[]
employeeWork EmployeeWork[]
employeeOtherInfo EmployeeOtherInfo?
editHistory EmployeeHistory[]
quotationWorker QuotationWorker[]
@ -606,6 +594,63 @@ model EmployeeHistory {
master Employee @relation(fields: [masterId], references: [id], onDelete: Cascade)
}
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?
employee Employee @relation(fields: [employeeId], references: [id])
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?
employee Employee @relation(fields: [employeeId], references: [id])
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
employee Employee @relation(fields: [employeeId], references: [id])
employeeId String
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
model EmployeeCheckup {
id String @id @default(cuid())