@bash-app/bash-common 29.28.1 → 29.28.3
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/package.json +1 -1
- package/src/extendedSchemas.ts +177 -154
- package/src/utils/stripeAccountUtils.ts +2 -2
- package/src/utils/venueUtils.ts +1 -1
package/package.json
CHANGED
package/src/extendedSchemas.ts
CHANGED
|
@@ -37,7 +37,7 @@ import {
|
|
|
37
37
|
ServiceAddon,
|
|
38
38
|
ServicePackage,
|
|
39
39
|
} from "@prisma/client";
|
|
40
|
-
import { SERVICE_LINK_DATA_TO_INCLUDE, UnionFromArray } from "./definitions";
|
|
40
|
+
import { SERVICE_LINK_DATA_TO_INCLUDE, UnionFromArray, VENUE_DATA_TO_INCLUDE } from "./definitions";
|
|
41
41
|
|
|
42
42
|
export const FRONT_END_USER_DATA_TO_SELECT = {
|
|
43
43
|
id: true,
|
|
@@ -108,6 +108,158 @@ export const BASH_EVENT_DATA_TO_REMOVE: RemoveCommonProperties<BashEvent, BashEv
|
|
|
108
108
|
'amountOfGuests',
|
|
109
109
|
];
|
|
110
110
|
|
|
111
|
+
//---------------Services------------------
|
|
112
|
+
export interface ServiceExt extends Service {
|
|
113
|
+
owner?: PublicUser | null;
|
|
114
|
+
creator?: PublicUser | null;
|
|
115
|
+
|
|
116
|
+
stripeAccount?: StripeAccount | null;
|
|
117
|
+
|
|
118
|
+
// availableDateTimes?: Availability[];
|
|
119
|
+
|
|
120
|
+
bookings?: Booking[];
|
|
121
|
+
// rates?: Rate[];
|
|
122
|
+
targetAudience?: TargetAudience | null;
|
|
123
|
+
media?: Media[];
|
|
124
|
+
serviceLinks?: ServiceLinkExt[];
|
|
125
|
+
|
|
126
|
+
eventService?: EventService;
|
|
127
|
+
entertainmentService?: EntertainmentService;
|
|
128
|
+
vendor?: Vendor;
|
|
129
|
+
exhibitor?: Exhibitor;
|
|
130
|
+
sponsor?: Sponsor;
|
|
131
|
+
venue?: Venue;
|
|
132
|
+
organization?: Organization;
|
|
133
|
+
volunteerService?: VolunteerService;
|
|
134
|
+
bashEvent: BashEvent[];
|
|
135
|
+
|
|
136
|
+
serviceRatesAssociation?: ServiceRatesAssociationExt | null;
|
|
137
|
+
associatedBashesReferencingMe?: AssociatedBash[];
|
|
138
|
+
associatedServicesReferencingMe?: AssociatedService[];
|
|
139
|
+
|
|
140
|
+
// googleReviews: GoogleReview[];
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
export interface ServiceRateExt extends ServiceRate {
|
|
144
|
+
serviceSpecialRates?: ServiceSpecialRates;
|
|
145
|
+
serviceDailyRates?: ServiceDailyRates;
|
|
146
|
+
serviceRatesAssociation?: ServiceRatesAssociation;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
export interface ServicePackageExt extends ServicePackage {
|
|
150
|
+
serviceAddons: ServiceAddon[];
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
export interface ServiceDailyRatesExt extends ServiceDailyRates {
|
|
154
|
+
serviceRate?: ServiceRate;
|
|
155
|
+
}
|
|
156
|
+
export interface ServiceSpecialRatesExt extends ServiceSpecialRates {
|
|
157
|
+
serviceRate?: ServiceRate;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
export interface ServiceRatesAssociationExt extends ServiceRatesAssociation {
|
|
161
|
+
serviceGeneralRates?: ServiceRate | null;
|
|
162
|
+
serviceDailyRates?: ServiceDailyRatesExt[];
|
|
163
|
+
serviceSpecialRates?: ServiceSpecialRatesExt[];
|
|
164
|
+
|
|
165
|
+
addons?: ServiceAddon[];
|
|
166
|
+
packages?: ServicePackageExt[];
|
|
167
|
+
media?: Media[];
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
export interface EventServiceExt extends EventService {
|
|
172
|
+
service: ServiceExt;
|
|
173
|
+
crowdSize?: AmountOfGuests;
|
|
174
|
+
serviceRange?: ServiceRange;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
export interface EntertainmentServiceExt extends EntertainmentService {
|
|
178
|
+
service: ServiceExt;
|
|
179
|
+
crowdSize?: AmountOfGuests;
|
|
180
|
+
serviceRange?: ServiceRange;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
export interface ExhibitorExt extends Exhibitor {
|
|
184
|
+
service: ServiceExt;
|
|
185
|
+
crowdSize?: AmountOfGuests;
|
|
186
|
+
serviceRange?: ServiceRange;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
export interface SponsorExt extends Sponsor {
|
|
190
|
+
service: ServiceExt;
|
|
191
|
+
crowdSize?: AmountOfGuests;
|
|
192
|
+
serviceRange?: ServiceRange;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
export interface VendorExt extends Vendor {
|
|
196
|
+
service: ServiceExt;
|
|
197
|
+
crowdSize?: AmountOfGuests;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
export interface VenueExt extends Venue {
|
|
201
|
+
service: ServiceExt;
|
|
202
|
+
// crowdSize?: AmountOfGuests;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
export interface OrganizationExt extends Organization {
|
|
206
|
+
service: ServiceExt;
|
|
207
|
+
amountOfGuests?: AmountOfGuests;
|
|
208
|
+
}
|
|
209
|
+
//-----------------------------------------
|
|
210
|
+
|
|
211
|
+
export interface VolunteerServiceExt extends VolunteerService {
|
|
212
|
+
service?: ServiceExt;
|
|
213
|
+
serviceRange?: ServiceRange | null;
|
|
214
|
+
media?: Media[];
|
|
215
|
+
links?: Link[];
|
|
216
|
+
// availableDateTimes?: Availability[];
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
export interface ServiceLinkExt extends ServiceLink {
|
|
220
|
+
link: Link;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
// Create the final object dynamically
|
|
225
|
+
function createAllTrueObject<T extends string>(keys: T[]): Record<T, true> {
|
|
226
|
+
return keys.reduce((acc, key) => {
|
|
227
|
+
acc[key] = true;
|
|
228
|
+
return acc;
|
|
229
|
+
}, {} as Record<T, true>);
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
// Define the keys and values in a single object
|
|
233
|
+
const serviceKeysObject = {
|
|
234
|
+
eventService: true,
|
|
235
|
+
entertainmentService: true,
|
|
236
|
+
vendor: true,
|
|
237
|
+
exhibitor: true,
|
|
238
|
+
sponsor: true,
|
|
239
|
+
venue: true,
|
|
240
|
+
organization: true,
|
|
241
|
+
} as const;
|
|
242
|
+
|
|
243
|
+
|
|
244
|
+
export type ServiceSpecificName = keyof typeof serviceKeysObject;
|
|
245
|
+
|
|
246
|
+
const serviceKeysArray = Object.keys(serviceKeysObject);
|
|
247
|
+
|
|
248
|
+
export type ServiceSpecificType = ServiceExt[ServiceSpecificName];
|
|
249
|
+
|
|
250
|
+
export const specificServiceMap : Record<ServiceTypes, ServiceSpecificName> = {
|
|
251
|
+
"EventServices": "eventService",
|
|
252
|
+
"EntertainmentServices": "entertainmentService",
|
|
253
|
+
"Vendors": "vendor",
|
|
254
|
+
"Exhibitors": "exhibitor",
|
|
255
|
+
"Sponsors": "sponsor",
|
|
256
|
+
"Venues": "venue",
|
|
257
|
+
"Organizations": "organization"
|
|
258
|
+
} as const;
|
|
259
|
+
|
|
260
|
+
export const serviceTypeToField = (serviceType : ServiceTypes) : ServiceSpecificName => {
|
|
261
|
+
return specificServiceMap[serviceType];
|
|
262
|
+
}
|
|
111
263
|
export const SERVICE_PACKAGE_DATA_TO_INCLUDE = {
|
|
112
264
|
serviceAddons: true
|
|
113
265
|
} satisfies Prisma.ServicePackageInclude;
|
|
@@ -160,52 +312,36 @@ export const SERVICE_DATA_TO_INCLUDE = {
|
|
|
160
312
|
}
|
|
161
313
|
} satisfies Prisma.ServiceInclude;
|
|
162
314
|
|
|
163
|
-
// Create the final object dynamically
|
|
164
|
-
function createAllTrueObject<T extends string>(keys: T[]): Record<T, true> {
|
|
165
|
-
return keys.reduce((acc, key) => {
|
|
166
|
-
acc[key] = true;
|
|
167
|
-
return acc;
|
|
168
|
-
}, {} as Record<T, true>);
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
// Define the keys and values in a single object
|
|
172
|
-
const serviceKeysObject = {
|
|
173
|
-
eventService: true,
|
|
174
|
-
entertainmentService: true,
|
|
175
|
-
vendor: true,
|
|
176
|
-
exhibitor: true,
|
|
177
|
-
sponsor: true,
|
|
178
|
-
venue: true,
|
|
179
|
-
organization: true,
|
|
180
|
-
} as const;
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
export type ServiceSpecificName = keyof typeof serviceKeysObject;
|
|
184
|
-
|
|
185
|
-
const serviceKeysArray = Object.keys(serviceKeysObject);
|
|
186
|
-
|
|
187
|
-
export type ServiceSpecificType = ServiceExt[ServiceSpecificName];
|
|
188
|
-
|
|
189
|
-
export const serviceTypeToField = (serviceType : ServiceTypes) : ServiceSpecificName => {
|
|
190
|
-
const specificServiceMap : Record<ServiceTypes, ServiceSpecificName> = {
|
|
191
|
-
"EventServices": "eventService",
|
|
192
|
-
"EntertainmentServices": "entertainmentService",
|
|
193
|
-
"Vendors": "vendor",
|
|
194
|
-
"Exhibitors": "exhibitor",
|
|
195
|
-
"Sponsors": "sponsor",
|
|
196
|
-
"Venues": "venue",
|
|
197
|
-
"Organizations": "organization"
|
|
198
|
-
};
|
|
199
|
-
|
|
200
|
-
return specificServiceMap[serviceType];
|
|
201
|
-
}
|
|
202
|
-
|
|
203
315
|
//full service data to include, includes specific service data
|
|
204
316
|
export const SERVICE_FULL_DATA_TO_INCLUDE = {
|
|
205
317
|
...SERVICE_DATA_TO_INCLUDE,
|
|
206
318
|
...createAllTrueObject(serviceKeysArray)
|
|
207
319
|
} satisfies Prisma.ServiceInclude;
|
|
208
320
|
|
|
321
|
+
export const SERVICE_FULL_DATA_TO_CLONE = [
|
|
322
|
+
'media',
|
|
323
|
+
'targetAudience',
|
|
324
|
+
'serviceLinks',
|
|
325
|
+
// ...Object.values(specificServiceMap)
|
|
326
|
+
] as const;
|
|
327
|
+
|
|
328
|
+
type ServiceExtMinusDataToCloneType = Omit<ServiceExt, UnionFromArray<typeof SERVICE_FULL_DATA_TO_CLONE>>;
|
|
329
|
+
export const SERVICE_FULL_DATA_TO_REMOVE: RemoveCommonProperties<Service, ServiceExtMinusDataToCloneType>[] = [
|
|
330
|
+
'creator',
|
|
331
|
+
'owner',
|
|
332
|
+
'bookings',
|
|
333
|
+
] as const;
|
|
334
|
+
|
|
335
|
+
export const VENUE_DATA_TO_CLONE = [
|
|
336
|
+
|
|
337
|
+
] as const;
|
|
338
|
+
|
|
339
|
+
type VenueExtMinusDataToCloneType = Omit<Venue, UnionFromArray<typeof VENUE_DATA_TO_CLONE>>;
|
|
340
|
+
export const VENUE_DATA_TO_REMOVE: RemoveCommonProperties<Venue, VenueExtMinusDataToCloneType>[] = [
|
|
341
|
+
// 'bashEvents',
|
|
342
|
+
] as const;
|
|
343
|
+
//-----------------------------------------
|
|
344
|
+
|
|
209
345
|
export interface BashNotificationExt extends BashNotification {
|
|
210
346
|
creator?: PublicUser;
|
|
211
347
|
bashEvent?: BashEvent;
|
|
@@ -269,119 +405,6 @@ export const STRIPE_ACCOUNT_DATA_TO_INCLUDE = {
|
|
|
269
405
|
export interface StripeAccountExt extends StripeAccount {
|
|
270
406
|
logo?: Media | null;
|
|
271
407
|
}
|
|
272
|
-
|
|
273
|
-
//---------------Services------------------
|
|
274
|
-
export interface ServiceExt extends Service {
|
|
275
|
-
owner?: PublicUser | null;
|
|
276
|
-
creator?: PublicUser | null;
|
|
277
|
-
|
|
278
|
-
stripeAccount?: StripeAccount | null;
|
|
279
|
-
|
|
280
|
-
// availableDateTimes?: Availability[];
|
|
281
|
-
|
|
282
|
-
bookings?: Booking[];
|
|
283
|
-
// rates?: Rate[];
|
|
284
|
-
targetAudience?: TargetAudience | null;
|
|
285
|
-
media?: Media[];
|
|
286
|
-
serviceLinks?: ServiceLinkExt[];
|
|
287
|
-
|
|
288
|
-
eventService?: EventService;
|
|
289
|
-
entertainmentService?: EntertainmentService;
|
|
290
|
-
vendor?: Vendor;
|
|
291
|
-
exhibitor?: Exhibitor;
|
|
292
|
-
sponsor?: Sponsor;
|
|
293
|
-
venue?: Venue;
|
|
294
|
-
organization?: Organization;
|
|
295
|
-
volunteerService?: VolunteerService;
|
|
296
|
-
bashEvent: BashEvent[];
|
|
297
|
-
|
|
298
|
-
serviceRatesAssociation?: ServiceRatesAssociationExt | null;
|
|
299
|
-
associatedBashesReferencingMe?: AssociatedBash[];
|
|
300
|
-
associatedServicesReferencingMe?: AssociatedService[];
|
|
301
|
-
|
|
302
|
-
// googleReviews: GoogleReview[];
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
export interface ServiceRateExt extends ServiceRate {
|
|
306
|
-
serviceSpecialRates?: ServiceSpecialRates;
|
|
307
|
-
serviceDailyRates?: ServiceDailyRates;
|
|
308
|
-
serviceRatesAssociation?: ServiceRatesAssociation;
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
export interface ServicePackageExt extends ServicePackage {
|
|
312
|
-
serviceAddons: ServiceAddon[];
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
export interface ServiceDailyRatesExt extends ServiceDailyRates {
|
|
316
|
-
serviceRate?: ServiceRate;
|
|
317
|
-
}
|
|
318
|
-
export interface ServiceSpecialRatesExt extends ServiceSpecialRates {
|
|
319
|
-
serviceRate?: ServiceRate;
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
export interface ServiceRatesAssociationExt extends ServiceRatesAssociation {
|
|
323
|
-
serviceGeneralRates?: ServiceRate | null;
|
|
324
|
-
serviceDailyRates?: ServiceDailyRatesExt[];
|
|
325
|
-
serviceSpecialRates?: ServiceSpecialRatesExt[];
|
|
326
|
-
|
|
327
|
-
addons?: ServiceAddon[];
|
|
328
|
-
packages?: ServicePackageExt[];
|
|
329
|
-
media?: Media[];
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
export interface EventServiceExt extends EventService {
|
|
334
|
-
service: ServiceExt;
|
|
335
|
-
crowdSize?: AmountOfGuests;
|
|
336
|
-
serviceRange?: ServiceRange;
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
export interface EntertainmentServiceExt extends EntertainmentService {
|
|
340
|
-
service: ServiceExt;
|
|
341
|
-
crowdSize?: AmountOfGuests;
|
|
342
|
-
serviceRange?: ServiceRange;
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
export interface ExhibitorExt extends Exhibitor {
|
|
346
|
-
service: ServiceExt;
|
|
347
|
-
crowdSize?: AmountOfGuests;
|
|
348
|
-
serviceRange?: ServiceRange;
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
export interface SponsorExt extends Sponsor {
|
|
352
|
-
service: ServiceExt;
|
|
353
|
-
crowdSize?: AmountOfGuests;
|
|
354
|
-
serviceRange?: ServiceRange;
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
export interface VendorExt extends Vendor {
|
|
358
|
-
service: ServiceExt;
|
|
359
|
-
crowdSize?: AmountOfGuests;
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
export interface VenueExt extends Venue {
|
|
363
|
-
service: ServiceExt;
|
|
364
|
-
// crowdSize?: AmountOfGuests;
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
export interface OrganizationExt extends Organization {
|
|
368
|
-
service: ServiceExt;
|
|
369
|
-
amountOfGuests?: AmountOfGuests;
|
|
370
|
-
}
|
|
371
|
-
//-----------------------------------------
|
|
372
|
-
|
|
373
|
-
export interface VolunteerServiceExt extends VolunteerService {
|
|
374
|
-
service?: ServiceExt;
|
|
375
|
-
serviceRange?: ServiceRange | null;
|
|
376
|
-
media?: Media[];
|
|
377
|
-
links?: Link[];
|
|
378
|
-
// availableDateTimes?: Availability[];
|
|
379
|
-
}
|
|
380
|
-
|
|
381
|
-
export interface ServiceLinkExt extends ServiceLink {
|
|
382
|
-
link: Link;
|
|
383
|
-
}
|
|
384
|
-
|
|
385
408
|
export interface InvitationExt extends Invitation {
|
|
386
409
|
creator: PublicUser;
|
|
387
410
|
sentTo: PublicUser;
|
|
@@ -4,8 +4,8 @@ import { isProduction } from "./apiUtils";
|
|
|
4
4
|
export const stripeAccountFullyLinked = (linkingStatus: StripeLinkingStatus): boolean => {
|
|
5
5
|
return (
|
|
6
6
|
!linkingStatus.hasOutstandingRequirements &&
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
linkingStatus.isOnboarded &&
|
|
8
|
+
linkingStatus.paymentsEnabled &&
|
|
9
9
|
(!isProduction() || linkingStatus.taxMonitoringEnabled)
|
|
10
10
|
);
|
|
11
11
|
}
|
package/src/utils/venueUtils.ts
CHANGED