yatahaze
yatahaze
PPrisma
Created by yatahaze on 6/15/2024 in #help-and-questions
TS Type Issue on Nested Selects
Same thing with include, here is the full cartItem model, had to beat the count limit.
model CartItem {
cartId String @map("cart_id") @db.Uuid
productId String @map("product_id")
quantity Int @default(1)

createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")

cart Cart @relation(fields: [cartId], references: [id], onDelete: Cascade)
product Product @relation(fields: [productId], references: [id], onDelete: Cascade)

@@id([cartId, productId])
@@map("cart_items")
}
model CartItem {
cartId String @map("cart_id") @db.Uuid
productId String @map("product_id")
quantity Int @default(1)

createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")

cart Cart @relation(fields: [cartId], references: [id], onDelete: Cascade)
product Product @relation(fields: [productId], references: [id], onDelete: Cascade)

@@id([cartId, productId])
@@map("cart_items")
}
3 replies