Convert backend to regular directory
This commit is contained in:
111
backend/prisma/schema.prisma
Normal file
111
backend/prisma/schema.prisma
Normal file
@@ -0,0 +1,111 @@
|
||||
generator client {
|
||||
provider = "prisma-client-js"
|
||||
}
|
||||
|
||||
datasource db {
|
||||
provider = "postgresql"
|
||||
url = env("DATABASE_URL")
|
||||
}
|
||||
|
||||
enum Role {
|
||||
CLIENT
|
||||
EMPLOYEE
|
||||
ADMIN
|
||||
}
|
||||
|
||||
enum ClaimType {
|
||||
STORE
|
||||
ONLINE
|
||||
}
|
||||
|
||||
enum ClaimStatus {
|
||||
PENDING
|
||||
DELIVERED
|
||||
CANCELLED
|
||||
}
|
||||
|
||||
model User {
|
||||
id Int @id @default(autoincrement())
|
||||
firstname String
|
||||
lastname String
|
||||
email String @unique
|
||||
password String
|
||||
role Role @default(CLIENT)
|
||||
birthdate DateTime?
|
||||
gender String?
|
||||
marketingOptIn Boolean @default(false)
|
||||
createdAt DateTime @default(now())
|
||||
|
||||
tickets Ticket[]
|
||||
participations Participation[]
|
||||
grandPrizeWinner GrandPrizeWinner?
|
||||
claimsValidated Claim[] @relation("EmployeeClaims")
|
||||
}
|
||||
|
||||
model Lot {
|
||||
id Int @id @default(autoincrement())
|
||||
name String
|
||||
description String?
|
||||
value Float?
|
||||
percentage Float
|
||||
|
||||
tickets Ticket[]
|
||||
participations Participation[]
|
||||
}
|
||||
|
||||
model Ticket {
|
||||
id Int @id @default(autoincrement())
|
||||
code String @unique
|
||||
isUsed Boolean @default(false)
|
||||
usedAt DateTime?
|
||||
|
||||
lotId Int
|
||||
lot Lot @relation(fields: [lotId], references: [id])
|
||||
|
||||
userId Int?
|
||||
user User? @relation(fields: [userId], references: [id])
|
||||
|
||||
participation Participation?
|
||||
createdAt DateTime @default(now())
|
||||
}
|
||||
|
||||
model Participation {
|
||||
id Int @id @default(autoincrement())
|
||||
|
||||
userId Int
|
||||
user User @relation(fields: [userId], references: [id])
|
||||
|
||||
ticketId Int @unique
|
||||
ticket Ticket @relation(fields: [ticketId], references: [id])
|
||||
|
||||
lotId Int
|
||||
lot Lot @relation(fields: [lotId], references: [id])
|
||||
|
||||
claim Claim?
|
||||
createdAt DateTime @default(now())
|
||||
}
|
||||
|
||||
model Claim {
|
||||
id Int @id @default(autoincrement())
|
||||
|
||||
status ClaimStatus @default(PENDING)
|
||||
|
||||
participationId Int @unique
|
||||
participation Participation @relation(fields: [participationId], references: [id])
|
||||
|
||||
validatedByEmployeeId Int?
|
||||
validatedByEmployee User? @relation("EmployeeClaims", fields: [validatedByEmployeeId], references: [id])
|
||||
|
||||
claimedAt DateTime?
|
||||
createdAt DateTime @default(now())
|
||||
}
|
||||
|
||||
model GrandPrizeWinner {
|
||||
id Int @id @default(autoincrement())
|
||||
|
||||
userId Int @unique
|
||||
user User @relation(fields: [userId], references: [id])
|
||||
|
||||
prize String @default("Un an de thé d'une valeur de 360€")
|
||||
drawnAt DateTime @default(now())
|
||||
}
|
||||
Reference in New Issue
Block a user