refactor: update quotation structure and endpoint
This commit is contained in:
parent
4f4b8df9a3
commit
71ffd895f6
3 changed files with 262 additions and 363 deletions
|
|
@ -931,7 +931,7 @@ model Product {
|
|||
productGroupId String
|
||||
|
||||
workProduct WorkProduct[]
|
||||
quotationServiceWorkProduct QuotationServiceWorkProduct[]
|
||||
quotationProductServiceList QuotationProductServiceList[]
|
||||
|
||||
createdAt DateTime @default(now())
|
||||
createdBy User? @relation(name: "ProductCreatedByUser", fields: [createdByUserId], references: [id], onDelete: SetNull)
|
||||
|
|
@ -955,8 +955,8 @@ model Service {
|
|||
shared Boolean @default(false)
|
||||
selectedImage String?
|
||||
|
||||
work Work[]
|
||||
quotationService QuotationService[]
|
||||
work Work[]
|
||||
quotationProductServiceList QuotationProductServiceList[]
|
||||
|
||||
productGroup ProductGroup @relation(fields: [productGroupId], references: [id], onDelete: Cascade)
|
||||
productGroupId String
|
||||
|
|
@ -989,7 +989,8 @@ model Work {
|
|||
updatedBy User? @relation(name: "WorkUpdatedByUser", fields: [updatedByUserId], references: [id], onDelete: SetNull)
|
||||
updatedByUserId String?
|
||||
|
||||
productOnWork WorkProduct[]
|
||||
productOnWork WorkProduct[]
|
||||
quotationProductServiceList QuotationProductServiceList[]
|
||||
}
|
||||
|
||||
model WorkProduct {
|
||||
|
|
@ -1045,10 +1046,10 @@ model Quotation {
|
|||
workerCount Int
|
||||
worker QuotationWorker[]
|
||||
|
||||
service QuotationService[]
|
||||
|
||||
urgent Boolean @default(false)
|
||||
|
||||
productServiceList QuotationProductServiceList[]
|
||||
|
||||
totalPrice Float
|
||||
totalDiscount Float
|
||||
vat Float
|
||||
|
|
@ -1084,47 +1085,24 @@ model QuotationWorker {
|
|||
quotationId String
|
||||
}
|
||||
|
||||
model QuotationService {
|
||||
id String @id @default(cuid())
|
||||
|
||||
code String
|
||||
name String
|
||||
detail String
|
||||
attributes Json?
|
||||
|
||||
work QuotationServiceWork[]
|
||||
|
||||
refServiceId String
|
||||
refService Service @relation(fields: [refServiceId], references: [id])
|
||||
|
||||
quotation Quotation @relation(fields: [quotationId], references: [id], onDelete: Cascade)
|
||||
model QuotationProductServiceList {
|
||||
id String @id @default(cuid())
|
||||
quotationId String
|
||||
}
|
||||
quotation Quotation @relation(fields: [quotationId], references: [id])
|
||||
|
||||
model QuotationServiceWork {
|
||||
id String @id @default(cuid())
|
||||
|
||||
order Int
|
||||
name String
|
||||
attributes Json?
|
||||
|
||||
service QuotationService @relation(fields: [serviceId], references: [id], onDelete: Cascade)
|
||||
serviceId String
|
||||
|
||||
productOnWork QuotationServiceWorkProduct[]
|
||||
}
|
||||
|
||||
model QuotationServiceWorkProduct {
|
||||
order Int
|
||||
work QuotationServiceWork @relation(fields: [workId], references: [id], onDelete: Cascade)
|
||||
workId String
|
||||
product Product @relation(fields: [productId], references: [id], onDelete: Cascade)
|
||||
productId String
|
||||
order Int
|
||||
|
||||
vat Float
|
||||
amount Int
|
||||
discount Float
|
||||
pricePerUnit Float
|
||||
|
||||
@@id([workId, productId])
|
||||
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])
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue