add user context and likes

This commit is contained in:
Aaron William Po
2023-02-08 07:43:59 -05:00
parent 20000cc4af
commit f6880deeb6
12 changed files with 300 additions and 47 deletions

View File

@@ -25,24 +25,36 @@ model User {
breweryPosts BreweryPost[]
beerComments BeerComment[]
breweryComments BreweryComment[]
BeerPostLikes BeerPostLikes[]
}
model BeerPost {
id String @id @default(uuid())
name String
ibu Float
abv Float
description String
postedBy User @relation(fields: [postedById], references: [id], onDelete: Cascade)
postedById String
brewery BreweryPost @relation(fields: [breweryId], references: [id], onDelete: Cascade)
breweryId String
type BeerType @relation(fields: [typeId], references: [id], onDelete: Cascade)
typeId String
createdAt DateTime @default(now()) @db.Timestamptz(3)
updatedAt DateTime? @updatedAt @db.Timestamptz(3)
beerComments BeerComment[]
beerImages BeerImage[]
id String @id @default(uuid())
name String
ibu Float
abv Float
description String
postedBy User @relation(fields: [postedById], references: [id], onDelete: Cascade)
postedById String
brewery BreweryPost @relation(fields: [breweryId], references: [id], onDelete: Cascade)
breweryId String
type BeerType @relation(fields: [typeId], references: [id], onDelete: Cascade)
typeId String
createdAt DateTime @default(now()) @db.Timestamptz(3)
updatedAt DateTime? @updatedAt @db.Timestamptz(3)
beerComments BeerComment[]
beerImages BeerImage[]
BeerPostLikes BeerPostLikes[]
}
model BeerPostLikes {
id String @id @default(uuid())
beerPost BeerPost @relation(fields: [beerPostId], references: [id], onDelete: Cascade)
beerPostId String
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
userId String
createdAt DateTime @default(now()) @db.Timestamptz(3)
updatedAt DateTime? @updatedAt @db.Timestamptz(3)
}
model BeerComment {