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
File diff suppressed because one or more lines are too long
+3 -3
View File
@@ -167,16 +167,16 @@ exports.Prisma.ShopScalarFieldEnum = {
exports.Prisma.ItemScalarFieldEnum = {
item_name: 'item_name',
stock: 'stock',
shopId: 'shopId'
shopId: 'shopId',
stock: 'stock'
};
exports.Prisma.SellableScalarFieldEnum = {
id: 'id',
item_name: 'item_name',
shopId: 'shopId',
amount: 'amount',
price: 'price',
shopId: 'shopId',
enabled: 'enabled'
};
+77 -75
View File
@@ -6756,61 +6756,61 @@ export namespace Prisma {
}
export type ItemAvgAggregateOutputType = {
stock: number | null
shopId: number | null
stock: number | null
}
export type ItemSumAggregateOutputType = {
stock: number | null
shopId: number | null
stock: number | null
}
export type ItemMinAggregateOutputType = {
item_name: string | null
stock: number | null
shopId: number | null
stock: number | null
}
export type ItemMaxAggregateOutputType = {
item_name: string | null
stock: number | null
shopId: number | null
stock: number | null
}
export type ItemCountAggregateOutputType = {
item_name: number
stock: number
shopId: number
stock: number
_all: number
}
export type ItemAvgAggregateInputType = {
stock?: true
shopId?: true
stock?: true
}
export type ItemSumAggregateInputType = {
stock?: true
shopId?: true
stock?: true
}
export type ItemMinAggregateInputType = {
item_name?: true
stock?: true
shopId?: true
stock?: true
}
export type ItemMaxAggregateInputType = {
item_name?: true
stock?: true
shopId?: true
stock?: true
}
export type ItemCountAggregateInputType = {
item_name?: true
stock?: true
shopId?: true
stock?: true
_all?: true
}
@@ -6902,8 +6902,8 @@ export namespace Prisma {
export type ItemGroupByOutputType = {
item_name: string
stock: number
shopId: number
stock: number
_count: ItemCountAggregateOutputType | null
_avg: ItemAvgAggregateOutputType | null
_sum: ItemSumAggregateOutputType | null
@@ -6927,8 +6927,8 @@ export namespace Prisma {
export type ItemSelect<ExtArgs extends $Extensions.InternalArgs = $Extensions.DefaultArgs> = $Extensions.GetSelect<{
item_name?: boolean
stock?: boolean
shopId?: boolean
stock?: boolean
shop?: boolean | ShopDefaultArgs<ExtArgs>
sellables?: boolean | Item$sellablesArgs<ExtArgs>
_count?: boolean | ItemCountOutputTypeDefaultArgs<ExtArgs>
@@ -6938,11 +6938,11 @@ export namespace Prisma {
export type ItemSelectScalar = {
item_name?: boolean
stock?: boolean
shopId?: boolean
stock?: boolean
}
export type ItemOmit<ExtArgs extends $Extensions.InternalArgs = $Extensions.DefaultArgs> = $Extensions.GetOmit<"item_name" | "stock" | "shopId", ExtArgs["result"]["item"]>
export type ItemOmit<ExtArgs extends $Extensions.InternalArgs = $Extensions.DefaultArgs> = $Extensions.GetOmit<"item_name" | "shopId" | "stock", ExtArgs["result"]["item"]>
export type ItemInclude<ExtArgs extends $Extensions.InternalArgs = $Extensions.DefaultArgs> = {
shop?: boolean | ShopDefaultArgs<ExtArgs>
sellables?: boolean | Item$sellablesArgs<ExtArgs>
@@ -6957,8 +6957,8 @@ export namespace Prisma {
}
scalars: $Extensions.GetPayloadResult<{
item_name: string
stock: number
shopId: number
stock: number
}, ExtArgs["result"]["item"]>
composites: {}
}
@@ -7331,8 +7331,8 @@ export namespace Prisma {
*/
interface ItemFieldRefs {
readonly item_name: FieldRef<"Item", 'String'>
readonly stock: FieldRef<"Item", 'Int'>
readonly shopId: FieldRef<"Item", 'Int'>
readonly stock: FieldRef<"Item", 'Int'>
}
@@ -7731,82 +7731,82 @@ export namespace Prisma {
}
export type SellableAvgAggregateOutputType = {
shopId: number | null
amount: number | null
price: number | null
shopId: number | null
}
export type SellableSumAggregateOutputType = {
shopId: number | null
amount: number | null
price: number | null
shopId: number | null
}
export type SellableMinAggregateOutputType = {
id: string | null
item_name: string | null
shopId: number | null
amount: number | null
price: number | null
shopId: number | null
enabled: boolean | null
}
export type SellableMaxAggregateOutputType = {
id: string | null
item_name: string | null
shopId: number | null
amount: number | null
price: number | null
shopId: number | null
enabled: boolean | null
}
export type SellableCountAggregateOutputType = {
id: number
item_name: number
shopId: number
amount: number
price: number
shopId: number
enabled: number
_all: number
}
export type SellableAvgAggregateInputType = {
shopId?: true
amount?: true
price?: true
shopId?: true
}
export type SellableSumAggregateInputType = {
shopId?: true
amount?: true
price?: true
shopId?: true
}
export type SellableMinAggregateInputType = {
id?: true
item_name?: true
shopId?: true
amount?: true
price?: true
shopId?: true
enabled?: true
}
export type SellableMaxAggregateInputType = {
id?: true
item_name?: true
shopId?: true
amount?: true
price?: true
shopId?: true
enabled?: true
}
export type SellableCountAggregateInputType = {
id?: true
item_name?: true
shopId?: true
amount?: true
price?: true
shopId?: true
enabled?: true
_all?: true
}
@@ -7900,9 +7900,9 @@ export namespace Prisma {
export type SellableGroupByOutputType = {
id: string
item_name: string
shopId: number
amount: number
price: number
shopId: number
enabled: boolean
_count: SellableCountAggregateOutputType | null
_avg: SellableAvgAggregateOutputType | null
@@ -7928,9 +7928,9 @@ export namespace Prisma {
export type SellableSelect<ExtArgs extends $Extensions.InternalArgs = $Extensions.DefaultArgs> = $Extensions.GetSelect<{
id?: boolean
item_name?: boolean
shopId?: boolean
amount?: boolean
price?: boolean
shopId?: boolean
enabled?: boolean
shop?: boolean | ShopDefaultArgs<ExtArgs>
item?: boolean | ItemDefaultArgs<ExtArgs>
@@ -7943,13 +7943,13 @@ export namespace Prisma {
export type SellableSelectScalar = {
id?: boolean
item_name?: boolean
shopId?: boolean
amount?: boolean
price?: boolean
shopId?: boolean
enabled?: boolean
}
export type SellableOmit<ExtArgs extends $Extensions.InternalArgs = $Extensions.DefaultArgs> = $Extensions.GetOmit<"id" | "item_name" | "amount" | "price" | "shopId" | "enabled", ExtArgs["result"]["sellable"]>
export type SellableOmit<ExtArgs extends $Extensions.InternalArgs = $Extensions.DefaultArgs> = $Extensions.GetOmit<"id" | "item_name" | "shopId" | "amount" | "price" | "enabled", ExtArgs["result"]["sellable"]>
export type SellableInclude<ExtArgs extends $Extensions.InternalArgs = $Extensions.DefaultArgs> = {
shop?: boolean | ShopDefaultArgs<ExtArgs>
item?: boolean | ItemDefaultArgs<ExtArgs>
@@ -7967,9 +7967,9 @@ export namespace Prisma {
scalars: $Extensions.GetPayloadResult<{
id: string
item_name: string
shopId: number
amount: number
price: number
shopId: number
enabled: boolean
}, ExtArgs["result"]["sellable"]>
composites: {}
@@ -8345,9 +8345,9 @@ export namespace Prisma {
interface SellableFieldRefs {
readonly id: FieldRef<"Sellable", 'String'>
readonly item_name: FieldRef<"Sellable", 'String'>
readonly shopId: FieldRef<"Sellable", 'Int'>
readonly amount: FieldRef<"Sellable", 'Int'>
readonly price: FieldRef<"Sellable", 'Float'>
readonly shopId: FieldRef<"Sellable", 'Int'>
readonly enabled: FieldRef<"Sellable", 'Boolean'>
}
@@ -11576,8 +11576,8 @@ export namespace Prisma {
export const ItemScalarFieldEnum: {
item_name: 'item_name',
stock: 'stock',
shopId: 'shopId'
shopId: 'shopId',
stock: 'stock'
};
export type ItemScalarFieldEnum = (typeof ItemScalarFieldEnum)[keyof typeof ItemScalarFieldEnum]
@@ -11586,9 +11586,9 @@ export namespace Prisma {
export const SellableScalarFieldEnum: {
id: 'id',
item_name: 'item_name',
shopId: 'shopId',
amount: 'amount',
price: 'price',
shopId: 'shopId',
enabled: 'enabled'
};
@@ -12098,36 +12098,37 @@ export namespace Prisma {
OR?: ItemWhereInput[]
NOT?: ItemWhereInput | ItemWhereInput[]
item_name?: StringFilter<"Item"> | string
stock?: IntFilter<"Item"> | number
shopId?: IntFilter<"Item"> | number
stock?: IntFilter<"Item"> | number
shop?: XOR<ShopScalarRelationFilter, ShopWhereInput>
sellables?: SellableListRelationFilter
}
export type ItemOrderByWithRelationInput = {
item_name?: SortOrder
stock?: SortOrder
shopId?: SortOrder
stock?: SortOrder
shop?: ShopOrderByWithRelationInput
sellables?: SellableOrderByRelationAggregateInput
_relevance?: ItemOrderByRelevanceInput
}
export type ItemWhereUniqueInput = Prisma.AtLeast<{
item_name?: string
item_name_shopId?: ItemItem_nameShopIdCompoundUniqueInput
AND?: ItemWhereInput | ItemWhereInput[]
OR?: ItemWhereInput[]
NOT?: ItemWhereInput | ItemWhereInput[]
stock?: IntFilter<"Item"> | number
item_name?: StringFilter<"Item"> | string
shopId?: IntFilter<"Item"> | number
stock?: IntFilter<"Item"> | number
shop?: XOR<ShopScalarRelationFilter, ShopWhereInput>
sellables?: SellableListRelationFilter
}, "item_name">
}, "item_name_shopId">
export type ItemOrderByWithAggregationInput = {
item_name?: SortOrder
stock?: SortOrder
shopId?: SortOrder
stock?: SortOrder
_count?: ItemCountOrderByAggregateInput
_avg?: ItemAvgOrderByAggregateInput
_max?: ItemMaxOrderByAggregateInput
@@ -12140,8 +12141,8 @@ export namespace Prisma {
OR?: ItemScalarWhereWithAggregatesInput[]
NOT?: ItemScalarWhereWithAggregatesInput | ItemScalarWhereWithAggregatesInput[]
item_name?: StringWithAggregatesFilter<"Item"> | string
stock?: IntWithAggregatesFilter<"Item"> | number
shopId?: IntWithAggregatesFilter<"Item"> | number
stock?: IntWithAggregatesFilter<"Item"> | number
}
export type SellableWhereInput = {
@@ -12150,9 +12151,9 @@ export namespace Prisma {
NOT?: SellableWhereInput | SellableWhereInput[]
id?: StringFilter<"Sellable"> | string
item_name?: StringFilter<"Sellable"> | string
shopId?: IntFilter<"Sellable"> | number
amount?: IntFilter<"Sellable"> | number
price?: FloatFilter<"Sellable"> | number
shopId?: IntFilter<"Sellable"> | number
enabled?: BoolFilter<"Sellable"> | boolean
shop?: XOR<ShopScalarRelationFilter, ShopWhereInput>
item?: XOR<ItemScalarRelationFilter, ItemWhereInput>
@@ -12162,9 +12163,9 @@ export namespace Prisma {
export type SellableOrderByWithRelationInput = {
id?: SortOrder
item_name?: SortOrder
shopId?: SortOrder
amount?: SortOrder
price?: SortOrder
shopId?: SortOrder
enabled?: SortOrder
shop?: ShopOrderByWithRelationInput
item?: ItemOrderByWithRelationInput
@@ -12178,9 +12179,9 @@ export namespace Prisma {
OR?: SellableWhereInput[]
NOT?: SellableWhereInput | SellableWhereInput[]
item_name?: StringFilter<"Sellable"> | string
shopId?: IntFilter<"Sellable"> | number
amount?: IntFilter<"Sellable"> | number
price?: FloatFilter<"Sellable"> | number
shopId?: IntFilter<"Sellable"> | number
enabled?: BoolFilter<"Sellable"> | boolean
shop?: XOR<ShopScalarRelationFilter, ShopWhereInput>
item?: XOR<ItemScalarRelationFilter, ItemWhereInput>
@@ -12190,9 +12191,9 @@ export namespace Prisma {
export type SellableOrderByWithAggregationInput = {
id?: SortOrder
item_name?: SortOrder
shopId?: SortOrder
amount?: SortOrder
price?: SortOrder
shopId?: SortOrder
enabled?: SortOrder
_count?: SellableCountOrderByAggregateInput
_avg?: SellableAvgOrderByAggregateInput
@@ -12207,9 +12208,9 @@ export namespace Prisma {
NOT?: SellableScalarWhereWithAggregatesInput | SellableScalarWhereWithAggregatesInput[]
id?: StringWithAggregatesFilter<"Sellable"> | string
item_name?: StringWithAggregatesFilter<"Sellable"> | string
shopId?: IntWithAggregatesFilter<"Sellable"> | number
amount?: IntWithAggregatesFilter<"Sellable"> | number
price?: FloatWithAggregatesFilter<"Sellable"> | number
shopId?: IntWithAggregatesFilter<"Sellable"> | number
enabled?: BoolWithAggregatesFilter<"Sellable"> | boolean
}
@@ -12691,8 +12692,8 @@ export namespace Prisma {
export type ItemUncheckedCreateInput = {
item_name: string
stock: number
shopId: number
stock: number
sellables?: SellableUncheckedCreateNestedManyWithoutItemInput
}
@@ -12705,15 +12706,15 @@ export namespace Prisma {
export type ItemUncheckedUpdateInput = {
item_name?: StringFieldUpdateOperationsInput | string
stock?: IntFieldUpdateOperationsInput | number
shopId?: IntFieldUpdateOperationsInput | number
stock?: IntFieldUpdateOperationsInput | number
sellables?: SellableUncheckedUpdateManyWithoutItemNestedInput
}
export type ItemCreateManyInput = {
item_name: string
stock: number
shopId: number
stock: number
}
export type ItemUpdateManyMutationInput = {
@@ -12723,8 +12724,8 @@ export namespace Prisma {
export type ItemUncheckedUpdateManyInput = {
item_name?: StringFieldUpdateOperationsInput | string
stock?: IntFieldUpdateOperationsInput | number
shopId?: IntFieldUpdateOperationsInput | number
stock?: IntFieldUpdateOperationsInput | number
}
export type SellableCreateInput = {
@@ -12740,9 +12741,9 @@ export namespace Prisma {
export type SellableUncheckedCreateInput = {
id?: string
item_name: string
shopId: number
amount: number
price: number
shopId: number
enabled?: boolean
cartItems?: CartItemUncheckedCreateNestedManyWithoutSellableInput
}
@@ -12760,9 +12761,9 @@ export namespace Prisma {
export type SellableUncheckedUpdateInput = {
id?: StringFieldUpdateOperationsInput | string
item_name?: StringFieldUpdateOperationsInput | string
shopId?: IntFieldUpdateOperationsInput | number
amount?: IntFieldUpdateOperationsInput | number
price?: FloatFieldUpdateOperationsInput | number
shopId?: IntFieldUpdateOperationsInput | number
enabled?: BoolFieldUpdateOperationsInput | boolean
cartItems?: CartItemUncheckedUpdateManyWithoutSellableNestedInput
}
@@ -12770,9 +12771,9 @@ export namespace Prisma {
export type SellableCreateManyInput = {
id?: string
item_name: string
shopId: number
amount: number
price: number
shopId: number
enabled?: boolean
}
@@ -12786,9 +12787,9 @@ export namespace Prisma {
export type SellableUncheckedUpdateManyInput = {
id?: StringFieldUpdateOperationsInput | string
item_name?: StringFieldUpdateOperationsInput | string
shopId?: IntFieldUpdateOperationsInput | number
amount?: IntFieldUpdateOperationsInput | number
price?: FloatFieldUpdateOperationsInput | number
shopId?: IntFieldUpdateOperationsInput | number
enabled?: BoolFieldUpdateOperationsInput | boolean
}
@@ -13391,32 +13392,37 @@ export namespace Prisma {
search: string
}
export type ItemItem_nameShopIdCompoundUniqueInput = {
item_name: string
shopId: number
}
export type ItemCountOrderByAggregateInput = {
item_name?: SortOrder
stock?: SortOrder
shopId?: SortOrder
stock?: SortOrder
}
export type ItemAvgOrderByAggregateInput = {
stock?: SortOrder
shopId?: SortOrder
stock?: SortOrder
}
export type ItemMaxOrderByAggregateInput = {
item_name?: SortOrder
stock?: SortOrder
shopId?: SortOrder
stock?: SortOrder
}
export type ItemMinOrderByAggregateInput = {
item_name?: SortOrder
stock?: SortOrder
shopId?: SortOrder
stock?: SortOrder
}
export type ItemSumOrderByAggregateInput = {
stock?: SortOrder
shopId?: SortOrder
stock?: SortOrder
}
export type BoolFilter<$PrismaModel = never> = {
@@ -13448,40 +13454,40 @@ export namespace Prisma {
export type SellableCountOrderByAggregateInput = {
id?: SortOrder
item_name?: SortOrder
shopId?: SortOrder
amount?: SortOrder
price?: SortOrder
shopId?: SortOrder
enabled?: SortOrder
}
export type SellableAvgOrderByAggregateInput = {
shopId?: SortOrder
amount?: SortOrder
price?: SortOrder
shopId?: SortOrder
}
export type SellableMaxOrderByAggregateInput = {
id?: SortOrder
item_name?: SortOrder
shopId?: SortOrder
amount?: SortOrder
price?: SortOrder
shopId?: SortOrder
enabled?: SortOrder
}
export type SellableMinOrderByAggregateInput = {
id?: SortOrder
item_name?: SortOrder
shopId?: SortOrder
amount?: SortOrder
price?: SortOrder
shopId?: SortOrder
enabled?: SortOrder
}
export type SellableSumOrderByAggregateInput = {
shopId?: SortOrder
amount?: SortOrder
price?: SortOrder
shopId?: SortOrder
}
export type BoolWithAggregatesFilter<$PrismaModel = never> = {
@@ -14934,8 +14940,8 @@ export namespace Prisma {
OR?: ItemScalarWhereInput[]
NOT?: ItemScalarWhereInput | ItemScalarWhereInput[]
item_name?: StringFilter<"Item"> | string
stock?: IntFilter<"Item"> | number
shopId?: IntFilter<"Item"> | number
stock?: IntFilter<"Item"> | number
}
export type SellableUpsertWithWhereUniqueWithoutShopInput = {
@@ -14960,9 +14966,9 @@ export namespace Prisma {
NOT?: SellableScalarWhereInput | SellableScalarWhereInput[]
id?: StringFilter<"Sellable"> | string
item_name?: StringFilter<"Sellable"> | string
shopId?: IntFilter<"Sellable"> | number
amount?: IntFilter<"Sellable"> | number
price?: FloatFilter<"Sellable"> | number
shopId?: IntFilter<"Sellable"> | number
enabled?: BoolFilter<"Sellable"> | boolean
}
@@ -14998,7 +15004,6 @@ export namespace Prisma {
id?: string
amount: number
price: number
shopId: number
enabled?: boolean
cartItems?: CartItemUncheckedCreateNestedManyWithoutSellableInput
}
@@ -15081,8 +15086,8 @@ export namespace Prisma {
export type ItemUncheckedCreateWithoutSellablesInput = {
item_name: string
stock: number
shopId: number
stock: number
}
export type ItemCreateOrConnectWithoutSellablesInput = {
@@ -15154,8 +15159,8 @@ export namespace Prisma {
export type ItemUncheckedUpdateWithoutSellablesInput = {
item_name?: StringFieldUpdateOperationsInput | string
stock?: IntFieldUpdateOperationsInput | number
shopId?: IntFieldUpdateOperationsInput | number
stock?: IntFieldUpdateOperationsInput | number
}
export type CartItemUpsertWithWhereUniqueWithoutSellableInput = {
@@ -15312,9 +15317,9 @@ export namespace Prisma {
export type SellableUncheckedCreateWithoutCartItemsInput = {
id?: string
item_name: string
shopId: number
amount: number
price: number
shopId: number
enabled?: boolean
}
@@ -15365,9 +15370,9 @@ export namespace Prisma {
export type SellableUncheckedUpdateWithoutCartItemsInput = {
id?: StringFieldUpdateOperationsInput | string
item_name?: StringFieldUpdateOperationsInput | string
shopId?: IntFieldUpdateOperationsInput | number
amount?: IntFieldUpdateOperationsInput | number
price?: FloatFieldUpdateOperationsInput | number
shopId?: IntFieldUpdateOperationsInput | number
enabled?: BoolFieldUpdateOperationsInput | boolean
}
@@ -15643,7 +15648,6 @@ export namespace Prisma {
id?: string
amount: number
price: number
shopId: number
enabled?: boolean
}
@@ -15660,7 +15664,6 @@ export namespace Prisma {
id?: StringFieldUpdateOperationsInput | string
amount?: IntFieldUpdateOperationsInput | number
price?: FloatFieldUpdateOperationsInput | number
shopId?: IntFieldUpdateOperationsInput | number
enabled?: BoolFieldUpdateOperationsInput | boolean
cartItems?: CartItemUncheckedUpdateManyWithoutSellableNestedInput
}
@@ -15669,7 +15672,6 @@ export namespace Prisma {
id?: StringFieldUpdateOperationsInput | string
amount?: IntFieldUpdateOperationsInput | number
price?: FloatFieldUpdateOperationsInput | number
shopId?: IntFieldUpdateOperationsInput | number
enabled?: BoolFieldUpdateOperationsInput | boolean
}
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -1,5 +1,5 @@
{
"name": "prisma-client-a0e1bef334afa5b609bdf0c15431f28835b869da62270d0786ce071578cdedb4",
"name": "prisma-client-60cecad7f5344b2ab216d0c215477a4a9f0fb3ec9e5201c830e0c4ac3caafb77",
"main": "index.js",
"types": "index.d.ts",
"browser": "default.js",
+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[]
}
File diff suppressed because one or more lines are too long