@bash-app/bash-common 21.1.0 → 21.2.1

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.
@@ -1,361 +1,361 @@
1
- import {
2
- AmountOfGuests,
3
- EventTask,
4
- AssociatedBash,
5
- BashEvent,
6
- Invitation,
7
- Ticket,
8
- User,
9
- TicketTier, Business, Review, Media, BashComment, Recurrence, Contact,
10
- BashNotification, BashEventPromoCode,
11
- Reminder,
12
- Checkout,
13
- ServiceLink,
14
- Link, Venue, Availability,
15
- TargetAudience,
16
- ServiceStatus,
17
- Vendor,
18
- EventService,
19
- EntertainmentService,
20
- Exhibitor,
21
- Sponsor,
22
- Organization,
23
- Booking,
24
- VolunteerService, Prisma,
25
- } from "@prisma/client";
26
- import {UnionFromArray} from "./definitions";
27
-
28
- export const FRONT_END_USER_DATA_TO_SELECT = {
29
- id: true,
30
- email: true,
31
- givenName: true,
32
- familyName: true,
33
- image: true,
34
- uploadedImage: true,
35
- } satisfies Prisma.UserSelect;
36
-
37
- export const PRIVATE_USER_ACCOUNT_TO_SELECT = {
38
- ...FRONT_END_USER_DATA_TO_SELECT,
39
- street: true,
40
- city: true,
41
- state: true,
42
- zipCode: true,
43
- country: true,
44
- phone: true,
45
- } satisfies Prisma.UserSelect;
46
-
47
- export interface BashEventExt extends BashEvent {
48
- targetAudience?: TargetAudience;
49
- amountOfGuests?: AmountOfGuests;
50
- recurrence?: Recurrence;
51
- creator?: PublicUser;
52
- ticketTiers: TicketTierExt[];
53
- media: Media[];
54
- eventTasks: EventTask[];
55
- tickets?: Ticket[]; // Only include tickets that the user has purchased and not all tickets (could be thousands + privacy)
56
- // Do not include in fetch. Could be hundreds of these
57
- invitations: InvitationExt[];
58
- }
59
-
60
- export const TICKET_TIER_DATA_TO_INCLUDE = {
61
- promoCodes: true,
62
- } satisfies Prisma.TicketTierInclude;
63
-
64
- export const BASH_EVENT_DATA_TO_INCLUDE = {
65
- creator: {
66
- select: FRONT_END_USER_DATA_TO_SELECT
67
- },
68
- targetAudience: true,
69
- amountOfGuests: true,
70
- recurrence: true,
71
- ticketTiers: {
72
- include: TICKET_TIER_DATA_TO_INCLUDE
73
- },
74
- eventTasks: true,
75
- media: true,
76
- } satisfies Prisma.BashEventInclude;
77
-
78
- export const BASH_EVENT_DATA_TO_CLONE = [
79
- 'ticketTiers',
80
- 'media',
81
- 'recurrence',
82
- 'invitations',
83
- ] as const;
84
-
85
- type RemoveCommonProperties<T, U> = keyof (Omit<T, keyof U> & Omit<U, keyof T>);
86
- type BashEventExtMinusDataToCloneType = Omit<BashEventExt, UnionFromArray<typeof BASH_EVENT_DATA_TO_CLONE>>;
87
-
88
- export const BASH_EVENT_DATA_TO_REMOVE: RemoveCommonProperties<BashEvent, BashEventExtMinusDataToCloneType>[] = [
89
- 'creator',
90
- 'eventTasks',
91
- 'tickets',
92
- 'targetAudience',
93
- 'amountOfGuests',
94
- ];
95
-
96
- export interface BashNotificationExt extends BashNotification {
97
- creator?: PublicUser;
98
- bashEvent?: BashEvent;
99
- eventTask?: EventTask;
100
- invitation?: Invitation;
101
- reminders?: Reminder[];
102
- }
103
-
104
- export const BASH_NOTIFICATION_DATA_TO_INCLUDE = {
105
- bashEvent: {
106
- select: {
107
- coverPhoto: true,
108
- },
109
- },
110
- creator: {
111
- select: {
112
- image: true,
113
- },
114
- },
115
-
116
- }
117
-
118
- export interface EventTaskExt extends EventTask {
119
- creator: PublicUser;
120
- assignedTo?: PublicUser | null;
121
- }
122
-
123
- export const EVENT_TASK_DATA_TO_INCLUDE = {
124
- creator: {
125
- select: FRONT_END_USER_DATA_TO_SELECT
126
- },
127
- assignedTo: {
128
- select: FRONT_END_USER_DATA_TO_SELECT
129
- }
130
- }
131
-
132
-
133
- export interface EventServiceExt extends EventService {
134
- business: Business;
135
- availableDateTimes: Availability[];
136
- targetAudience: TargetAudience;
137
- links: ServiceLinkExt[];
138
- crowdSize?: AmountOfGuests;
139
- media?: Media[];
140
- }
141
-
142
- export interface EntertainmentServiceExt extends EntertainmentService {
143
- business: Business;
144
- availableDateTimes: Availability[];
145
- targetAudience: TargetAudience;
146
- links: ServiceLinkExt[];
147
- crowdSize?: AmountOfGuests;
148
- media?: Media[];
149
- }
150
-
151
- export interface ExhibitorExt extends Exhibitor {
152
- business: Business;
153
- availableDateTimes: Availability[];
154
- targetAudience: TargetAudience;
155
- links: ServiceLinkExt[];
156
- crowdSize?: AmountOfGuests;
157
- media?: Media[];
158
- }
159
-
160
- export interface SponsorExt extends Sponsor {
161
- business: Business;
162
- availableDateTimes: Availability[];
163
- targetAudience: TargetAudience;
164
- links: ServiceLinkExt[];
165
- crowdSize?: AmountOfGuests;
166
- media?: Media[];
167
- }
168
-
169
- export interface VendorExt extends Vendor {
170
- business: Business;
171
- availableDateTimes: Availability[];
172
- targetAudience?: TargetAudience;
173
- links: ServiceLinkExt[];
174
- crowdSize?: AmountOfGuests;
175
- media?: Media[];
176
- }
177
-
178
- export const VENDOR_DATA_TO_INCLUDE = {
179
- business: true,
180
- availableDateTimes: true,
181
- targetAudience: true,
182
- links: true,
183
- crowdSize: true,
184
- media: true,
185
- }
186
-
187
- export const SERVICE_LINK_DATA_TO_INCLUDE = {
188
- link: true,
189
- }
190
-
191
- export interface VenueExt extends Venue {
192
- business: Business;
193
- availableDateTimes: Availability[];
194
- targetAudience?: TargetAudience | null;
195
- links: ServiceLinkExt[];
196
- capacity?: AmountOfGuests | null;
197
- media?: Media[];
198
- }
199
-
200
- export const VENUE_DATA_TO_INCLUDE = {
201
- business: true,
202
- availableDateTimes: true,
203
- targetAudience: true,
204
- links: {
205
- include: SERVICE_LINK_DATA_TO_INCLUDE
206
- },
207
- capacity: true,
208
- media: true,
209
- }
210
-
211
- export interface OrganizationExt extends Organization {
212
- business: Business;
213
- availableDateTimes: Availability[];
214
- targetAudience: TargetAudience;
215
- links: ServiceLinkExt[];
216
- crowdSize?: AmountOfGuests;
217
- media?: Media[];
218
- status: ServiceStatus;
219
- }
220
-
221
-
222
- export interface BusinessExt extends Business {
223
- owner: PublicUser;
224
- media: Media[];
225
- targetAudience?: TargetAudience | null;
226
- volunteerService?: VolunteerService | null;
227
- serviceLinks?: ServiceLinkExt[];
228
- venues?: Venue[];
229
- eventServices?: EventService[];
230
- entertainmentServices?: EntertainmentService[];
231
- vendors?: Vendor[];
232
- exhibitors?: Exhibitor[];
233
- sponsors?: Sponsor[];
234
- organizations?: Organization[];
235
- bookings?: Booking[];
236
- }
237
-
238
- export const BUSINESS_DATA_TO_INCLUDE = {
239
- owner: {
240
- select: FRONT_END_USER_DATA_TO_SELECT
241
- },
242
- media: true,
243
- volunteerService: true,
244
- targetAudience: true,
245
- serviceLinks: {
246
- include: SERVICE_LINK_DATA_TO_INCLUDE
247
- },
248
- venues: {
249
- include: VENUE_DATA_TO_INCLUDE
250
- },
251
- vendors: {
252
- include: VENDOR_DATA_TO_INCLUDE
253
- }
254
- } satisfies Prisma.BusinessInclude
255
-
256
- export interface ServiceLinkExt extends ServiceLink {
257
- link: Link;
258
- }
259
-
260
- export interface InvitationExt extends Invitation {
261
- creator: PublicUser;
262
- sentTo: PublicUser;
263
- tickets: Ticket[];
264
- associatedBash?: AssociatedBash | null;
265
- }
266
-
267
- export const INVITATION_DATA_TO_INCLUDE = {
268
- creator: {
269
- select: FRONT_END_USER_DATA_TO_SELECT
270
- },
271
- sentTo: {
272
- select: FRONT_END_USER_DATA_TO_SELECT
273
- },
274
- tickets: true,
275
- }
276
-
277
- export interface InvitationExtraData extends Invitation {
278
- isFreeGuest?: boolean;
279
- isOrganizer?: boolean;
280
- }
281
-
282
- export interface AssociatedBashExt extends AssociatedBash {
283
- bashEvent: BashEventExt;
284
- invitation: InvitationExt;
285
- }
286
-
287
- export const ASSOCIATED_BASH_DATA_TO_INCLUDE = {
288
- bashEvent: {
289
- include: BASH_EVENT_DATA_TO_INCLUDE
290
- },
291
- invitation: {
292
- include: INVITATION_DATA_TO_INCLUDE
293
- }
294
- }
295
-
296
- export interface TicketTierExt extends TicketTier {
297
- bashEvent: BashEvent;
298
- tickets: TicketExt[];
299
- promoCodes: BashEventPromoCode[];
300
- }
301
-
302
- export interface TicketExt extends Ticket {
303
- owner: PublicUser;
304
- forUser: PublicUser;
305
- checkout?: Checkout;
306
- }
307
-
308
- export interface CheckoutExt extends Checkout {
309
- owner: PublicUser;
310
- tickets: Ticket[]
311
- }
312
-
313
- export const CHECKOUT_DATA_TO_INCLUDE = {
314
- owner: {
315
- select: FRONT_END_USER_DATA_TO_SELECT
316
- },
317
- tickets: {
318
- select: {
319
- ownerId: true
320
- }
321
- }
322
- }
323
-
324
- export interface ReviewExt extends Review {
325
- comments: BashComment[];
326
- }
327
-
328
- export const CONTACT_DATA_TO_INCLUDE = {
329
- user: {
330
- select: FRONT_END_USER_DATA_TO_SELECT
331
- },
332
- media: true
333
- };
334
-
335
-
336
- export interface UserExtraData extends User {
337
- password?: string;
338
- otp?: string;
339
- }
340
-
341
- export interface UserExt extends User {
342
- businesses?: Business[] | null;
343
-
344
- // Do not include in fetch as there could be thousands of these
345
- associatedBashes?: AssociatedBash[] | null;
346
- reviews?: ReviewExt[] | null;
347
- contacts?: Contact[] | null;
348
- ticketsIOwn?: TicketExt[] | null;
349
- }
350
-
351
- export const USER_DATA_SELECT_REVIEWS_COMMENTS = {
352
- reviews: {
353
- include: {
354
- comments: true
355
- }
356
- }
357
- }
358
-
359
-
360
- export type PublicUser = Pick<UserExt, keyof typeof FRONT_END_USER_DATA_TO_SELECT>
361
- & Partial<Pick<UserExt, keyof typeof USER_DATA_SELECT_REVIEWS_COMMENTS>>;
1
+ import {
2
+ AmountOfGuests,
3
+ EventTask,
4
+ AssociatedBash,
5
+ BashEvent,
6
+ Invitation,
7
+ Ticket,
8
+ User,
9
+ TicketTier, Business, Review, Media, BashComment, Recurrence, Contact,
10
+ BashNotification, BashEventPromoCode,
11
+ Reminder,
12
+ Checkout,
13
+ ServiceLink,
14
+ Link, Venue, Availability,
15
+ TargetAudience,
16
+ ServiceStatus,
17
+ Vendor,
18
+ EventService,
19
+ EntertainmentService,
20
+ Exhibitor,
21
+ Sponsor,
22
+ Organization,
23
+ Booking,
24
+ VolunteerService, Prisma,
25
+ } from "@prisma/client";
26
+ import {UnionFromArray} from "./definitions";
27
+
28
+ export const FRONT_END_USER_DATA_TO_SELECT = {
29
+ id: true,
30
+ email: true,
31
+ givenName: true,
32
+ familyName: true,
33
+ image: true,
34
+ uploadedImage: true,
35
+ } satisfies Prisma.UserSelect;
36
+
37
+ export const PRIVATE_USER_ACCOUNT_TO_SELECT = {
38
+ ...FRONT_END_USER_DATA_TO_SELECT,
39
+ street: true,
40
+ city: true,
41
+ state: true,
42
+ zipCode: true,
43
+ country: true,
44
+ phone: true,
45
+ } satisfies Prisma.UserSelect;
46
+
47
+ export interface BashEventExt extends BashEvent {
48
+ targetAudience?: TargetAudience;
49
+ amountOfGuests?: AmountOfGuests;
50
+ recurrence?: Recurrence;
51
+ creator?: PublicUser;
52
+ ticketTiers: TicketTierExt[];
53
+ media: Media[];
54
+ eventTasks: EventTask[];
55
+ tickets?: Ticket[]; // Only include tickets that the user has purchased and not all tickets (could be thousands + privacy)
56
+ // Do not include in fetch. Could be hundreds of these
57
+ invitations: InvitationExt[];
58
+ }
59
+
60
+ export const TICKET_TIER_DATA_TO_INCLUDE = {
61
+ promoCodes: true,
62
+ } satisfies Prisma.TicketTierInclude;
63
+
64
+ export const BASH_EVENT_DATA_TO_INCLUDE = {
65
+ creator: {
66
+ select: FRONT_END_USER_DATA_TO_SELECT
67
+ },
68
+ targetAudience: true,
69
+ amountOfGuests: true,
70
+ recurrence: true,
71
+ ticketTiers: {
72
+ include: TICKET_TIER_DATA_TO_INCLUDE
73
+ },
74
+ eventTasks: true,
75
+ media: true,
76
+ } satisfies Prisma.BashEventInclude;
77
+
78
+ export const BASH_EVENT_DATA_TO_CLONE = [
79
+ 'ticketTiers',
80
+ 'media',
81
+ 'recurrence',
82
+ 'invitations',
83
+ ] as const;
84
+
85
+ type RemoveCommonProperties<T, U> = keyof (Omit<T, keyof U> & Omit<U, keyof T>);
86
+ type BashEventExtMinusDataToCloneType = Omit<BashEventExt, UnionFromArray<typeof BASH_EVENT_DATA_TO_CLONE>>;
87
+
88
+ export const BASH_EVENT_DATA_TO_REMOVE: RemoveCommonProperties<BashEvent, BashEventExtMinusDataToCloneType>[] = [
89
+ 'creator',
90
+ 'eventTasks',
91
+ 'tickets',
92
+ 'targetAudience',
93
+ 'amountOfGuests',
94
+ ];
95
+
96
+ export interface BashNotificationExt extends BashNotification {
97
+ creator?: PublicUser;
98
+ bashEvent?: BashEvent;
99
+ eventTask?: EventTask;
100
+ invitation?: Invitation;
101
+ reminders?: Reminder[];
102
+ }
103
+
104
+ export const BASH_NOTIFICATION_DATA_TO_INCLUDE = {
105
+ bashEvent: {
106
+ select: {
107
+ coverPhoto: true,
108
+ },
109
+ },
110
+ creator: {
111
+ select: {
112
+ image: true,
113
+ },
114
+ },
115
+
116
+ }
117
+
118
+ export interface EventTaskExt extends EventTask {
119
+ creator: PublicUser;
120
+ assignedTo?: PublicUser | null;
121
+ }
122
+
123
+ export const EVENT_TASK_DATA_TO_INCLUDE = {
124
+ creator: {
125
+ select: FRONT_END_USER_DATA_TO_SELECT
126
+ },
127
+ assignedTo: {
128
+ select: FRONT_END_USER_DATA_TO_SELECT
129
+ }
130
+ }
131
+
132
+
133
+ export interface EventServiceExt extends EventService {
134
+ business: Business;
135
+ availableDateTimes: Availability[];
136
+ targetAudience: TargetAudience;
137
+ links: ServiceLinkExt[];
138
+ crowdSize?: AmountOfGuests;
139
+ media?: Media[];
140
+ }
141
+
142
+ export interface EntertainmentServiceExt extends EntertainmentService {
143
+ business: Business;
144
+ availableDateTimes: Availability[];
145
+ targetAudience: TargetAudience;
146
+ links: ServiceLinkExt[];
147
+ crowdSize?: AmountOfGuests;
148
+ media?: Media[];
149
+ }
150
+
151
+ export interface ExhibitorExt extends Exhibitor {
152
+ business: Business;
153
+ availableDateTimes: Availability[];
154
+ targetAudience: TargetAudience;
155
+ links: ServiceLinkExt[];
156
+ crowdSize?: AmountOfGuests;
157
+ media?: Media[];
158
+ }
159
+
160
+ export interface SponsorExt extends Sponsor {
161
+ business: Business;
162
+ availableDateTimes: Availability[];
163
+ targetAudience: TargetAudience;
164
+ links: ServiceLinkExt[];
165
+ crowdSize?: AmountOfGuests;
166
+ media?: Media[];
167
+ }
168
+
169
+ export interface VendorExt extends Vendor {
170
+ business: Business;
171
+ availableDateTimes: Availability[];
172
+ targetAudience?: TargetAudience;
173
+ links: ServiceLinkExt[];
174
+ crowdSize?: AmountOfGuests;
175
+ media?: Media[];
176
+ }
177
+
178
+ export const VENDOR_DATA_TO_INCLUDE = {
179
+ business: true,
180
+ availableDateTimes: true,
181
+ targetAudience: true,
182
+ links: true,
183
+ crowdSize: true,
184
+ media: true,
185
+ }
186
+
187
+ export const SERVICE_LINK_DATA_TO_INCLUDE = {
188
+ link: true,
189
+ }
190
+
191
+ export interface VenueExt extends Venue {
192
+ business: Business;
193
+ availableDateTimes: Availability[];
194
+ targetAudience?: TargetAudience | null;
195
+ links: ServiceLinkExt[];
196
+ capacity?: AmountOfGuests | null;
197
+ media?: Media[];
198
+ }
199
+
200
+ export const VENUE_DATA_TO_INCLUDE = {
201
+ business: true,
202
+ availableDateTimes: true,
203
+ targetAudience: true,
204
+ links: {
205
+ include: SERVICE_LINK_DATA_TO_INCLUDE
206
+ },
207
+ capacity: true,
208
+ media: true,
209
+ }
210
+
211
+ export interface OrganizationExt extends Organization {
212
+ business: Business;
213
+ availableDateTimes: Availability[];
214
+ targetAudience: TargetAudience;
215
+ links: ServiceLinkExt[];
216
+ crowdSize?: AmountOfGuests;
217
+ media?: Media[];
218
+ status: ServiceStatus;
219
+ }
220
+
221
+
222
+ export interface BusinessExt extends Business {
223
+ owner: PublicUser;
224
+ media: Media[];
225
+ targetAudience?: TargetAudience | null;
226
+ volunteerService?: VolunteerService | null;
227
+ serviceLinks?: ServiceLinkExt[];
228
+ venues?: Venue[];
229
+ eventServices?: EventService[];
230
+ entertainmentServices?: EntertainmentService[];
231
+ vendors?: Vendor[];
232
+ exhibitors?: Exhibitor[];
233
+ sponsors?: Sponsor[];
234
+ organizations?: Organization[];
235
+ bookings?: Booking[];
236
+ }
237
+
238
+ export const BUSINESS_DATA_TO_INCLUDE = {
239
+ owner: {
240
+ select: FRONT_END_USER_DATA_TO_SELECT
241
+ },
242
+ media: true,
243
+ volunteerService: true,
244
+ targetAudience: true,
245
+ serviceLinks: {
246
+ include: SERVICE_LINK_DATA_TO_INCLUDE
247
+ },
248
+ venues: {
249
+ include: VENUE_DATA_TO_INCLUDE
250
+ },
251
+ vendors: {
252
+ include: VENDOR_DATA_TO_INCLUDE
253
+ }
254
+ } satisfies Prisma.BusinessInclude
255
+
256
+ export interface ServiceLinkExt extends ServiceLink {
257
+ link: Link;
258
+ }
259
+
260
+ export interface InvitationExt extends Invitation {
261
+ creator: PublicUser;
262
+ sentTo: PublicUser;
263
+ tickets: Ticket[];
264
+ associatedBash?: AssociatedBash | null;
265
+ }
266
+
267
+ export const INVITATION_DATA_TO_INCLUDE = {
268
+ creator: {
269
+ select: FRONT_END_USER_DATA_TO_SELECT
270
+ },
271
+ sentTo: {
272
+ select: FRONT_END_USER_DATA_TO_SELECT
273
+ },
274
+ tickets: true,
275
+ }
276
+
277
+ export interface InvitationExtraData extends Invitation {
278
+ isFreeGuest?: boolean;
279
+ isOrganizer?: boolean;
280
+ }
281
+
282
+ export interface AssociatedBashExt extends AssociatedBash {
283
+ bashEvent: BashEventExt;
284
+ invitation: InvitationExt;
285
+ }
286
+
287
+ export const ASSOCIATED_BASH_DATA_TO_INCLUDE = {
288
+ bashEvent: {
289
+ include: BASH_EVENT_DATA_TO_INCLUDE
290
+ },
291
+ invitation: {
292
+ include: INVITATION_DATA_TO_INCLUDE
293
+ }
294
+ }
295
+
296
+ export interface TicketTierExt extends TicketTier {
297
+ bashEvent: BashEvent;
298
+ tickets: TicketExt[];
299
+ promoCodes: BashEventPromoCode[];
300
+ }
301
+
302
+ export interface TicketExt extends Ticket {
303
+ owner: PublicUser;
304
+ forUser: PublicUser;
305
+ checkout?: Checkout;
306
+ }
307
+
308
+ export interface CheckoutExt extends Checkout {
309
+ owner: PublicUser;
310
+ tickets: Ticket[]
311
+ }
312
+
313
+ export const CHECKOUT_DATA_TO_INCLUDE = {
314
+ owner: {
315
+ select: FRONT_END_USER_DATA_TO_SELECT
316
+ },
317
+ tickets: {
318
+ select: {
319
+ ownerId: true
320
+ }
321
+ }
322
+ }
323
+
324
+ export interface ReviewExt extends Review {
325
+ comments: BashComment[];
326
+ }
327
+
328
+ export const CONTACT_DATA_TO_INCLUDE = {
329
+ user: {
330
+ select: FRONT_END_USER_DATA_TO_SELECT
331
+ },
332
+ media: true
333
+ };
334
+
335
+
336
+ export interface UserExtraData extends User {
337
+ password?: string;
338
+ otp?: string;
339
+ }
340
+
341
+ export interface UserExt extends User {
342
+ businesses?: Business[] | null;
343
+
344
+ // Do not include in fetch as there could be thousands of these
345
+ associatedBashes?: AssociatedBash[] | null;
346
+ reviews?: ReviewExt[] | null;
347
+ contacts?: Contact[] | null;
348
+ ticketsIOwn?: TicketExt[] | null;
349
+ }
350
+
351
+ export const USER_DATA_SELECT_REVIEWS_COMMENTS = {
352
+ reviews: {
353
+ include: {
354
+ comments: true
355
+ }
356
+ }
357
+ }
358
+
359
+
360
+ export type PublicUser = Pick<UserExt, keyof typeof FRONT_END_USER_DATA_TO_SELECT>
361
+ & Partial<Pick<UserExt, keyof typeof USER_DATA_SELECT_REVIEWS_COMMENTS>>;