better item primary key and cart updates, balance updating WIP
This commit is contained in:
@@ -81,24 +81,27 @@ model Shop {
|
||||
}
|
||||
|
||||
model Item {
|
||||
item_name String @id
|
||||
stock Int
|
||||
item_name String
|
||||
shopId Int
|
||||
stock Int
|
||||
|
||||
shop Shop @relation(fields: [shopId], references: [id], onDelete: Cascade, onUpdate: Cascade)
|
||||
sellables Sellable[]
|
||||
|
||||
@@id([item_name, shopId])
|
||||
}
|
||||
|
||||
model Sellable {
|
||||
id String @id @default(cuid())
|
||||
item_name String
|
||||
shopId Int
|
||||
amount Int
|
||||
price Float
|
||||
shopId Int
|
||||
enabled Boolean @default(true)
|
||||
|
||||
shop Shop @relation(fields: [shopId], references: [id], onDelete: Cascade, onUpdate: Cascade)
|
||||
item Item @relation(fields: [item_name], references: [item_name], onDelete: Cascade, onUpdate: Cascade)
|
||||
shop Shop @relation(fields: [shopId], references: [id], onDelete: Cascade)
|
||||
item Item @relation(fields: [item_name, shopId], references: [item_name, shopId], onDelete: Cascade)
|
||||
|
||||
cartItems CartItem[]
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user