better item primary key and cart updates, balance updating WIP

This commit is contained in:
2026-01-29 02:41:31 +01:00
parent 9e52f569f8
commit f5c581000e
12 changed files with 377 additions and 127 deletions
+8 -5
View File
@@ -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[]
}