refactor: change relationship
This commit is contained in:
parent
0bd3ce55a7
commit
2ed718ccd0
3 changed files with 14 additions and 4 deletions
|
|
@ -0,0 +1,8 @@
|
||||||
|
/*
|
||||||
|
Warnings:
|
||||||
|
|
||||||
|
- A unique constraint covering the columns `[employeeId]` on the table `EmployeeOtherInfo` will be added. If there are existing duplicate values, this will fail.
|
||||||
|
|
||||||
|
*/
|
||||||
|
-- CreateIndex
|
||||||
|
CREATE UNIQUE INDEX "EmployeeOtherInfo_employeeId_key" ON "EmployeeOtherInfo"("employeeId");
|
||||||
|
|
@ -545,7 +545,7 @@ model Employee {
|
||||||
|
|
||||||
employeeCheckup EmployeeCheckup[]
|
employeeCheckup EmployeeCheckup[]
|
||||||
employeeWork EmployeeWork[]
|
employeeWork EmployeeWork[]
|
||||||
employeeOtherInfo EmployeeOtherInfo[]
|
employeeOtherInfo EmployeeOtherInfo?
|
||||||
|
|
||||||
editHistory EmployeeHistory[]
|
editHistory EmployeeHistory[]
|
||||||
quotationWorker QuotationWorker[]
|
quotationWorker QuotationWorker[]
|
||||||
|
|
@ -620,7 +620,7 @@ model EmployeeOtherInfo {
|
||||||
id String @id @default(uuid())
|
id String @id @default(uuid())
|
||||||
|
|
||||||
employee Employee @relation(fields: [employeeId], references: [id], onDelete: Cascade)
|
employee Employee @relation(fields: [employeeId], references: [id], onDelete: Cascade)
|
||||||
employeeId String
|
employeeId String @unique
|
||||||
|
|
||||||
citizenId String?
|
citizenId String?
|
||||||
fatherBirthPlace String?
|
fatherBirthPlace String?
|
||||||
|
|
|
||||||
|
|
@ -323,6 +323,9 @@ export class EmployeeController extends Controller {
|
||||||
async getById(@Path() employeeId: string) {
|
async getById(@Path() employeeId: string) {
|
||||||
const record = await prisma.employee.findFirst({
|
const record = await prisma.employee.findFirst({
|
||||||
include: {
|
include: {
|
||||||
|
employeeWork: true,
|
||||||
|
employeeCheckup: true,
|
||||||
|
employeeOtherInfo: true,
|
||||||
province: true,
|
province: true,
|
||||||
district: true,
|
district: true,
|
||||||
subDistrict: true,
|
subDistrict: true,
|
||||||
|
|
@ -669,8 +672,7 @@ export class EmployeeController extends Controller {
|
||||||
: undefined,
|
: undefined,
|
||||||
employeeOtherInfo: employeeOtherInfo
|
employeeOtherInfo: employeeOtherInfo
|
||||||
? {
|
? {
|
||||||
deleteMany: {},
|
update: employeeOtherInfo,
|
||||||
create: employeeOtherInfo,
|
|
||||||
}
|
}
|
||||||
: undefined,
|
: undefined,
|
||||||
province: {
|
province: {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue