forked from AdventOfJavaScript/2023-12-00__starter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathschema.prisma
112 lines (102 loc) · 3.22 KB
/
schema.prisma
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
datasource db {
provider = "postgres"
url = env("DATABASE_URL")
}
generator client {
provider = "prisma-client-js"
binaryTargets = "native"
}
// Define your own datamodels here and run `yarn redwood prisma migrate dev`
// to create migrations for them and apply to your dev DB.
model User {
id Int @id @default(autoincrement())
email String @unique
firstName String?
lastName String?
avatar String?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
role Role @default(USER)
status Invite[]
event Event[]
santa Pairings[] @relation(name: "Pairings_Santa")
person Pairings[] @relation(name: "Pairings_Person")
wishList WishList[]
thankYouAuthor ThankYou[] @relation(name: "ThankYou_User")
thankYouToUser ThankYou[] @relation(name: "ThankYou_ToUser")
// auth
hashedPassword String @default("")
salt String @default("")
resetToken String?
resetTokenExpiresAt DateTime?
}
enum Role {
ADMIN
USER
}
model Invite {
id String @id
userId Int
user User @relation(fields: [userId], references: [id])
eventId String
event Event @relation(fields: [eventId], references: [id])
status Status
email String
name String
}
enum Status {
INVITED
DECLINED
ACCEPTED
}
model Event {
id String @id @default(uuid())
name String
date DateTime
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
sendReminder Boolean @default(false)
owner Int
user User @relation(fields: [owner], references: [id])
invite Invite[]
pairings Pairings[]
wishList WishList[]
thankYou ThankYou[]
}
model Pairings {
id Int @id @default(autoincrement())
eventId String
event Event @relation(fields: [eventId], references: [id])
santaId Int
santa User @relation(fields: [santaId], references: [id], name: "Pairings_Santa")
personId Int
person User @relation(fields: [personId], references: [id], name: "Pairings_Person")
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
model WishList {
id Int @id @default(autoincrement())
name String
url String
userId Int
user User @relation(fields: [userId], references: [id])
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
order Int?
eventId String
event Event @relation(fields: [eventId], references: [id])
siteImage String?
siteTitle String?
siteDescription String?
}
model ThankYou {
id String @id @default(uuid())
eventId String
event Event @relation(fields: [eventId], references: [id])
userId Int
user User @relation(fields: [userId], references: [id], name: "ThankYou_User")
toUserId Int
toUser User @relation(fields: [toUserId], references: [id], name: "ThankYou_ToUser")
message String
createdAt DateTime @default(now())
}