Skip to content

Commit

Permalink
Merge pull request #46 from bandungpy/chore/update-db
Browse files Browse the repository at this point in the history
chore: update DB models
  • Loading branch information
aldamr01 authored Aug 27, 2023
2 parents ea9ac8b + 52a6453 commit 5c9dd1c
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ model User {
role UserRole? @relation(fields: [roleId], references: [id])
roleId String?
participantType String @default("non-participant")
ticketTransactions TicketTransaction[]
vouchers Voucher[]
voucherTransactions VoucherTransaction[]
Expand Down Expand Up @@ -75,11 +77,26 @@ model Ticket {
description String?
transactions TicketTransaction[]
features TicketFeature[]
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}

model TicketFeature {
id String @id @default(cuid())
feature String?
ticket Ticket? @relation(fields: [ticketId], references: [id])
ticketId String?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@index([ticketId])
}

model TicketTransaction {
id String @id @default(cuid())
Expand All @@ -88,6 +105,8 @@ model TicketTransaction {
ticket Ticket? @relation(fields: [ticketId], references: [id])
ticketId String?
paymentId String
transactionId String
user User? @relation(fields: [userId], references: [id])
userId String?
Expand All @@ -105,11 +124,13 @@ model Voucher {
name String
code String
quota Int @default(0)
private Boolean @default(false)
discount Int
description String
transactions VoucherTransaction[]
whitelists VoucherWhitelist[]
requirement VoucherRequirement? @relation(fields: [requirementId], references: [id])
requirementId String?
Expand Down Expand Up @@ -153,3 +174,17 @@ model VoucherTransaction {
@@index([voucherId])
@@index([userId])
}

model VoucherWhitelist {
id String @id @default(cuid())
description String
voucher Voucher? @relation(fields: [voucherId], references: [id])
voucherId String?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@index([voucherId])
}

0 comments on commit 5c9dd1c

Please sign in to comment.