refactor!: remove product type

This commit is contained in:
Methapon Metanipat 2024-09-03 14:06:02 +07:00
parent 4f84330cbc
commit 4b08d12845
7 changed files with 105 additions and 344 deletions

View file

@ -390,8 +390,6 @@ model User {
workProductUpdated WorkProduct[] @relation("WorkProductUpdatedByUser")
productGroupCreated ProductGroup[] @relation("ProductGroupCreatedByUser")
productGroupUpdated ProductGroup[] @relation("ProductGroupUpdatedByUser")
productTypeCreated ProductType[] @relation("ProductTypeCreatedByUser")
productTypeUpdated ProductType[] @relation("ProductTypeUpdatedByUser")
productCreated Product[] @relation("ProductCreatedByUser")
productUpdated Product[] @relation("ProductUpdatedByUser")
quotationCreated Quotation[] @relation("QuotationCreatedByUser")
@ -671,32 +669,8 @@ model ProductGroup {
updatedBy User? @relation(name: "ProductGroupUpdatedByUser", fields: [updatedByUserId], references: [id], onDelete: SetNull)
updatedByUserId String?
type ProductType[]
}
model ProductType {
id String @id @default(cuid())
code String
name String
detail String
remark String
status Status @default(CREATED)
statusOrder Int @default(0)
createdAt DateTime @default(now())
createdBy User? @relation(name: "ProductTypeCreatedByUser", fields: [createdByUserId], references: [id], onDelete: SetNull)
createdByUserId String?
updatedAt DateTime @updatedAt
updatedBy User? @relation(name: "ProductTypeUpdatedByUser", fields: [updatedByUserId], references: [id], onDelete: SetNull)
updatedByUserId String?
productGroup ProductGroup @relation(fields: [productGroupId], references: [id], onDelete: Cascade)
productGroupId String
product Product[]
service Service[]
product Product[]
}
model Product {
@ -709,14 +683,16 @@ model Product {
price Float
agentPrice Float
serviceCharge Float
vatIncluded Boolean?
expenseType String?
status Status @default(CREATED)
statusOrder Int @default(0)
remark String?
productType ProductType? @relation(fields: [productTypeId], references: [id], onDelete: SetNull)
productTypeId String?
productGroup ProductGroup? @relation(fields: [productGroupId], references: [id], onDelete: SetNull)
productGroupId String?
registeredBranchId String?
registeredBranch Branch? @relation(fields: [registeredBranchId], references: [id])
@ -746,8 +722,8 @@ model Service {
work Work[]
quotationService QuotationService[]
productType ProductType? @relation(fields: [productTypeId], references: [id], onDelete: SetNull)
productTypeId String?
productGroup ProductGroup? @relation(fields: [productGroupId], references: [id], onDelete: SetNull)
productGroupId String?
registeredBranchId String?
registeredBranch Branch? @relation(fields: [registeredBranchId], references: [id])