@bash-app/bash-common 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.idea/bash-common.iml +12 -0
- package/.idea/modules.xml +8 -0
- package/.idea/vcs.xml +6 -0
- package/package.json +27 -0
- package/prisma/schema.prisma +880 -0
- package/src/definitions.ts +183 -0
- package/src/extendedSchemas.ts +143 -0
- package/tsconfig.json +18 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<module type="WEB_MODULE" version="4">
|
|
3
|
+
<component name="NewModuleRootManager">
|
|
4
|
+
<content url="file://$MODULE_DIR$">
|
|
5
|
+
<excludeFolder url="file://$MODULE_DIR$/.tmp" />
|
|
6
|
+
<excludeFolder url="file://$MODULE_DIR$/temp" />
|
|
7
|
+
<excludeFolder url="file://$MODULE_DIR$/tmp" />
|
|
8
|
+
</content>
|
|
9
|
+
<orderEntry type="inheritedJdk" />
|
|
10
|
+
<orderEntry type="sourceFolder" forTests="false" />
|
|
11
|
+
</component>
|
|
12
|
+
</module>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<project version="4">
|
|
3
|
+
<component name="ProjectModuleManager">
|
|
4
|
+
<modules>
|
|
5
|
+
<module fileurl="file://$PROJECT_DIR$/.idea/bash-common.iml" filepath="$PROJECT_DIR$/.idea/bash-common.iml" />
|
|
6
|
+
</modules>
|
|
7
|
+
</component>
|
|
8
|
+
</project>
|
package/.idea/vcs.xml
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@bash-app/bash-common",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Common data and scripts to use on the frontend and backend",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"generate": "prisma generate",
|
|
7
|
+
"tsc": "tsc"
|
|
8
|
+
},
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+ssh://git@github.com/bash-community/bash-common.git"
|
|
12
|
+
},
|
|
13
|
+
"author": "Frank Nielson",
|
|
14
|
+
"license": "ISC",
|
|
15
|
+
"dependencies": {
|
|
16
|
+
"@prisma/client": "^5.13.0",
|
|
17
|
+
"ts-node": "^10.9.1",
|
|
18
|
+
"typescript": "^5.2.2"
|
|
19
|
+
},
|
|
20
|
+
"devDependencies": {
|
|
21
|
+
"@types/jest": "^29.5.5",
|
|
22
|
+
"@types/node": "^20.8.4",
|
|
23
|
+
"jest": "^29.7.0",
|
|
24
|
+
"prisma": "^5.13.0",
|
|
25
|
+
"ts-jest": "^29.1.1"
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,880 @@
|
|
|
1
|
+
// This is your Prisma schema file,
|
|
2
|
+
// learn more about it in the docs: https://pris.ly/d/prisma-schema
|
|
3
|
+
|
|
4
|
+
generator client {
|
|
5
|
+
provider = "prisma-client-js"
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
datasource db {
|
|
9
|
+
provider = "postgresql"
|
|
10
|
+
url = env("POSTGRES_PRISMA_URL") // uses connection pooling
|
|
11
|
+
directUrl = env("POSTGRES_URL_NON_POOLING") // uses a direct connection
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
model Account {
|
|
15
|
+
id String @id @default(cuid())
|
|
16
|
+
userId String @unique
|
|
17
|
+
type String
|
|
18
|
+
provider String
|
|
19
|
+
providerAccountId String
|
|
20
|
+
refresh_token String? @db.Text
|
|
21
|
+
access_token String? @db.Text
|
|
22
|
+
expires_at Int?
|
|
23
|
+
token_type String?
|
|
24
|
+
scope String?
|
|
25
|
+
id_token String? @db.Text
|
|
26
|
+
session_state String?
|
|
27
|
+
image String?
|
|
28
|
+
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
29
|
+
|
|
30
|
+
@@unique([provider, providerAccountId])
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
model Business {
|
|
34
|
+
id String @id @default(cuid())
|
|
35
|
+
name String
|
|
36
|
+
ein String?
|
|
37
|
+
dba String?
|
|
38
|
+
address String?
|
|
39
|
+
media Media[]
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
model Club {
|
|
43
|
+
id String @id @default(cuid())
|
|
44
|
+
name String
|
|
45
|
+
address String
|
|
46
|
+
userId String
|
|
47
|
+
price Int?
|
|
48
|
+
events BashEvent[]
|
|
49
|
+
members ClubMember[]
|
|
50
|
+
admin ClubAdmin[]
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
model ClubAdmin {
|
|
54
|
+
id String @id @default(cuid())
|
|
55
|
+
admin User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
56
|
+
userId String
|
|
57
|
+
club Club @relation(fields: [clubId], references: [id], onDelete: Cascade)
|
|
58
|
+
clubId String
|
|
59
|
+
role ClubAdminRole
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
model ClubMember {
|
|
63
|
+
id String @id @default(cuid())
|
|
64
|
+
member User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
65
|
+
userId String
|
|
66
|
+
club Club @relation(fields: [clubId], references: [id], onDelete: Cascade)
|
|
67
|
+
clubId String
|
|
68
|
+
status ClubMemberStatus
|
|
69
|
+
statusHistory Json
|
|
70
|
+
price Int?
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
enum ClubAdminRole {
|
|
74
|
+
Owner
|
|
75
|
+
Admin
|
|
76
|
+
Staff
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
enum ClubMemberStatus {
|
|
80
|
+
Active
|
|
81
|
+
Inactive
|
|
82
|
+
Cancelled
|
|
83
|
+
Paused
|
|
84
|
+
Removed
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
model BashComment {
|
|
88
|
+
id String @id @default(cuid())
|
|
89
|
+
creatorId String
|
|
90
|
+
creator User @relation(fields: [creatorId], references: [id], onDelete: Cascade)
|
|
91
|
+
content String
|
|
92
|
+
reviewId String?
|
|
93
|
+
review Review? @relation(fields: [reviewId], references: [id], onDelete: SetNull)
|
|
94
|
+
bashEventId String?
|
|
95
|
+
bashEvent BashEvent? @relation(fields: [bashEventId], references: [id], onDelete: Cascade)
|
|
96
|
+
parentCommentId String?
|
|
97
|
+
parentComment BashComment? @relation("CommentReplies", fields: [parentCommentId], references: [id], onDelete: Cascade)
|
|
98
|
+
replies BashComment[] @relation("CommentReplies")
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
model Competition {
|
|
102
|
+
id String @id @default(cuid())
|
|
103
|
+
name String
|
|
104
|
+
description String
|
|
105
|
+
owner User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
106
|
+
prizes Prize[]
|
|
107
|
+
userId String
|
|
108
|
+
sponser CompetitionSponsor[]
|
|
109
|
+
bashEvent BashEvent @relation(fields: [bashEventId], references: [id], onDelete: Cascade)
|
|
110
|
+
bashEventId String
|
|
111
|
+
numberOfPrizes Int
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
model CompetitionSponsor {
|
|
115
|
+
id String @id @default(cuid())
|
|
116
|
+
competition Competition @relation(fields: [competitionId], references: [id], onDelete: Cascade)
|
|
117
|
+
sponsor User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
118
|
+
competitionId String
|
|
119
|
+
userId String
|
|
120
|
+
description String
|
|
121
|
+
paidOn String?
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
model EventTask {
|
|
125
|
+
id String @id @default(cuid())
|
|
126
|
+
creatorId String
|
|
127
|
+
creator User @relation(fields: [creatorId], references: [id], onDelete: Cascade)
|
|
128
|
+
bashEventId String
|
|
129
|
+
bashEvent BashEvent @relation(fields: [bashEventId], references: [id], onDelete: Cascade)
|
|
130
|
+
description String
|
|
131
|
+
assignedToId String?
|
|
132
|
+
assignedTo User? @relation("TasksAssignedToMe", fields: [assignedToId], references: [id], onDelete: Cascade)
|
|
133
|
+
status TaskStatus?
|
|
134
|
+
bashNotificationsReferencingMe BashNotification[]
|
|
135
|
+
createdAt DateTime? @default(now())
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
enum TaskStatus {
|
|
139
|
+
Accepted
|
|
140
|
+
Rejected
|
|
141
|
+
Completed
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
model Reminder {
|
|
145
|
+
id String @id @default(cuid())
|
|
146
|
+
creatorId String
|
|
147
|
+
creator User @relation("RemindersCreatedByMe", fields: [creatorId], references: [id], onDelete: Cascade)
|
|
148
|
+
remindWhoId String?
|
|
149
|
+
remindWho User? @relation("RemindersAssignedToMe", fields: [remindWhoId], references: [id], onDelete: Cascade)
|
|
150
|
+
remindDateTime DateTime
|
|
151
|
+
notificationId String
|
|
152
|
+
notification BashNotification @relation(fields: [notificationId], references: [id], onDelete: Cascade)
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
model BashNotification {
|
|
156
|
+
id String @id @default(cuid())
|
|
157
|
+
creatorId String
|
|
158
|
+
creator User @relation("NotificationsCreatedByMe", fields: [creatorId], references: [id], onDelete: Cascade)
|
|
159
|
+
email String
|
|
160
|
+
createdDateTime DateTime @default(now())
|
|
161
|
+
message String
|
|
162
|
+
image String?
|
|
163
|
+
readDateTime DateTime?
|
|
164
|
+
taskId String?
|
|
165
|
+
eventTask EventTask? @relation(fields: [taskId], references: [id], onDelete: Cascade)
|
|
166
|
+
invitationId String?
|
|
167
|
+
invitation Invitation? @relation(fields: [invitationId], references: [id], onDelete: Cascade)
|
|
168
|
+
bashEventId String?
|
|
169
|
+
bashEvent BashEvent? @relation(fields: [bashEventId], references: [id], onDelete: Cascade)
|
|
170
|
+
reminders Reminder[]
|
|
171
|
+
|
|
172
|
+
@@unique([creatorId, email, bashEventId])
|
|
173
|
+
@@unique([creatorId, email, invitationId])
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
model Invitation {
|
|
177
|
+
id String @id @default(cuid())
|
|
178
|
+
creatorId String
|
|
179
|
+
creator User @relation("InvitationsCreatedByMe", fields: [creatorId], references: [id], onDelete: Cascade)
|
|
180
|
+
email String
|
|
181
|
+
sentToId String?
|
|
182
|
+
sentTo User? @relation("InvitationsSentToMe", fields: [sentToId], references: [id], onDelete: Cascade)
|
|
183
|
+
bashEventId String?
|
|
184
|
+
bashEvent BashEvent? @relation(fields: [bashEventId], references: [id], onDelete: Cascade)
|
|
185
|
+
image String?
|
|
186
|
+
phone String?
|
|
187
|
+
name String?
|
|
188
|
+
message String?
|
|
189
|
+
inviteDate DateTime? @default(now())
|
|
190
|
+
acceptedDate DateTime?
|
|
191
|
+
rejectedDate DateTime?
|
|
192
|
+
maybeDate DateTime?
|
|
193
|
+
tickets Ticket[] @relation("TicketsForInvitation")
|
|
194
|
+
bashNotificationsReferencingMe BashNotification[]
|
|
195
|
+
associatedBashReferencingMe AssociatedBash?
|
|
196
|
+
|
|
197
|
+
@@index([email])
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
model BashEvent {
|
|
201
|
+
id String @id @default(cuid())
|
|
202
|
+
title String
|
|
203
|
+
creatorId String
|
|
204
|
+
creator User @relation("CreatedEvent", fields: [creatorId], references: [id], onDelete: Cascade)
|
|
205
|
+
description String?
|
|
206
|
+
eventType String @default("Other")
|
|
207
|
+
startDateTime DateTime? @default(now())
|
|
208
|
+
endDateTime DateTime? @default(now())
|
|
209
|
+
ticketTiers TicketTier[]
|
|
210
|
+
targetAudience TargetAudience?
|
|
211
|
+
amountOfGuests AmountOfGuests?
|
|
212
|
+
recurrence Recurrence?
|
|
213
|
+
vibe String?
|
|
214
|
+
occasion String?
|
|
215
|
+
dress String?
|
|
216
|
+
allowed String?
|
|
217
|
+
notAllowed String?
|
|
218
|
+
nonProfit Boolean?
|
|
219
|
+
nonProfitId String?
|
|
220
|
+
privacy Privacy @default(Public)
|
|
221
|
+
tickets Ticket[]
|
|
222
|
+
reviews Review[]
|
|
223
|
+
sponsorships SponsoredEvent[]
|
|
224
|
+
investments Investment[]
|
|
225
|
+
capacity Int?
|
|
226
|
+
location String?
|
|
227
|
+
status BashStatus @default(Draft)
|
|
228
|
+
tags String[]
|
|
229
|
+
coverPhoto String?
|
|
230
|
+
media Media[]
|
|
231
|
+
club Club? @relation(fields: [clubId], references: [id], onDelete: SetNull)
|
|
232
|
+
clubId String?
|
|
233
|
+
links EventLink[]
|
|
234
|
+
competitions Competition[]
|
|
235
|
+
invitations Invitation[]
|
|
236
|
+
dateTimePublished DateTime?
|
|
237
|
+
comments BashComment[]
|
|
238
|
+
includedItems String[]
|
|
239
|
+
associatedBashesReferencingMe AssociatedBash[]
|
|
240
|
+
bashNotificationsReferencingMe BashNotification[]
|
|
241
|
+
checkouts Checkout[]
|
|
242
|
+
eventTasks EventTask[]
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
model Checkout {
|
|
246
|
+
id String @id @default(cuid())
|
|
247
|
+
ownerId String
|
|
248
|
+
owner User @relation(fields: [ownerId], references: [id], onDelete: Cascade)
|
|
249
|
+
bashEventId String
|
|
250
|
+
bashEvent BashEvent @relation(fields: [bashEventId], references: [id], onDelete: Cascade)
|
|
251
|
+
tickets Ticket[]
|
|
252
|
+
checkoutSessionId String @unique
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
model TicketTier {
|
|
256
|
+
id String @id @default(cuid())
|
|
257
|
+
bashEventId String
|
|
258
|
+
bashEvent BashEvent @relation(fields: [bashEventId], references: [id], onDelete: Cascade)
|
|
259
|
+
tickets Ticket[]
|
|
260
|
+
hidden Boolean?
|
|
261
|
+
price Int @default(0)
|
|
262
|
+
title String @default("Free")
|
|
263
|
+
maximumNumberOfTickets Int @default(100)
|
|
264
|
+
waitList User[]
|
|
265
|
+
|
|
266
|
+
@@unique([bashEventId, title])
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
model Ticket {
|
|
270
|
+
id String @id @default(cuid())
|
|
271
|
+
ownerId String
|
|
272
|
+
owner User @relation("TicketsIOwn", fields: [ownerId], references: [id], onDelete: Cascade)
|
|
273
|
+
bashEventId String
|
|
274
|
+
bashEvent BashEvent @relation(fields: [bashEventId], references: [id], onDelete: Cascade)
|
|
275
|
+
ticketTierId String?
|
|
276
|
+
ticketTier TicketTier? @relation(fields: [ticketTierId], references: [id], onDelete: Cascade)
|
|
277
|
+
validDate DateTime?
|
|
278
|
+
forUserId String?
|
|
279
|
+
forUser User? @relation("TicketsISent", fields: [forUserId], references: [id], onDelete: Cascade)
|
|
280
|
+
fullName String?
|
|
281
|
+
email String?
|
|
282
|
+
paidOn DateTime?
|
|
283
|
+
allowPromiseToPay Boolean?
|
|
284
|
+
status TicketStatus?
|
|
285
|
+
isFreeGuest Boolean?
|
|
286
|
+
geoFenceCheckInUnnecessary Boolean?
|
|
287
|
+
checkedInAt DateTime?
|
|
288
|
+
checkedOutAt DateTime?
|
|
289
|
+
invitationId String?
|
|
290
|
+
invitation Invitation? @relation("TicketsForInvitation", fields: [invitationId], references: [id], onDelete: SetNull)
|
|
291
|
+
checkoutId String?
|
|
292
|
+
checkout Checkout? @relation(fields: [checkoutId], references: [id], onDelete: SetNull)
|
|
293
|
+
|
|
294
|
+
@@index([bashEventId])
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
enum TicketStatus {
|
|
298
|
+
Cancelled
|
|
299
|
+
Attended
|
|
300
|
+
Missed
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
model unusedModelButNeededForSomeTypesToBeDefinedForTypescript {
|
|
304
|
+
id String @id @default(cuid())
|
|
305
|
+
doNotUseVibeEnum BashEventVibeTags @default(Wild)
|
|
306
|
+
doNotUseDressEnum BashEventDressTags @default(Casual)
|
|
307
|
+
doNotUseBashEventType BashEventType @default(Other)
|
|
308
|
+
doNotUseDayOfWeek DayOfWeek @default(Sunday)
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
model Recurrence {
|
|
312
|
+
id String @id @default(cuid())
|
|
313
|
+
interval Int @default(1)
|
|
314
|
+
bashEventId String @unique
|
|
315
|
+
bashEvent BashEvent @relation(fields: [bashEventId], references: [id], onDelete: Cascade)
|
|
316
|
+
frequency RecurringFrequency @default(Never)
|
|
317
|
+
ends DateTime @default(now())
|
|
318
|
+
repeatOnDays DayOfWeek[]
|
|
319
|
+
repeatOnDayOfMonth Int?
|
|
320
|
+
repeatYearlyDate DateTime?
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
enum DayOfWeek {
|
|
324
|
+
Sunday
|
|
325
|
+
Monday
|
|
326
|
+
Tuesday
|
|
327
|
+
Wednesday
|
|
328
|
+
Thursday
|
|
329
|
+
Friday
|
|
330
|
+
Saturday
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
enum RecurringFrequency {
|
|
334
|
+
Never
|
|
335
|
+
Daily
|
|
336
|
+
Weekly
|
|
337
|
+
Monthly
|
|
338
|
+
Yearly
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
enum BashEventVibeTags {
|
|
342
|
+
Wild
|
|
343
|
+
Calm
|
|
344
|
+
SomewhereInBetween
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
enum BashEventDressTags {
|
|
348
|
+
Casual
|
|
349
|
+
BusinessCasual
|
|
350
|
+
Formal
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
enum BashEventType {
|
|
354
|
+
AfterParty
|
|
355
|
+
AnimeAndCosplayFestival
|
|
356
|
+
AnniversaryCelebration
|
|
357
|
+
ArtExhibitOpening
|
|
358
|
+
ArtAndCraftNight
|
|
359
|
+
BBQCookout
|
|
360
|
+
BabyShower
|
|
361
|
+
BachelorOrBacheloretteParty
|
|
362
|
+
BeachParty
|
|
363
|
+
Birthday
|
|
364
|
+
BoatPartyOrCruise
|
|
365
|
+
Bonfire
|
|
366
|
+
BookClubMeeting
|
|
367
|
+
BridalShower
|
|
368
|
+
BrunchGathering
|
|
369
|
+
CarShow
|
|
370
|
+
CarnivalAndFair
|
|
371
|
+
CasinoNight
|
|
372
|
+
CasualMixer
|
|
373
|
+
CharityBall
|
|
374
|
+
CharityFundraiser
|
|
375
|
+
ChristmasParty
|
|
376
|
+
ChurchEvent
|
|
377
|
+
CircusOrCarnivalParty
|
|
378
|
+
CocktailParty
|
|
379
|
+
CollegeParty_FraternityOrSorority
|
|
380
|
+
ComedyShowOrStandUpComedyNight
|
|
381
|
+
ComicConvention
|
|
382
|
+
Competition
|
|
383
|
+
Concert
|
|
384
|
+
CookingCompetition
|
|
385
|
+
CorporateEventOrOfficeParty
|
|
386
|
+
CostumeParty_Theme_Based
|
|
387
|
+
CulturalFestival
|
|
388
|
+
DanceParty
|
|
389
|
+
DesertRave
|
|
390
|
+
DiscoNight
|
|
391
|
+
EasterGathering
|
|
392
|
+
EngagementParty
|
|
393
|
+
ESportsGamingTournament
|
|
394
|
+
ExclusiveLuxuryRetreat
|
|
395
|
+
FantasyThemedParty
|
|
396
|
+
FashionShow
|
|
397
|
+
Fireside
|
|
398
|
+
FitnessFestival
|
|
399
|
+
FlashMob
|
|
400
|
+
Festival
|
|
401
|
+
FestivalFilm
|
|
402
|
+
FestivalFood
|
|
403
|
+
FundraisingEvent
|
|
404
|
+
GalaDinner
|
|
405
|
+
GameNight
|
|
406
|
+
GamingEvent
|
|
407
|
+
GardenParty
|
|
408
|
+
GoingAwayPartyOrFarewell
|
|
409
|
+
GraduationParty
|
|
410
|
+
HalloweenCostumeParty
|
|
411
|
+
HanukkahParty
|
|
412
|
+
HistoricalEraParty
|
|
413
|
+
HolidayParty
|
|
414
|
+
HouseParty
|
|
415
|
+
HousewarmingParty
|
|
416
|
+
KaraokeNight
|
|
417
|
+
KiteFlyingFestival
|
|
418
|
+
LiveBandPerformanceInALocalVenue
|
|
419
|
+
Luau
|
|
420
|
+
MansionParty
|
|
421
|
+
MardiGras
|
|
422
|
+
MasqueradeBall
|
|
423
|
+
MotorcycleRally
|
|
424
|
+
MovieNight
|
|
425
|
+
MoviePremiere
|
|
426
|
+
MusicFestival
|
|
427
|
+
NewYearsEveCelebration
|
|
428
|
+
OpenMicNight
|
|
429
|
+
OutdoorActivity
|
|
430
|
+
OutdoorConcert
|
|
431
|
+
OutdoorMovieNight_WithAProjector
|
|
432
|
+
Parade
|
|
433
|
+
Party
|
|
434
|
+
PoolParty
|
|
435
|
+
Potluck
|
|
436
|
+
PotluckVegan
|
|
437
|
+
PreParty
|
|
438
|
+
ProductLaunch
|
|
439
|
+
ProfessionalNetworkingEvent
|
|
440
|
+
Rave_General
|
|
441
|
+
RetirementCelebration
|
|
442
|
+
Reunion_FamilyOrSchoolOrFriends
|
|
443
|
+
SafariAdventureParty
|
|
444
|
+
SchoolEvent_MiddleSchoolOrHighSchoolOrCollege
|
|
445
|
+
ScienceFictionThemedParty
|
|
446
|
+
SocialClubEvent
|
|
447
|
+
SportsTournament
|
|
448
|
+
SportsWatchParty
|
|
449
|
+
SuperheroThemedParty
|
|
450
|
+
SurfCompetition
|
|
451
|
+
ThanksgivingDinner
|
|
452
|
+
ThemedCostumeParty
|
|
453
|
+
ThemedDinnerParty
|
|
454
|
+
ThemedPubCrawl
|
|
455
|
+
Tournament
|
|
456
|
+
TravelAndTradeShow
|
|
457
|
+
TriviaNight
|
|
458
|
+
ValentinesDayParty
|
|
459
|
+
WeddingReception
|
|
460
|
+
WelcomeHomeParty
|
|
461
|
+
WellnessFestival
|
|
462
|
+
WineTastingEvent
|
|
463
|
+
Other
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
model CustomBashEventType {
|
|
467
|
+
id String @id @default(cuid())
|
|
468
|
+
key String @unique
|
|
469
|
+
displayName String
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
model AmountOfGuests {
|
|
473
|
+
id String @id @default(cuid())
|
|
474
|
+
bashEventId String @unique
|
|
475
|
+
bashEvent BashEvent @relation(fields: [bashEventId], references: [id], onDelete: Cascade)
|
|
476
|
+
minimum Int? @default(10)
|
|
477
|
+
ideal Int? @default(35)
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
enum Privacy {
|
|
481
|
+
Public
|
|
482
|
+
ConnectionsOnly
|
|
483
|
+
InviteOnly
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
model TargetAudience {
|
|
487
|
+
id String @id @default(cuid())
|
|
488
|
+
bashEventId String @unique
|
|
489
|
+
bashEvent BashEvent @relation(fields: [bashEventId], references: [id], onDelete: Cascade)
|
|
490
|
+
ageRange AgeRange @default(NoPreference)
|
|
491
|
+
gender Gender @default(NoPreference)
|
|
492
|
+
occupation Occupation @default(NoPreference)
|
|
493
|
+
education Education @default(NoPreference)
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
enum AgeRange {
|
|
497
|
+
Eighteen_24
|
|
498
|
+
TwentyFive_34
|
|
499
|
+
ThirtyFive_49
|
|
500
|
+
FiftyPlus
|
|
501
|
+
NoPreference
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
enum Occupation {
|
|
505
|
+
Student
|
|
506
|
+
Professional
|
|
507
|
+
Retired
|
|
508
|
+
NoPreference
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
enum Education {
|
|
512
|
+
HighSchool
|
|
513
|
+
InCollege
|
|
514
|
+
Bachelors
|
|
515
|
+
Masters
|
|
516
|
+
Doctorate
|
|
517
|
+
NoPreference
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
enum BashStatus {
|
|
521
|
+
Draft
|
|
522
|
+
PreSale
|
|
523
|
+
Published
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
model DocumentID {
|
|
527
|
+
id String @id @default(cuid())
|
|
528
|
+
givenName String?
|
|
529
|
+
familyName String?
|
|
530
|
+
middleName String?
|
|
531
|
+
suffix String?
|
|
532
|
+
streetAddress String?
|
|
533
|
+
city String?
|
|
534
|
+
state String?
|
|
535
|
+
stateName String?
|
|
536
|
+
postalCode String?
|
|
537
|
+
idNumber String?
|
|
538
|
+
expires String?
|
|
539
|
+
dob String?
|
|
540
|
+
issueDate String?
|
|
541
|
+
idType String?
|
|
542
|
+
userId String? @unique
|
|
543
|
+
user User? @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
model EventLink {
|
|
547
|
+
id String @id @default(cuid())
|
|
548
|
+
link Link @relation(fields: [linkId], references: [id], onDelete: Cascade)
|
|
549
|
+
bashEvent BashEvent @relation(fields: [bashEventId], references: [id], onDelete: Cascade)
|
|
550
|
+
linkId String
|
|
551
|
+
bashEventId String
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
enum Gender {
|
|
555
|
+
Male
|
|
556
|
+
Female
|
|
557
|
+
Other
|
|
558
|
+
NoPreference
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
model Investment {
|
|
562
|
+
id String @id @default(cuid())
|
|
563
|
+
investorId String
|
|
564
|
+
bashEventId String
|
|
565
|
+
investor User @relation(fields: [investorId], references: [id], onDelete: Cascade)
|
|
566
|
+
bashEvent BashEvent @relation(fields: [bashEventId], references: [id], onDelete: Cascade)
|
|
567
|
+
amount Float
|
|
568
|
+
type InvestmentType
|
|
569
|
+
paidOn String?
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
enum InvestmentType {
|
|
573
|
+
Equity
|
|
574
|
+
Event
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
model Link {
|
|
578
|
+
id String @id @default(cuid())
|
|
579
|
+
url String
|
|
580
|
+
type String
|
|
581
|
+
icon String?
|
|
582
|
+
vendorLinks VendorLink[]
|
|
583
|
+
eventLinks EventLink[]
|
|
584
|
+
userLinks UserLink[]
|
|
585
|
+
serviceLinks ServiceLink[]
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
model Media {
|
|
589
|
+
id String @id @default(cuid())
|
|
590
|
+
url String @unique
|
|
591
|
+
type MediaType
|
|
592
|
+
mimetype String?
|
|
593
|
+
bashEventsReferencingMe BashEvent[]
|
|
594
|
+
businessesReferencingMe Business[]
|
|
595
|
+
sponsoredEventsReferencingMe SponsoredEvent[]
|
|
596
|
+
servicesReferencingMe Service[]
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
enum MediaType {
|
|
600
|
+
Unknown
|
|
601
|
+
Empty
|
|
602
|
+
Image
|
|
603
|
+
Video
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
model Prize {
|
|
607
|
+
id String @id @default(cuid())
|
|
608
|
+
prizeWorth Float?
|
|
609
|
+
prizeType PrizeType
|
|
610
|
+
name String
|
|
611
|
+
prizeLevel Int
|
|
612
|
+
description String
|
|
613
|
+
competition Competition? @relation(fields: [competitionId], references: [id], onDelete: SetNull)
|
|
614
|
+
competitionId String?
|
|
615
|
+
paidOn String?
|
|
616
|
+
winner User? @relation(fields: [winnerUserId], references: [id], onDelete: Cascade)
|
|
617
|
+
winnerUserId String?
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
enum PrizeType {
|
|
621
|
+
Monetary
|
|
622
|
+
Merchandise
|
|
623
|
+
Service
|
|
624
|
+
Combo
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
model Review {
|
|
628
|
+
id String @id @default(cuid())
|
|
629
|
+
rating Int
|
|
630
|
+
creatorId String
|
|
631
|
+
creator User @relation(fields: [creatorId], references: [id], onDelete: Cascade)
|
|
632
|
+
bashEventId String
|
|
633
|
+
bashEvent BashEvent @relation(fields: [bashEventId], references: [id], onDelete: Cascade)
|
|
634
|
+
comments BashComment[]
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
model Session {
|
|
638
|
+
id String @id @default(cuid())
|
|
639
|
+
sessionToken String @unique
|
|
640
|
+
userId String
|
|
641
|
+
expires DateTime
|
|
642
|
+
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
643
|
+
|
|
644
|
+
@@index([userId])
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
enum Sex {
|
|
648
|
+
Male
|
|
649
|
+
Female
|
|
650
|
+
Other
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
model SponsoredEvent {
|
|
654
|
+
id String @id @default(cuid())
|
|
655
|
+
amount Float?
|
|
656
|
+
paidOn String?
|
|
657
|
+
sponsorType SponsorType
|
|
658
|
+
sponsorId String
|
|
659
|
+
bashEventId String
|
|
660
|
+
sponsor User @relation(fields: [sponsorId], references: [id], onDelete: Cascade)
|
|
661
|
+
bashEvent BashEvent @relation(fields: [bashEventId], references: [id], onDelete: Cascade)
|
|
662
|
+
media Media[]
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
enum SponsorType {
|
|
666
|
+
Marketing
|
|
667
|
+
Giveaway
|
|
668
|
+
Awareness
|
|
669
|
+
Trade
|
|
670
|
+
CompetitionPrizeProvider
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
model User {
|
|
674
|
+
id String @id @default(cuid())
|
|
675
|
+
email String @unique
|
|
676
|
+
createdOn DateTime @default(now())
|
|
677
|
+
stripeCustomerId String? @unique
|
|
678
|
+
stripeAccountId String? @unique
|
|
679
|
+
googleCalendarAccess String?
|
|
680
|
+
username String?
|
|
681
|
+
fullName String?
|
|
682
|
+
givenName String?
|
|
683
|
+
familyName String?
|
|
684
|
+
hash String?
|
|
685
|
+
emailVerified DateTime?
|
|
686
|
+
image String?
|
|
687
|
+
uploadedImage String?
|
|
688
|
+
dob DateTime?
|
|
689
|
+
gender Gender?
|
|
690
|
+
sex Sex?
|
|
691
|
+
roles UserRole[] @default([User])
|
|
692
|
+
services Service[]
|
|
693
|
+
createdEvents BashEvent[] @relation("CreatedEvent")
|
|
694
|
+
ticketsISent Ticket[] @relation("TicketsISent")
|
|
695
|
+
ticketsIOwn Ticket[] @relation("TicketsIOwn")
|
|
696
|
+
reviews Review[]
|
|
697
|
+
sponsorships SponsoredEvent[]
|
|
698
|
+
investments Investment[]
|
|
699
|
+
accounts Account[]
|
|
700
|
+
sessions Session[]
|
|
701
|
+
eventTasks EventTask[]
|
|
702
|
+
vendors Vendor[]
|
|
703
|
+
clubMembers ClubMember[]
|
|
704
|
+
clubAdmins ClubAdmin[]
|
|
705
|
+
links UserLink[]
|
|
706
|
+
status UserStatus
|
|
707
|
+
competitions Competition[]
|
|
708
|
+
competitionSponsorships CompetitionSponsor[]
|
|
709
|
+
competitionPrizes Prize[]
|
|
710
|
+
userRatingGiven UserRatingGiven[]
|
|
711
|
+
userRating UserRating[]
|
|
712
|
+
magicLink String?
|
|
713
|
+
magicLinkExpiration DateTime?
|
|
714
|
+
magicLinkUsed DateTime?
|
|
715
|
+
idVerified DateTime?
|
|
716
|
+
streetAddress String?
|
|
717
|
+
city String?
|
|
718
|
+
state String?
|
|
719
|
+
postalCode String?
|
|
720
|
+
country String? @default("US")
|
|
721
|
+
phone String?
|
|
722
|
+
documentIDId String? @unique
|
|
723
|
+
documentID DocumentID?
|
|
724
|
+
comment BashComment[]
|
|
725
|
+
associatedBashes AssociatedBash[]
|
|
726
|
+
invitationsCreatedByMe Invitation[] @relation("InvitationsCreatedByMe")
|
|
727
|
+
invitationsSentToMe Invitation[] @relation("InvitationsSentToMe")
|
|
728
|
+
notificationsCreatedByMe BashNotification[] @relation("NotificationsCreatedByMe")
|
|
729
|
+
remindersCreatedByMe Reminder[] @relation("RemindersCreatedByMe")
|
|
730
|
+
remindersAssignedToMe Reminder[] @relation("RemindersAssignedToMe")
|
|
731
|
+
eventTasksAssignedToMe EventTask[] @relation("TasksAssignedToMe")
|
|
732
|
+
checkouts Checkout[]
|
|
733
|
+
ticketTiersWaitListsIveJoined TicketTier[]
|
|
734
|
+
contacts Contact[]
|
|
735
|
+
contactsReferencingMe Contact[] @relation("ContactsReferencingMe")
|
|
736
|
+
}
|
|
737
|
+
|
|
738
|
+
model Contact {
|
|
739
|
+
id String @id @default(cuid())
|
|
740
|
+
contactOwnerId String
|
|
741
|
+
contactOwner User @relation(fields: [contactOwnerId], references: [id], onDelete: Cascade)
|
|
742
|
+
email String?
|
|
743
|
+
fullName String?
|
|
744
|
+
phone String?
|
|
745
|
+
contactUserId String?
|
|
746
|
+
contactUser User? @relation("ContactsReferencingMe", fields: [contactUserId], references: [id], onDelete: Cascade)
|
|
747
|
+
requestToConnectSent DateTime?
|
|
748
|
+
requestToConnectAccepted DateTime?
|
|
749
|
+
|
|
750
|
+
@@unique([contactOwnerId, email])
|
|
751
|
+
@@index([email])
|
|
752
|
+
}
|
|
753
|
+
|
|
754
|
+
model AssociatedBash {
|
|
755
|
+
id String @id @default(cuid())
|
|
756
|
+
bashEventId String
|
|
757
|
+
bashEvent BashEvent @relation(fields: [bashEventId], references: [id], onDelete: Cascade)
|
|
758
|
+
invitationId String? @unique
|
|
759
|
+
invitation Invitation? @relation(fields: [invitationId], references: [id])
|
|
760
|
+
ownerEmail String?
|
|
761
|
+
ownerUserId String?
|
|
762
|
+
owner User? @relation(fields: [ownerUserId], references: [id], onDelete: Cascade)
|
|
763
|
+
isOrganizer Boolean?
|
|
764
|
+
isFavorite Boolean?
|
|
765
|
+
|
|
766
|
+
@@unique([ownerEmail, bashEventId])
|
|
767
|
+
}
|
|
768
|
+
|
|
769
|
+
model Service {
|
|
770
|
+
id String @id @default(cuid())
|
|
771
|
+
ownerId String
|
|
772
|
+
owner User @relation(fields: [ownerId], references: [id], onDelete: Cascade)
|
|
773
|
+
name String?
|
|
774
|
+
coverPhoto String?
|
|
775
|
+
media Media[]
|
|
776
|
+
serviceType ServiceType
|
|
777
|
+
subServiceType String?
|
|
778
|
+
serviceLinks ServiceLink[]
|
|
779
|
+
address String
|
|
780
|
+
description String?
|
|
781
|
+
canContact Boolean?
|
|
782
|
+
genre GenreType?
|
|
783
|
+
}
|
|
784
|
+
|
|
785
|
+
enum GenreType {
|
|
786
|
+
Classical
|
|
787
|
+
Rock
|
|
788
|
+
HipHop
|
|
789
|
+
Country
|
|
790
|
+
Pop
|
|
791
|
+
EDM
|
|
792
|
+
Indie
|
|
793
|
+
Acoustic
|
|
794
|
+
}
|
|
795
|
+
|
|
796
|
+
enum ServiceType {
|
|
797
|
+
EventService
|
|
798
|
+
EntertainmentService
|
|
799
|
+
Volunteer
|
|
800
|
+
PartnerService
|
|
801
|
+
Venue
|
|
802
|
+
}
|
|
803
|
+
|
|
804
|
+
enum UserRole {
|
|
805
|
+
User
|
|
806
|
+
Vendor
|
|
807
|
+
Sponsor
|
|
808
|
+
Investor
|
|
809
|
+
LoanProvider
|
|
810
|
+
VenueProvider
|
|
811
|
+
ServiceProvider
|
|
812
|
+
SuperAdmin
|
|
813
|
+
Exhibitor
|
|
814
|
+
}
|
|
815
|
+
|
|
816
|
+
model UserLink {
|
|
817
|
+
id String @id @default(cuid())
|
|
818
|
+
link Link @relation(fields: [linkId], references: [id], onDelete: Cascade)
|
|
819
|
+
linkId String
|
|
820
|
+
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
821
|
+
userId String
|
|
822
|
+
}
|
|
823
|
+
|
|
824
|
+
model UserRating {
|
|
825
|
+
id String @id @default(cuid())
|
|
826
|
+
rating Int
|
|
827
|
+
comment String?
|
|
828
|
+
givenBy UserRatingGiven @relation(fields: [userRatingGivenId], references: [id], onDelete: Cascade)
|
|
829
|
+
userRatingGivenId String
|
|
830
|
+
givenTo User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
831
|
+
userId String
|
|
832
|
+
}
|
|
833
|
+
|
|
834
|
+
model UserRatingGiven {
|
|
835
|
+
id String @id @default(cuid())
|
|
836
|
+
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
837
|
+
userId String
|
|
838
|
+
UserRating UserRating[]
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
enum UserStatus {
|
|
842
|
+
Active
|
|
843
|
+
Inactive
|
|
844
|
+
Suspended
|
|
845
|
+
Deactivated
|
|
846
|
+
}
|
|
847
|
+
|
|
848
|
+
model VerificationToken {
|
|
849
|
+
identifier String
|
|
850
|
+
token String @unique
|
|
851
|
+
expires DateTime
|
|
852
|
+
|
|
853
|
+
@@unique([identifier, token])
|
|
854
|
+
}
|
|
855
|
+
|
|
856
|
+
model Vendor {
|
|
857
|
+
id String @id @default(cuid())
|
|
858
|
+
owner User @relation(fields: [ownerId], references: [id], onDelete: Cascade)
|
|
859
|
+
ownerId String
|
|
860
|
+
type String
|
|
861
|
+
amount Float?
|
|
862
|
+
paidOn String?
|
|
863
|
+
links VendorLink[]
|
|
864
|
+
}
|
|
865
|
+
|
|
866
|
+
model VendorLink {
|
|
867
|
+
id String @id @default(cuid())
|
|
868
|
+
link Link @relation(fields: [linkId], references: [id], onDelete: Cascade)
|
|
869
|
+
vendor Vendor @relation(fields: [vendorId], references: [id], onDelete: Cascade)
|
|
870
|
+
linkId String
|
|
871
|
+
vendorId String
|
|
872
|
+
}
|
|
873
|
+
|
|
874
|
+
model ServiceLink {
|
|
875
|
+
id String @id @default(cuid())
|
|
876
|
+
service Service @relation(fields: [servicesId], references: [id], onDelete: Cascade)
|
|
877
|
+
link Link @relation(fields: [linkId], references: [id], onDelete: Cascade)
|
|
878
|
+
servicesId String
|
|
879
|
+
linkId String
|
|
880
|
+
}
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
// TODO: Move everything here to common repo along with prisma interface ext interfaces
|
|
2
|
+
import {TicketTier} from "@prisma/client";
|
|
3
|
+
|
|
4
|
+
export const GOOGLE_CALLBACK_URL = '/auth/google/callback' as const;
|
|
5
|
+
export const CHECKOUT_RETURN_SUCCESS_URL = `/checkout-return/success/{CHECKOUT_SESSION_ID}` as const;
|
|
6
|
+
export const CHECKOUT_RETURN_CANCEL_URL = `/checkout-return/cancel/{CHECKOUT_SESSION_ID}` as const;
|
|
7
|
+
export const VERIFICATION_RETURN_URL = `/sign-up` as const
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
export const MIN_AMOUNT_OF_TICKETS_FOR_PUBLIC_EVENT_TO_SHOW = 0 as const;
|
|
12
|
+
export const DEFAULT_MAX_NUMBER_OF_TICKETS = 35 as const
|
|
13
|
+
|
|
14
|
+
export const MAX_NUMBER_OF_FREE_TICKETS_PER_USER_FOR_A_BASH_EVENT = 100 as const;
|
|
15
|
+
export const MAX_NUMBER_OF_TICKETS_PER_REQUEST_FOR_A_BASH_EVENT = 50 as const;
|
|
16
|
+
|
|
17
|
+
export const MONTHS_PREVIOUS_THAT_STRIPE_ACCOUNTS_WILL_BE_SEARCHED_BY_EMAIL = 1 as const;
|
|
18
|
+
|
|
19
|
+
export const HTTP_CODE_OK = 200 as const;
|
|
20
|
+
export const HTTP_CODE_TEMPORARY_REDIRECT = 307 as const;
|
|
21
|
+
export const HTTP_CODE_INTERNAL_SERVER_ERR = 500 as const
|
|
22
|
+
export const HTTP_CODE_BAD_REQUEST = 400 as const;
|
|
23
|
+
export const HTTP_CODE_UNAUTHORIZED = 401 as const;
|
|
24
|
+
export const HTTP_CODE_NOT_FOUND = 404 as const;
|
|
25
|
+
export const ERR_UNAUTHORIZED_REQUEST = "Unauthorized to perform requested action. Have you logged in?" as const;
|
|
26
|
+
|
|
27
|
+
export const URL_PARAMS_BASH_EVENT_ID = 'bashEventId' as const;
|
|
28
|
+
export const URL_PARAMS_BASH_EVENT_TITLE = 'bashEventId' as const;
|
|
29
|
+
export const URL_PARAMS_BASH_EVENT_DESC = 'bashEventDesc' as const;
|
|
30
|
+
export const URL_PARAMS_BASH_EVENT_COVER_PHOTO = 'bashEventCoverPhoto' as const;
|
|
31
|
+
export const URL_PARAMS_EMAIL = 'email' as const;
|
|
32
|
+
export const URL_PARAMS_OTP_CODE = 'code' as const;
|
|
33
|
+
export const URL_PARAMS_INCLUDE = 'include' as const;
|
|
34
|
+
|
|
35
|
+
export const URL_INCLUDE_QUERY_PARAM_DELIM = ',' as const;
|
|
36
|
+
export const URL_INCLUDE_PRISMA_DATA_KEYS_DELIM = '.' as const;
|
|
37
|
+
|
|
38
|
+
export const DEFAULT_PRISMA_TTL_SECONDS = 60 as const;
|
|
39
|
+
export const PRISMA_MEDIA_TTL_SECONDS = 60 * 5; // 5 hours
|
|
40
|
+
export const PRISMA_USER_TTL_SECONDS = 60 * 7; // 7 hours
|
|
41
|
+
export const PRISMA_BASH_EVENT_TTL_SECONDS = 60 as const;
|
|
42
|
+
|
|
43
|
+
export const MIN_PASSWORD_LENGTH = 10;
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
export type DateTimeArgType = Date | string | undefined | null;
|
|
47
|
+
export type RecordKey = string | number | symbol;
|
|
48
|
+
export type PartialExcept<T, K extends keyof T> = Partial<T> & {[P in K]: T[P]};
|
|
49
|
+
type GetTypeOfArray<T> = T extends (infer U)[] ? U : never;
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
const ASSET_MIME_TYPES_TO_EXT = {
|
|
53
|
+
'image/jpeg': '.jpeg',
|
|
54
|
+
'image/png': '.png',
|
|
55
|
+
'image/gif': '.gif',
|
|
56
|
+
'image/bmp': '.bmp',
|
|
57
|
+
'image/webp': '.webp',
|
|
58
|
+
'image/svg+xml': '.svg',
|
|
59
|
+
'image/tiff': '.tiff',
|
|
60
|
+
'image/vnd': '.ico',
|
|
61
|
+
'video/mp4': '.mp4',
|
|
62
|
+
// '.webm',
|
|
63
|
+
// '.ogg',
|
|
64
|
+
// '.avi',
|
|
65
|
+
// '.mov',
|
|
66
|
+
// '.mkv'
|
|
67
|
+
};
|
|
68
|
+
export const VALID_ASSET_MIME_TYPES = Object.keys(ASSET_MIME_TYPES_TO_EXT);
|
|
69
|
+
|
|
70
|
+
export interface NumberOfTicketsForDate {
|
|
71
|
+
numberOfTickets: number;
|
|
72
|
+
ticketDateTime: DateTimeArgType;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export interface AvailableTicketsForTicketTier {
|
|
76
|
+
ticketTier: TicketTier;
|
|
77
|
+
availableTickets: NumberOfTicketsForDate[];
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export interface SignInEmailWithCode {
|
|
81
|
+
email: string;
|
|
82
|
+
code: string;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export enum ApiErrorType {
|
|
86
|
+
Unknown = 1,
|
|
87
|
+
UserAlreadyHasMaximumAllowedFreeTicketsForBashEvent,
|
|
88
|
+
BashHasNoMoreTicketsAvailable,
|
|
89
|
+
NotEnoughTicketsAvailable,
|
|
90
|
+
UserExceededMaxTicketNumberForOneRequest,
|
|
91
|
+
UserDoesNotExist,
|
|
92
|
+
StripeCreateCheckoutSessionFailed,
|
|
93
|
+
StripeUserInfoIncomplete,
|
|
94
|
+
TicketsAlreadyPurchasedUsingThisCheckoutSession,
|
|
95
|
+
StripeAccountHasNotSetupTaxData,
|
|
96
|
+
StripeCheckoutSessionIncomplete
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export const StripeErrorToApiErrorType = {
|
|
100
|
+
"stripe_tax_inactive": ApiErrorType.StripeAccountHasNotSetupTaxData
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export type ErrorDataType = Record<RecordKey, any>;
|
|
104
|
+
export interface ApiResult<T, P extends ErrorDataType = ErrorDataType> {
|
|
105
|
+
data?: T;
|
|
106
|
+
token?: string;
|
|
107
|
+
error?: string;
|
|
108
|
+
errorType?: ApiErrorType;
|
|
109
|
+
errorData?: P;
|
|
110
|
+
details?: string;
|
|
111
|
+
message?: string;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export interface StripeCreateCheckoutSessionArgs {
|
|
115
|
+
currency: string;
|
|
116
|
+
paymentMethodType: string;
|
|
117
|
+
ticketListStr: string;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export interface StripeSessionRedirect {
|
|
121
|
+
redirectUrl: string;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export interface StripeConfirmPayment {
|
|
125
|
+
checkoutSessionId: string;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export interface StripeAccountLinkArgs {
|
|
129
|
+
userId: string;
|
|
130
|
+
returnUrl: string;
|
|
131
|
+
refreshUrl: string;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export interface StripeConfirmPaymentResult {
|
|
135
|
+
bashEventId: string;
|
|
136
|
+
numberOfTickets: number;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
export interface IMediaUploadArgs {
|
|
140
|
+
mimetype: string;
|
|
141
|
+
idOfLinkedPrismaEntry: string;
|
|
142
|
+
assetKey: string;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export interface IPreSignedUrlArgs {
|
|
146
|
+
assetKey: string;
|
|
147
|
+
mimetype: string;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
export interface IPreSignedUrlResult {
|
|
151
|
+
assetKey: string;
|
|
152
|
+
preSignedUrl: string | undefined;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
export type AllKeysUnionOfDescendants<T> = T extends object
|
|
156
|
+
? T[keyof T] extends infer K
|
|
157
|
+
? K extends string | number | symbol
|
|
158
|
+
? {[K in keyof T]-?: T[K] extends any[]
|
|
159
|
+
? GetTypeOfArray<T[K]> extends Record<RecordKey, any>
|
|
160
|
+
? `${K & string}` | `${AllKeysUnion<GetTypeOfArray<T[K]>>}`
|
|
161
|
+
: never
|
|
162
|
+
: `${K & string}` | `${AllKeysUnion<T[K]>}`}[keyof T]
|
|
163
|
+
: never
|
|
164
|
+
: never
|
|
165
|
+
: never;
|
|
166
|
+
|
|
167
|
+
export type AllKeysOfDescendants<T> = AllKeysUnionOfDescendants<T>[];
|
|
168
|
+
|
|
169
|
+
type AllKeysUnion<T> = T extends object
|
|
170
|
+
? T[keyof T] extends infer K
|
|
171
|
+
? K extends string | number | symbol
|
|
172
|
+
? {[K in keyof T]-?: T[K] extends any[]
|
|
173
|
+
? GetTypeOfArray<T[K]> extends Record<RecordKey, any>
|
|
174
|
+
? `${K & string}` | `${K & string}${typeof URL_INCLUDE_PRISMA_DATA_KEYS_DELIM}${AllKeysUnion<GetTypeOfArray<T[K]>> & string}`
|
|
175
|
+
: never
|
|
176
|
+
: T[K] extends Function
|
|
177
|
+
? never
|
|
178
|
+
: `${K & string}` | `${K & string}${typeof URL_INCLUDE_PRISMA_DATA_KEYS_DELIM}${AllKeysUnion<T[K]> & string}`}[keyof T]
|
|
179
|
+
: never
|
|
180
|
+
: never
|
|
181
|
+
: never;
|
|
182
|
+
|
|
183
|
+
export type AllKeys<T> = AllKeysUnion<T>[];
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AmountOfGuests,
|
|
3
|
+
EventTask,
|
|
4
|
+
AssociatedBash,
|
|
5
|
+
BashEvent,
|
|
6
|
+
Invitation,
|
|
7
|
+
TargetAudience,
|
|
8
|
+
Ticket,
|
|
9
|
+
User,
|
|
10
|
+
TicketTier, Service, Review, Media, BashComment, Recurrence, Contact
|
|
11
|
+
} from "@prisma/client";
|
|
12
|
+
import {RecordKey} from "./definitions";
|
|
13
|
+
|
|
14
|
+
// TODO: Get this to work
|
|
15
|
+
type PrismaInclude<T extends Record<RecordKey, unknown>> = {[key in keyof T]: boolean | {include: T[key]}};
|
|
16
|
+
|
|
17
|
+
export interface BashEventExt extends BashEvent {
|
|
18
|
+
targetAudience?: TargetAudience;
|
|
19
|
+
amountOfGuests?: AmountOfGuests;
|
|
20
|
+
recurrence?: Recurrence;
|
|
21
|
+
creator?: User;
|
|
22
|
+
ticketTiers: TicketTierExt[];
|
|
23
|
+
media: Media[];
|
|
24
|
+
eventTasks: EventTask[];
|
|
25
|
+
tickets?: Ticket[]; // Only include tickets that the user has purchased and not all tickets (could be thousands + privacy)
|
|
26
|
+
// Do not include in fetch. Could be hundreds of these
|
|
27
|
+
invitations: InvitationExt[];
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export const BASH_EVENT_DATA_TO_INCLUDE = {
|
|
31
|
+
targetAudience: true,
|
|
32
|
+
amountOfGuests: true,
|
|
33
|
+
recurrence: true,
|
|
34
|
+
ticketTiers: true,
|
|
35
|
+
creator: true,
|
|
36
|
+
eventTasks: true,
|
|
37
|
+
media: true
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export const BASH_EVENT_DATA_TO_CLONE = [
|
|
41
|
+
'targetAudience',
|
|
42
|
+
'amountOfGuests',
|
|
43
|
+
'ticketTiers',
|
|
44
|
+
'media',
|
|
45
|
+
'recurrence',
|
|
46
|
+
'invitations',
|
|
47
|
+
] as const;
|
|
48
|
+
|
|
49
|
+
type RemoveCommonProperties<T, U> = keyof (Omit<T, keyof U> & Omit<U, keyof T>);
|
|
50
|
+
type UnionFromArray<T extends ReadonlyArray<any>> = T[number];
|
|
51
|
+
type BashEventExtMinusDataToCloneType = Omit<BashEventExt, UnionFromArray<typeof BASH_EVENT_DATA_TO_CLONE>>;
|
|
52
|
+
|
|
53
|
+
export const BASH_EVENT_DATA_TO_REMOVE: RemoveCommonProperties<BashEvent, BashEventExtMinusDataToCloneType>[] = [
|
|
54
|
+
'creator',
|
|
55
|
+
'eventTasks',
|
|
56
|
+
'tickets'
|
|
57
|
+
];
|
|
58
|
+
|
|
59
|
+
export interface InvitationExt extends Invitation {
|
|
60
|
+
creator: User;
|
|
61
|
+
sentTo: User;
|
|
62
|
+
tickets: Ticket[];
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export const INVITATION_DATA_TO_INCLUDE = {
|
|
66
|
+
creator: true,
|
|
67
|
+
sentTo: true,
|
|
68
|
+
tickets: true
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export interface InvitationExtraData extends Invitation {
|
|
72
|
+
isFreeGuest?: boolean;
|
|
73
|
+
isOrganizer?: boolean;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export interface AssociatedBashExt extends AssociatedBash {
|
|
77
|
+
bashEvent: BashEventExt;
|
|
78
|
+
invitation: InvitationExt;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
export const ASSOCIATED_BASH_DATA_TO_INCLUDE = {
|
|
83
|
+
bashEvent: {
|
|
84
|
+
include: BASH_EVENT_DATA_TO_INCLUDE
|
|
85
|
+
},
|
|
86
|
+
invitation: {
|
|
87
|
+
include: INVITATION_DATA_TO_INCLUDE
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export interface TicketTierExt extends TicketTier {
|
|
92
|
+
bashEvent: BashEvent;
|
|
93
|
+
tickets: TicketExt[];
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export interface TicketExt extends Ticket {
|
|
97
|
+
owner: User;
|
|
98
|
+
forUser: User;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export interface ReviewExt extends Review {
|
|
102
|
+
comments: BashComment[];
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export interface UserExtraData extends User {
|
|
106
|
+
password: string;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export interface UserExt extends User {
|
|
110
|
+
services: Service[];
|
|
111
|
+
|
|
112
|
+
// Do not include in fetch as there could be thousands of these
|
|
113
|
+
associatedBashes?: AssociatedBash[]
|
|
114
|
+
reviews?: ReviewExt[];
|
|
115
|
+
contacts?: Contact[];
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export const USER_DATA_TO_INCLUDE = {
|
|
119
|
+
services: true,
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export const USER_DATA_SELECT_REVIEWS_COMMENTS = {
|
|
123
|
+
reviews: {
|
|
124
|
+
include: {
|
|
125
|
+
comments: true
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export const PUBLIC_USER_DATA_TO_SELECT = {
|
|
131
|
+
id: true,
|
|
132
|
+
email: true,
|
|
133
|
+
givenName: true,
|
|
134
|
+
familyName: true,
|
|
135
|
+
fullName: true,
|
|
136
|
+
username: true,
|
|
137
|
+
image: true,
|
|
138
|
+
uploadedImage: true,
|
|
139
|
+
services: true,
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
export type Public_User = Pick<UserExt, keyof typeof PUBLIC_USER_DATA_TO_SELECT>
|
|
143
|
+
& Partial<Pick<UserExt, keyof typeof USER_DATA_SELECT_REVIEWS_COMMENTS>>;
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES5",
|
|
4
|
+
"outDir": "./dist",
|
|
5
|
+
"rootDir": "./src",
|
|
6
|
+
"strict": true,
|
|
7
|
+
"esModuleInterop": true,
|
|
8
|
+
"moduleResolution": "node",
|
|
9
|
+
"skipLibCheck": true,
|
|
10
|
+
"forceConsistentCasingInFileNames": true,
|
|
11
|
+
"jsx": "react-jsx",
|
|
12
|
+
"noEmit": true,
|
|
13
|
+
"noImplicitAny": true,
|
|
14
|
+
"sourceMap": true
|
|
15
|
+
},
|
|
16
|
+
"include": ["src/**/*.ts", "src/**/*.tsx"],
|
|
17
|
+
"exclude": ["node_modules"]
|
|
18
|
+
}
|