@bash-app/bash-common 12.3.0 → 12.4.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.
@@ -1,237 +1,241 @@
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
- BashNotification, BashEventPromoCode,
12
- Reminder, ServiceRange,
13
- ServiceTargetAudience,
14
- Checkout,
15
- ServiceLink,
16
- Link,
17
- } from "@prisma/client";
18
-
19
- export const FRONT_END_USER_DATA_TO_SELECT = {
20
- id: true,
21
- email: true,
22
- givenName: true,
23
- familyName: true,
24
- image: true,
25
- uploadedImage: true,
26
- services: true,
27
- }
28
-
29
- export const PRIVATE_USER_ACCOUNT_TO_SELECT = {
30
- ...FRONT_END_USER_DATA_TO_SELECT,
31
- streetAddress: true,
32
- city: true,
33
- state: true,
34
- postalCode: true,
35
- country: true,
36
- phone: true,
37
- }
38
-
39
- export interface BashEventExt extends BashEvent {
40
- targetAudience?: TargetAudience;
41
- amountOfGuests?: AmountOfGuests;
42
- recurrence?: Recurrence;
43
- creator?: User;
44
- ticketTiers: TicketTierExt[];
45
- media: Media[];
46
- eventTasks: EventTask[];
47
- promoCodes?: BashEventPromoCode[];
48
- tickets?: Ticket[]; // Only include tickets that the user has purchased and not all tickets (could be thousands + privacy)
49
- // Do not include in fetch. Could be hundreds of these
50
- invitations: InvitationExt[];
51
- youtubeUrl?: string;
52
- }
53
-
54
- export const BASH_EVENT_DATA_TO_SELECT = {
55
- creator: {
56
- select: FRONT_END_USER_DATA_TO_SELECT
57
- }
58
- }
59
-
60
- export const BASH_EVENT_DATA_TO_INCLUDE = {
61
- targetAudience: true,
62
- amountOfGuests: true,
63
- recurrence: true,
64
- ticketTiers: true,
65
- eventTasks: true,
66
- media: true,
67
- promoCodes: true,
68
- }
69
-
70
- export const BASH_EVENT_DATA_TO_CLONE = [
71
- 'targetAudience',
72
- 'amountOfGuests',
73
- 'ticketTiers',
74
- 'media',
75
- 'recurrence',
76
- 'invitations',
77
- 'promoCodes',
78
- ] as const;
79
-
80
- export interface BashNotificationExt extends BashNotification {
81
- creator?: User;
82
- bashEvent?: BashEvent;
83
- eventTask?: EventTask;
84
- invitation?: Invitation;
85
- reminders?: Reminder[];
86
- }
87
-
88
- export const BASH_NOTIFICATION_DATA_TO_INCLUDE = {
89
- bashEvent: {
90
- select: {
91
- coverPhoto: true,
92
- },
93
- },
94
- creator: {
95
- select: {
96
- image: true,
97
- },
98
- },
99
-
100
- }
101
-
102
- type RemoveCommonProperties<T, U> = keyof (Omit<T, keyof U> & Omit<U, keyof T>);
103
- type UnionFromArray<T extends ReadonlyArray<any>> = T[number];
104
- type BashEventExtMinusDataToCloneType = Omit<BashEventExt, UnionFromArray<typeof BASH_EVENT_DATA_TO_CLONE>>;
105
-
106
- export const BASH_EVENT_DATA_TO_REMOVE: RemoveCommonProperties<BashEvent, BashEventExtMinusDataToCloneType>[] = [
107
- 'creator',
108
- 'eventTasks',
109
- 'tickets'
110
- ];
111
-
112
- export interface ServiceExt extends Service {
113
- owner: User;
114
- media: Media[];
115
- crowdSize: ServiceRange;
116
- serviceRange: ServiceRange;
117
- targetAudience: ServiceTargetAudience;
118
- serviceLinks?: ServiceLinkExt[];
119
- }
120
-
121
- export interface ServiceLinkExt extends ServiceLink {
122
- link: Link;
123
- }
124
-
125
- export const SERVICE_LINK_DATA_TO_INCLUDE = {
126
- link: true,
127
- }
128
-
129
- export const SERVICE_DATA_TO_INCLUDE = {
130
- owner: {
131
- select: FRONT_END_USER_DATA_TO_SELECT
132
- },
133
- media: true,
134
- crowdSize: true,
135
- serviceRange: true,
136
- serviceLinks: {
137
- include: SERVICE_LINK_DATA_TO_INCLUDE
138
- }
139
- }
140
-
141
- export interface InvitationExt extends Invitation {
142
- creator: User;
143
- sentTo: User;
144
- tickets: Ticket[];
145
- associatedBash?: AssociatedBash | null;
146
- }
147
-
148
- export const INVITATION_DATA_TO_INCLUDE = {
149
- creator: true,
150
- sentTo: true,
151
- tickets: true,
152
- }
153
-
154
- export interface InvitationExtraData extends Invitation {
155
- isFreeGuest?: boolean;
156
- isOrganizer?: boolean;
157
- }
158
-
159
- export interface AssociatedBashExt extends AssociatedBash {
160
- bashEvent: BashEventExt;
161
- invitation: InvitationExt;
162
- }
163
-
164
- export const ASSOCIATED_BASH_DATA_TO_INCLUDE = {
165
- bashEvent: {
166
- include: BASH_EVENT_DATA_TO_INCLUDE
167
- },
168
- invitation: {
169
- include: INVITATION_DATA_TO_INCLUDE
170
- }
171
- }
172
-
173
- export interface TicketTierExt extends TicketTier {
174
- bashEvent: BashEvent;
175
- tickets: TicketExt[];
176
- }
177
-
178
- export interface TicketExt extends Ticket {
179
- owner: User;
180
- forUser: User;
181
- checkout?: Checkout;
182
- }
183
-
184
- export interface CheckoutExt extends Checkout {
185
- owner: User;
186
- tickets: Ticket[]
187
- }
188
-
189
- export const CHECKOUT_DATA_TO_INCLUDE = {
190
- owner: {
191
- select: FRONT_END_USER_DATA_TO_SELECT
192
- },
193
- tickets: {
194
- select: {
195
- ownerId: true
196
- }
197
- }
198
- }
199
-
200
- export interface ReviewExt extends Review {
201
- comments: BashComment[];
202
- }
203
-
204
- export const CONTACT_DATA_TO_INCLUDE = {
205
- user: {
206
- select: FRONT_END_USER_DATA_TO_SELECT
207
- },
208
- media: true
209
- };
210
-
211
-
212
- export interface UserExtraData extends User {
213
- password?: string;
214
- otp?: string;
215
- }
216
-
217
- export interface UserExt extends User {
218
- services?: Service[];
219
-
220
- // Do not include in fetch as there could be thousands of these
221
- associatedBashes?: AssociatedBash[]
222
- reviews?: ReviewExt[];
223
- contacts?: Contact[];
224
- ticketsIOwn?: TicketExt[];
225
- }
226
-
227
- export const USER_DATA_SELECT_REVIEWS_COMMENTS = {
228
- reviews: {
229
- include: {
230
- comments: true
231
- }
232
- }
233
- }
234
-
235
-
236
- export type Public_User = Pick<UserExt, keyof typeof FRONT_END_USER_DATA_TO_SELECT>
237
- & Partial<Pick<UserExt, keyof typeof USER_DATA_SELECT_REVIEWS_COMMENTS>>;
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
+ BashNotification, BashEventPromoCode,
12
+ Reminder, ServiceRange,
13
+ ServiceTargetAudience,
14
+ Checkout,
15
+ ServiceLink,
16
+ Link,
17
+ } from "@prisma/client";
18
+
19
+ export const FRONT_END_USER_DATA_TO_SELECT = {
20
+ id: true,
21
+ email: true,
22
+ givenName: true,
23
+ familyName: true,
24
+ image: true,
25
+ uploadedImage: true,
26
+ services: true,
27
+ }
28
+
29
+ export const PRIVATE_USER_ACCOUNT_TO_SELECT = {
30
+ ...FRONT_END_USER_DATA_TO_SELECT,
31
+ streetAddress: true,
32
+ city: true,
33
+ state: true,
34
+ postalCode: true,
35
+ country: true,
36
+ phone: true,
37
+ }
38
+
39
+ export interface BashEventExt extends BashEvent {
40
+ targetAudience?: TargetAudience;
41
+ amountOfGuests?: AmountOfGuests;
42
+ recurrence?: Recurrence;
43
+ creator?: User;
44
+ ticketTiers: TicketTierExt[];
45
+ media: Media[];
46
+ eventTasks: EventTask[];
47
+ promoCodes?: BashEventPromoCode[];
48
+ tickets?: Ticket[]; // Only include tickets that the user has purchased and not all tickets (could be thousands + privacy)
49
+ // Do not include in fetch. Could be hundreds of these
50
+ invitations: InvitationExt[];
51
+ youtubeUrl?: string;
52
+ }
53
+
54
+ export const BASH_EVENT_DATA_TO_SELECT = {
55
+ creator: {
56
+ select: FRONT_END_USER_DATA_TO_SELECT
57
+ }
58
+ }
59
+
60
+ export const BASH_EVENT_DATA_TO_INCLUDE = {
61
+ targetAudience: true,
62
+ amountOfGuests: true,
63
+ recurrence: true,
64
+ ticketTiers: true,
65
+ eventTasks: true,
66
+ media: true,
67
+ promoCodes: true,
68
+ }
69
+
70
+ export const BASH_EVENT_DATA_TO_CLONE = [
71
+ 'targetAudience',
72
+ 'amountOfGuests',
73
+ 'ticketTiers',
74
+ 'media',
75
+ 'recurrence',
76
+ 'invitations',
77
+ 'promoCodes',
78
+ ] as const;
79
+
80
+ export interface BashNotificationExt extends BashNotification {
81
+ creator?: User;
82
+ bashEvent?: BashEvent;
83
+ eventTask?: EventTask;
84
+ invitation?: Invitation;
85
+ reminders?: Reminder[];
86
+ }
87
+
88
+ export const BASH_NOTIFICATION_DATA_TO_INCLUDE = {
89
+ bashEvent: {
90
+ select: {
91
+ coverPhoto: true,
92
+ },
93
+ },
94
+ creator: {
95
+ select: {
96
+ image: true,
97
+ },
98
+ },
99
+
100
+ }
101
+
102
+ type RemoveCommonProperties<T, U> = keyof (Omit<T, keyof U> & Omit<U, keyof T>);
103
+ type UnionFromArray<T extends ReadonlyArray<any>> = T[number];
104
+ type BashEventExtMinusDataToCloneType = Omit<BashEventExt, UnionFromArray<typeof BASH_EVENT_DATA_TO_CLONE>>;
105
+
106
+ export const BASH_EVENT_DATA_TO_REMOVE: RemoveCommonProperties<BashEvent, BashEventExtMinusDataToCloneType>[] = [
107
+ 'creator',
108
+ 'eventTasks',
109
+ 'tickets'
110
+ ];
111
+
112
+ export interface ServiceExt extends Service {
113
+ owner: User;
114
+ media: Media[];
115
+ crowdSize: ServiceRange;
116
+ serviceRange: ServiceRange;
117
+ targetAudience: ServiceTargetAudience;
118
+ serviceLinks?: ServiceLinkExt[];
119
+ venueName?: string;
120
+ capacity?: string | number | null;
121
+ amenities?: string | null;
122
+ specialNotes?: string;
123
+ }
124
+
125
+ export interface ServiceLinkExt extends ServiceLink {
126
+ link: Link;
127
+ }
128
+
129
+ export const SERVICE_LINK_DATA_TO_INCLUDE = {
130
+ link: true,
131
+ }
132
+
133
+ export const SERVICE_DATA_TO_INCLUDE = {
134
+ owner: {
135
+ select: FRONT_END_USER_DATA_TO_SELECT
136
+ },
137
+ media: true,
138
+ crowdSize: true,
139
+ serviceRange: true,
140
+ serviceLinks: {
141
+ include: SERVICE_LINK_DATA_TO_INCLUDE
142
+ }
143
+ }
144
+
145
+ export interface InvitationExt extends Invitation {
146
+ creator: User;
147
+ sentTo: User;
148
+ tickets: Ticket[];
149
+ associatedBash?: AssociatedBash | null;
150
+ }
151
+
152
+ export const INVITATION_DATA_TO_INCLUDE = {
153
+ creator: true,
154
+ sentTo: true,
155
+ tickets: true,
156
+ }
157
+
158
+ export interface InvitationExtraData extends Invitation {
159
+ isFreeGuest?: boolean;
160
+ isOrganizer?: boolean;
161
+ }
162
+
163
+ export interface AssociatedBashExt extends AssociatedBash {
164
+ bashEvent: BashEventExt;
165
+ invitation: InvitationExt;
166
+ }
167
+
168
+ export const ASSOCIATED_BASH_DATA_TO_INCLUDE = {
169
+ bashEvent: {
170
+ include: BASH_EVENT_DATA_TO_INCLUDE
171
+ },
172
+ invitation: {
173
+ include: INVITATION_DATA_TO_INCLUDE
174
+ }
175
+ }
176
+
177
+ export interface TicketTierExt extends TicketTier {
178
+ bashEvent: BashEvent;
179
+ tickets: TicketExt[];
180
+ }
181
+
182
+ export interface TicketExt extends Ticket {
183
+ owner: User;
184
+ forUser: User;
185
+ checkout?: Checkout;
186
+ }
187
+
188
+ export interface CheckoutExt extends Checkout {
189
+ owner: User;
190
+ tickets: Ticket[]
191
+ }
192
+
193
+ export const CHECKOUT_DATA_TO_INCLUDE = {
194
+ owner: {
195
+ select: FRONT_END_USER_DATA_TO_SELECT
196
+ },
197
+ tickets: {
198
+ select: {
199
+ ownerId: true
200
+ }
201
+ }
202
+ }
203
+
204
+ export interface ReviewExt extends Review {
205
+ comments: BashComment[];
206
+ }
207
+
208
+ export const CONTACT_DATA_TO_INCLUDE = {
209
+ user: {
210
+ select: FRONT_END_USER_DATA_TO_SELECT
211
+ },
212
+ media: true
213
+ };
214
+
215
+
216
+ export interface UserExtraData extends User {
217
+ password?: string;
218
+ otp?: string;
219
+ }
220
+
221
+ export interface UserExt extends User {
222
+ services?: Service[];
223
+
224
+ // Do not include in fetch as there could be thousands of these
225
+ associatedBashes?: AssociatedBash[]
226
+ reviews?: ReviewExt[];
227
+ contacts?: Contact[];
228
+ ticketsIOwn?: TicketExt[];
229
+ }
230
+
231
+ export const USER_DATA_SELECT_REVIEWS_COMMENTS = {
232
+ reviews: {
233
+ include: {
234
+ comments: true
235
+ }
236
+ }
237
+ }
238
+
239
+
240
+ export type Public_User = Pick<UserExt, keyof typeof FRONT_END_USER_DATA_TO_SELECT>
241
+ & Partial<Pick<UserExt, keyof typeof USER_DATA_SELECT_REVIEWS_COMMENTS>>;
package/src/index.ts CHANGED
@@ -1,12 +1,12 @@
1
- export * from "./extendedSchemas";
2
- export * from "./definitions";
3
- export * from "./utils/ticketListUtils";
4
- export * from "./utils/dateTimeUtils";
5
- export * from "./utils/recurrenceUtils";
6
- export * from "./utils/addressUtils";
7
- export * from "./utils/paymentUtils";
8
- export * from "./utils/awsS3Utils";
9
- export * from "./utils/qrCodeUtils";
10
- export * from "./utils/sortUtils";
11
- export * from "./utils/apiUtils";
12
- export * from "./utils/urlUtils";
1
+ export * from "./extendedSchemas";
2
+ export * from "./definitions";
3
+ export * from "./utils/ticketListUtils";
4
+ export * from "./utils/dateTimeUtils";
5
+ export * from "./utils/recurrenceUtils";
6
+ export * from "./utils/addressUtils";
7
+ export * from "./utils/paymentUtils";
8
+ export * from "./utils/awsS3Utils";
9
+ export * from "./utils/qrCodeUtils";
10
+ export * from "./utils/sortUtils";
11
+ export * from "./utils/apiUtils";
12
+ export * from "./utils/urlUtils";