offers wip
This commit is contained in:
1 parent
453c2da045
commit
deb9eb3fc2
16 files changed
+276
-88
No files matched your search
@@ -16,6 +16,8 @@ model Listing {
|
||||
wantId String @db.Uuid
|
||||
want Want @relation(fields: [wantId], references: [id], onDelete: Cascade, onUpdate: Cascade)
|
||||
|
||||
offers Offer[]
|
||||
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
@@ -32,6 +34,7 @@ model User {
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
wants Want[]
|
||||
offers Offer[]
|
||||
|
||||
@@map("users")
|
||||
}
|
||||
@@ -48,9 +51,36 @@ model Want {
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
listings Listing[]
|
||||
offers Offer[]
|
||||
|
||||
@@unique([userId, release])
|
||||
@@index([release])
|
||||
|
||||
@@map("wants")
|
||||
}
|
||||
|
||||
model Offer {
|
||||
id String @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid
|
||||
|
||||
status String
|
||||
|
||||
item Decimal @db.Money
|
||||
shipping Decimal @db.Money
|
||||
total Decimal @db.Money
|
||||
comparison Decimal @db.Money
|
||||
|
||||
sellerId Int
|
||||
|
||||
listingId Int
|
||||
listing Listing @relation(fields: [listingId], references: [id])
|
||||
|
||||
userId String @db.Uuid
|
||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade, onUpdate: Cascade)
|
||||
|
||||
wantId String @db.Uuid
|
||||
want Want @relation(fields: [wantId], references: [id], onDelete: Cascade, onUpdate: Cascade)
|
||||
|
||||
// only one offer per want for a user
|
||||
@@unique([userId, wantId])
|
||||
@@map("offers")
|
||||
}
|
||||
Reference in new issue
Block a user