2022-05-20 12:20:45 +00:00
|
|
|
// This is your Prisma schema file,
|
|
|
|
// learn more about it in the docs: https://pris.ly/d/prisma-schema
|
|
|
|
|
|
|
|
generator client {
|
|
|
|
provider = "prisma-client-js"
|
2022-05-20 12:11:08 +00:00
|
|
|
}
|
|
|
|
|
2022-05-20 12:20:45 +00:00
|
|
|
datasource db {
|
2022-05-20 17:31:50 +00:00
|
|
|
provider = "postgresql"
|
2022-05-20 12:20:45 +00:00
|
|
|
url = env("DATABASE_URL")
|
|
|
|
}
|
2022-05-20 17:15:47 +00:00
|
|
|
|
|
|
|
/// An event is the representation of a gathering of people in a certain place at a certain time.
|
|
|
|
model Event {
|
2022-05-20 17:43:47 +00:00
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
//
|
|
|
|
slug String
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
updatedAt DateTime @updatedAt
|
|
|
|
viewPassword String?
|
|
|
|
joinPassword String?
|
|
|
|
//
|
|
|
|
name String
|
|
|
|
description String
|
|
|
|
postcard String?
|
|
|
|
startTime DateTime?
|
|
|
|
endTime DateTime?
|
|
|
|
location String?
|
|
|
|
//
|
|
|
|
partecipants Partecipant[]
|
|
|
|
neededItems CollectiveItem[]
|
2022-05-20 17:15:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/// A partecipant is a person who may or may not partecipate to the event.
|
|
|
|
model Partecipant {
|
2022-05-20 17:43:47 +00:00
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
eventId Int
|
|
|
|
event Event @relation(fields: [eventId], references: [id])
|
2022-05-20 17:15:47 +00:00
|
|
|
//
|
2022-05-20 17:43:47 +00:00
|
|
|
name String
|
|
|
|
email String
|
2022-05-20 17:15:47 +00:00
|
|
|
//
|
2022-05-20 17:43:47 +00:00
|
|
|
means PartecipationMeans
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
joinedAt DateTime?
|
2022-05-20 17:15:47 +00:00
|
|
|
//
|
2022-05-20 17:43:47 +00:00
|
|
|
answer PartecipationAnswer
|
|
|
|
shouldBring CollectiveItem[]
|
2022-05-20 17:15:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
enum PartecipationMeans {
|
|
|
|
CREATOR
|
|
|
|
INVITED
|
|
|
|
ACCEPTED
|
|
|
|
JOINED
|
|
|
|
}
|
|
|
|
|
|
|
|
enum PartecipationAnswer {
|
|
|
|
HOST
|
|
|
|
YES
|
|
|
|
MAYBE
|
|
|
|
NO
|
|
|
|
PENDING
|
|
|
|
}
|
2022-05-20 17:43:47 +00:00
|
|
|
|
|
|
|
/// 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])
|
|
|
|
}
|