1
Fork 0
mirror of https://github.com/Steffo99/festa.git synced 2024-12-22 22:54:22 +00:00

Add collective items to the schema

This commit is contained in:
Steffo 2022-05-20 19:43:47 +02:00
parent 7cd9209110
commit 3b77ac1d2f
Signed by: steffo
GPG key ID: 6965406171929D01

View file

@ -12,38 +12,40 @@ datasource db {
/// An event is the representation of a gathering of people in a certain place at a certain time. /// An event is the representation of a gathering of people in a certain place at a certain time.
model Event { model Event {
id Int @id @default(autoincrement()) id Int @id @default(autoincrement())
// //
slug String slug String
createdAt DateTime @default(now()) createdAt DateTime @default(now())
updatedAt DateTime @updatedAt updatedAt DateTime @updatedAt
viewPassword String? viewPassword String?
joinPassword String? joinPassword String?
// //
name String name String
description String description String
postcard String? postcard String?
startTime DateTime? startTime DateTime?
endTime DateTime? endTime DateTime?
location String? location String?
// //
partecipants Partecipant[] partecipants Partecipant[]
neededItems CollectiveItem[]
} }
/// A partecipant is a person who may or may not partecipate to the event. /// A partecipant is a person who may or may not partecipate to the event.
model Partecipant { model Partecipant {
id Int @id @default(autoincrement()) id Int @id @default(autoincrement())
eventId Int eventId Int
event Event @relation(fields: [eventId], references: [id]) event Event @relation(fields: [eventId], references: [id])
// //
name String name String
email String email String
// //
means PartecipationMeans means PartecipationMeans
createdAt DateTime @default(now()) createdAt DateTime @default(now())
joinedAt DateTime? joinedAt DateTime?
// //
answer PartecipationAnswer answer PartecipationAnswer
shouldBring CollectiveItem[]
} }
enum PartecipationMeans { enum PartecipationMeans {
@ -60,3 +62,17 @@ enum PartecipationAnswer {
NO NO
PENDING PENDING
} }
/// An item which should be bought and brought by somebody to the event.
model CollectiveItem {
id Int @id @default(autoincrement())
eventId Int
event Event @relation(fields: [eventId], references: [id])
//
quantity Int
name String
purchased Boolean @default(false)
//
assignedId Int?
assigned Partecipant? @relation(fields: [assignedId], references: [id])
}