@bash-app/bash-common 30.25.0 → 30.27.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/package.json +1 -1
- package/prisma/schema.prisma +66 -21
- package/src/definitions.ts +4 -0
- package/src/extendedSchemas.ts +130 -104
- package/src/utils/objUtils.ts +7 -3
- package/src/utils/service/serviceDBUtils.ts +5 -3
- package/src/utils/service/serviceUtils.ts +57 -5
- package/src/utils/typeUtils.ts +14 -0
package/package.json
CHANGED
package/prisma/schema.prisma
CHANGED
|
@@ -7,8 +7,8 @@ generator client {
|
|
|
7
7
|
|
|
8
8
|
datasource db {
|
|
9
9
|
provider = "postgresql"
|
|
10
|
-
url = env("POSTGRES_PRISMA_URL")
|
|
11
|
-
directUrl = env("POSTGRES_URL_NON_POOLING")
|
|
10
|
+
url = env("POSTGRES_PRISMA_URL")
|
|
11
|
+
directUrl = env("POSTGRES_URL_NON_POOLING")
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
model Club {
|
|
@@ -358,32 +358,48 @@ model TicketTier {
|
|
|
358
358
|
}
|
|
359
359
|
|
|
360
360
|
model Ticket {
|
|
361
|
-
id String
|
|
361
|
+
id String @id @default(cuid())
|
|
362
362
|
ownerId String
|
|
363
|
-
owner User
|
|
363
|
+
owner User @relation("TicketsIOwn", fields: [ownerId], references: [id])
|
|
364
364
|
bashEventId String
|
|
365
|
-
bashEvent BashEvent
|
|
365
|
+
bashEvent BashEvent @relation(fields: [bashEventId], references: [id])
|
|
366
366
|
ticketTierId String?
|
|
367
|
-
ticketTier TicketTier?
|
|
367
|
+
ticketTier TicketTier? @relation(fields: [ticketTierId], references: [id])
|
|
368
368
|
validDate DateTime?
|
|
369
369
|
forUserId String?
|
|
370
|
-
forUser User?
|
|
370
|
+
forUser User? @relation("TicketsISent", fields: [forUserId], references: [id])
|
|
371
371
|
fullName String?
|
|
372
372
|
email String?
|
|
373
373
|
paidOn DateTime?
|
|
374
374
|
allowPromiseToPay Boolean?
|
|
375
|
-
status TicketStatus
|
|
375
|
+
status TicketStatus @default(Pending)
|
|
376
376
|
isFreeGuest Boolean?
|
|
377
377
|
geoFenceCheckInUnnecessary Boolean?
|
|
378
378
|
checkedInAt DateTime?
|
|
379
379
|
checkedOutAt DateTime?
|
|
380
380
|
invitationId String?
|
|
381
|
-
invitation Invitation?
|
|
381
|
+
invitation Invitation? @relation("TicketsForInvitation", fields: [invitationId], references: [id])
|
|
382
382
|
checkoutId String?
|
|
383
|
-
checkout Checkout?
|
|
384
|
-
checkedInMethod
|
|
383
|
+
checkout Checkout? @relation(fields: [checkoutId], references: [id])
|
|
384
|
+
checkedInMethod String? @default("manual")
|
|
385
|
+
waitlistPosition Int? // Position in the waitlist
|
|
386
|
+
waitlistJoinedAt DateTime? // When they joined the waitlist
|
|
387
|
+
waitlistNotifiedAt DateTime? // When they were notified of available spot
|
|
388
|
+
waitlistExpiresAt DateTime? // When their waitlist spot expires
|
|
389
|
+
checkInLocation String? // Where they checked in
|
|
390
|
+
checkOutLocation String? // Where they checked out
|
|
391
|
+
checkOutMethod String? @default("manual")
|
|
392
|
+
lastLocationUpdate DateTime? // For tracking if they're still in the venue
|
|
393
|
+
validationAttempts Int @default(0)
|
|
394
|
+
lastValidationAttempt DateTime?
|
|
395
|
+
lastValidatedBy String? // User ID who last validated
|
|
396
|
+
transfers TicketTransfer[]
|
|
397
|
+
metadata TicketMetadata[]
|
|
398
|
+
waitlistUser User? @relation("TicketsOnWaitlist", fields: [waitlistUserId], references: [id])
|
|
399
|
+
waitlistUserId String?
|
|
385
400
|
|
|
386
401
|
@@index([bashEventId])
|
|
402
|
+
@@index([waitlistUserId])
|
|
387
403
|
}
|
|
388
404
|
|
|
389
405
|
enum TicketStatus {
|
|
@@ -395,6 +411,32 @@ enum TicketStatus {
|
|
|
395
411
|
Pending
|
|
396
412
|
}
|
|
397
413
|
|
|
414
|
+
model TicketTransfer {
|
|
415
|
+
id String @id @default(cuid())
|
|
416
|
+
ticket Ticket @relation(fields: [ticketId], references: [id])
|
|
417
|
+
ticketId String
|
|
418
|
+
fromUser User @relation("TransfersFrom", fields: [fromUserId], references: [id])
|
|
419
|
+
fromUserId String
|
|
420
|
+
toUser User @relation("TransfersTo", fields: [toUserId], references: [id])
|
|
421
|
+
toUserId String
|
|
422
|
+
timestamp DateTime
|
|
423
|
+
reason String?
|
|
424
|
+
|
|
425
|
+
@@index([ticketId])
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
model TicketMetadata {
|
|
429
|
+
id String @id @default(cuid())
|
|
430
|
+
ticket Ticket @relation(fields: [ticketId], references: [id])
|
|
431
|
+
ticketId String
|
|
432
|
+
key String
|
|
433
|
+
value String
|
|
434
|
+
createdAt DateTime @default(now())
|
|
435
|
+
updatedAt DateTime @updatedAt
|
|
436
|
+
|
|
437
|
+
@@index([ticketId])
|
|
438
|
+
}
|
|
439
|
+
|
|
398
440
|
// enum BookingStatus {
|
|
399
441
|
// Cancelled
|
|
400
442
|
// Completed
|
|
@@ -958,8 +1000,13 @@ model User {
|
|
|
958
1000
|
ownedServices Service[] @relation("OwnedService")
|
|
959
1001
|
createdServices Service[] @relation("CreatedService")
|
|
960
1002
|
createdEvents BashEvent[] @relation("CreatedEvent")
|
|
1003
|
+
checkouts Checkout[]
|
|
961
1004
|
ticketsISent Ticket[] @relation("TicketsISent")
|
|
962
1005
|
ticketsIOwn Ticket[] @relation("TicketsIOwn")
|
|
1006
|
+
transfersFrom TicketTransfer[] @relation("TransfersFrom")
|
|
1007
|
+
transfersTo TicketTransfer[] @relation("TransfersTo")
|
|
1008
|
+
ticketsOnWaitlist Ticket[] @relation("TicketsOnWaitlist")
|
|
1009
|
+
ticketTiersWaitListsIveJoined TicketTier[]
|
|
963
1010
|
reviews Review[]
|
|
964
1011
|
sponsorships SponsoredEvent[]
|
|
965
1012
|
investments Investment[]
|
|
@@ -996,8 +1043,6 @@ model User {
|
|
|
996
1043
|
remindersCreatedByMe Reminder[] @relation("RemindersCreatedByMe")
|
|
997
1044
|
remindersAssignedToMe Reminder[] @relation("RemindersAssignedToMe")
|
|
998
1045
|
eventTasksAssignedToMe EventTask[] @relation("TasksAssignedToMe")
|
|
999
|
-
checkouts Checkout[]
|
|
1000
|
-
ticketTiersWaitListsIveJoined TicketTier[]
|
|
1001
1046
|
contacts Contact[]
|
|
1002
1047
|
contactLists ContactList[] @relation("UserContactLists")
|
|
1003
1048
|
contactlist ContactList[]
|
|
@@ -1243,16 +1288,16 @@ model Service {
|
|
|
1243
1288
|
additionalInfo String?
|
|
1244
1289
|
coverPhoto String?
|
|
1245
1290
|
|
|
1246
|
-
mission
|
|
1247
|
-
communityInvolvement
|
|
1248
|
-
emergencyContact
|
|
1249
|
-
contactDetails
|
|
1250
|
-
cancellationPolicy
|
|
1291
|
+
mission String?
|
|
1292
|
+
communityInvolvement String?
|
|
1293
|
+
emergencyContact String?
|
|
1294
|
+
contactDetails String?
|
|
1295
|
+
cancellationPolicy ServiceCancellationPolicy? @default(None)
|
|
1251
1296
|
// refundPolicy String?
|
|
1252
1297
|
// insurancePolicy String?
|
|
1253
|
-
availableHours
|
|
1254
|
-
allowsInstantBooking
|
|
1255
|
-
instantBookingLeadTimeHours Int
|
|
1298
|
+
availableHours String?
|
|
1299
|
+
allowsInstantBooking Boolean @default(false)
|
|
1300
|
+
instantBookingLeadTimeHours Int @default(0)
|
|
1256
1301
|
|
|
1257
1302
|
displayGoogleReviewsOnDetailPage Boolean @default(true)
|
|
1258
1303
|
displayBashReviewsOnDetailPage Boolean @default(true)
|
package/src/definitions.ts
CHANGED
|
@@ -216,6 +216,10 @@ export type FilterFields = {
|
|
|
216
216
|
eventFormat: string[];
|
|
217
217
|
};
|
|
218
218
|
|
|
219
|
+
export type ApiEntityApproval = {
|
|
220
|
+
isApproved: boolean;
|
|
221
|
+
};
|
|
222
|
+
|
|
219
223
|
export type TicketTierWherePriceIsAString = Omit<TicketTier, "price"> & {
|
|
220
224
|
price: string;
|
|
221
225
|
} & { cannotDelete: boolean };
|
package/src/extendedSchemas.ts
CHANGED
|
@@ -1,55 +1,58 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AmountOfGuests,
|
|
3
|
-
EventTask,
|
|
4
3
|
AssociatedBash,
|
|
5
4
|
AssociatedService,
|
|
6
|
-
BashEvent,
|
|
7
|
-
Invitation,
|
|
8
|
-
Ticket,
|
|
9
|
-
User,
|
|
10
|
-
TicketTier,
|
|
11
|
-
Service,
|
|
12
|
-
Review,
|
|
13
|
-
Media,
|
|
14
5
|
BashComment,
|
|
15
|
-
|
|
16
|
-
Contact,
|
|
17
|
-
BashNotification,
|
|
6
|
+
BashEvent,
|
|
18
7
|
BashEventPromoCode,
|
|
19
|
-
|
|
8
|
+
BashNotification,
|
|
20
9
|
Checkout,
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
Venue,
|
|
24
|
-
TargetAudience,
|
|
25
|
-
Vendor,
|
|
26
|
-
EventService,
|
|
10
|
+
Contact,
|
|
11
|
+
Coordinates,
|
|
27
12
|
EntertainmentService,
|
|
13
|
+
EventService,
|
|
14
|
+
EventTask,
|
|
28
15
|
Exhibitor,
|
|
29
|
-
|
|
16
|
+
Invitation,
|
|
17
|
+
Link,
|
|
18
|
+
Media,
|
|
30
19
|
Organization,
|
|
31
|
-
VolunteerService,
|
|
32
20
|
Prisma,
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
ServiceRate,
|
|
38
|
-
ServiceDailyRates,
|
|
21
|
+
Recurrence,
|
|
22
|
+
Reminder,
|
|
23
|
+
Review,
|
|
24
|
+
Service,
|
|
39
25
|
ServiceAddon,
|
|
40
|
-
|
|
41
|
-
UserSubscription,
|
|
42
|
-
SocialMediaProfile,
|
|
43
|
-
SocialMediaPlatform,
|
|
44
|
-
ServiceSubscriptionCounts,
|
|
45
|
-
ServiceSpecialRates,
|
|
26
|
+
ServiceBooking,
|
|
46
27
|
ServiceBookingAddOn,
|
|
28
|
+
ServiceBookingCheckout,
|
|
47
29
|
ServiceBookingDay,
|
|
30
|
+
ServiceBookingFee,
|
|
48
31
|
ServiceBookingPackage,
|
|
49
|
-
ServiceBookingCheckout,
|
|
50
|
-
ServiceBooking,
|
|
51
32
|
ServiceBookingPriceBreakdown,
|
|
52
|
-
|
|
33
|
+
ServiceDailyRates,
|
|
34
|
+
ServiceLink,
|
|
35
|
+
ServicePackage,
|
|
36
|
+
ServiceRange,
|
|
37
|
+
ServiceRate,
|
|
38
|
+
ServiceRatesAssociation,
|
|
39
|
+
ServiceSpecialRates,
|
|
40
|
+
ServiceSubscriptionCounts,
|
|
41
|
+
SocialMediaPlatform,
|
|
42
|
+
SocialMediaProfile,
|
|
43
|
+
Sponsor,
|
|
44
|
+
StripeAccount,
|
|
45
|
+
TargetAudience,
|
|
46
|
+
Ticket,
|
|
47
|
+
TicketTier,
|
|
48
|
+
User,
|
|
49
|
+
UserSubscription,
|
|
50
|
+
Vendor,
|
|
51
|
+
Venue,
|
|
52
|
+
VolunteerService,
|
|
53
|
+
TicketTransfer,
|
|
54
|
+
TicketMetadata,
|
|
55
|
+
SponsoredEvent,
|
|
53
56
|
} from "@prisma/client";
|
|
54
57
|
import { SERVICE_LINK_DATA_TO_INCLUDE } from "./definitions";
|
|
55
58
|
import { serviceKeysArray } from "./utils/service/serviceUtils";
|
|
@@ -125,6 +128,8 @@ export const PRIVATE_USER_ACCOUNT_TO_SELECT = {
|
|
|
125
128
|
},
|
|
126
129
|
} satisfies Prisma.UserSelect;
|
|
127
130
|
|
|
131
|
+
export interface SponsoredEventExt extends SponsoredEvent {}
|
|
132
|
+
|
|
128
133
|
export interface BashEventExt extends BashEvent {
|
|
129
134
|
targetAudience?: TargetAudience;
|
|
130
135
|
amountOfGuests?: AmountOfGuests;
|
|
@@ -138,17 +143,8 @@ export interface BashEventExt extends BashEvent {
|
|
|
138
143
|
invitations: Partial<InvitationExt>[];
|
|
139
144
|
coordinates?: Coordinates[];
|
|
140
145
|
venueServiceId?: string;
|
|
141
|
-
venueOwner?:
|
|
142
|
-
|
|
143
|
-
email: string;
|
|
144
|
-
givenName?: string;
|
|
145
|
-
familyName?: string;
|
|
146
|
-
};
|
|
147
|
-
sponsorships?: Array<{
|
|
148
|
-
sponsorId: string;
|
|
149
|
-
sponsorEmail: string;
|
|
150
|
-
name?: string;
|
|
151
|
-
}>;
|
|
146
|
+
venueOwner?: PublicUser;
|
|
147
|
+
sponsorships?: SponsoredEventExt[];
|
|
152
148
|
}
|
|
153
149
|
|
|
154
150
|
export const TICKET_TIER_DATA_TO_INCLUDE = {
|
|
@@ -250,6 +246,56 @@ export const SERVICE_RATES_ASSOCIATION_DATA_TO_INCLUDE = {
|
|
|
250
246
|
media: true,
|
|
251
247
|
} satisfies Prisma.ServiceRatesAssociationInclude;
|
|
252
248
|
|
|
249
|
+
export const VENUE_DATA_TO_CLONE = [] as const;
|
|
250
|
+
|
|
251
|
+
type VenueExtMinusDataToCloneType = Omit<
|
|
252
|
+
Venue,
|
|
253
|
+
UnionFromArray<typeof VENUE_DATA_TO_CLONE>
|
|
254
|
+
>;
|
|
255
|
+
export const VENUE_DATA_TO_REMOVE: RemoveCommonProperties<
|
|
256
|
+
Venue,
|
|
257
|
+
VenueExtMinusDataToCloneType
|
|
258
|
+
>[] = [
|
|
259
|
+
// 'bashEvents',
|
|
260
|
+
] as const;
|
|
261
|
+
|
|
262
|
+
export const VENDOR_DATA_TO_INCLUDE = {
|
|
263
|
+
crowdSize: true,
|
|
264
|
+
serviceRange: true,
|
|
265
|
+
} satisfies Prisma.VendorInclude;
|
|
266
|
+
|
|
267
|
+
export const VOLUNTEER_DATA_TO_INCLUDE = {
|
|
268
|
+
links: {
|
|
269
|
+
include: {
|
|
270
|
+
serviceLinks: true,
|
|
271
|
+
},
|
|
272
|
+
},
|
|
273
|
+
media: true,
|
|
274
|
+
serviceRange: true,
|
|
275
|
+
} satisfies Prisma.VolunteerServiceInclude;
|
|
276
|
+
|
|
277
|
+
export const VENUE_DATA_TO_INCLUDE = {} satisfies Prisma.VenueInclude;
|
|
278
|
+
|
|
279
|
+
export const EVENT_SERVICE_DATA_TO_INCLUDE = {
|
|
280
|
+
crowdSize: true,
|
|
281
|
+
serviceRange: true,
|
|
282
|
+
} satisfies Prisma.EventServiceInclude;
|
|
283
|
+
|
|
284
|
+
export const ENTERTAINMENT_SERVICE_DATA_TO_INCLUDE = {
|
|
285
|
+
crowdSize: true,
|
|
286
|
+
serviceRange: true,
|
|
287
|
+
} satisfies Prisma.EntertainmentServiceInclude;
|
|
288
|
+
|
|
289
|
+
export const SPONSOR_DATA_TO_INCLUDE = {
|
|
290
|
+
crowdSize: true,
|
|
291
|
+
serviceRange: true,
|
|
292
|
+
} satisfies Prisma.SponsorInclude;
|
|
293
|
+
|
|
294
|
+
export const EXHIBITOR_DATA_TO_INCLUDE = {
|
|
295
|
+
crowdSize: true,
|
|
296
|
+
serviceRange: true,
|
|
297
|
+
} satisfies Prisma.ExhibitorInclude;
|
|
298
|
+
|
|
253
299
|
export const SERVICE_DATA_TO_INCLUDE = {
|
|
254
300
|
creator: {
|
|
255
301
|
select: FRONT_END_USER_DATA_TO_SELECT,
|
|
@@ -269,12 +315,30 @@ export const SERVICE_DATA_TO_INCLUDE = {
|
|
|
269
315
|
serviceRatesAssociation: {
|
|
270
316
|
include: SERVICE_RATES_ASSOCIATION_DATA_TO_INCLUDE,
|
|
271
317
|
},
|
|
272
|
-
// bookings: {
|
|
273
|
-
// include: SERVICE_BOOKING_PRIVATE_DATA_TO_INCLUDE, //make sure only to include owned bookedDays
|
|
274
|
-
// },
|
|
275
318
|
bashEvent: {
|
|
276
319
|
include: BASH_EVENT_DATA_TO_INCLUDE,
|
|
277
320
|
},
|
|
321
|
+
venue: {
|
|
322
|
+
include: VENUE_DATA_TO_INCLUDE,
|
|
323
|
+
},
|
|
324
|
+
eventService: {
|
|
325
|
+
include: EVENT_SERVICE_DATA_TO_INCLUDE,
|
|
326
|
+
},
|
|
327
|
+
entertainmentService: {
|
|
328
|
+
include: ENTERTAINMENT_SERVICE_DATA_TO_INCLUDE,
|
|
329
|
+
},
|
|
330
|
+
vendor: {
|
|
331
|
+
include: VENDOR_DATA_TO_INCLUDE,
|
|
332
|
+
},
|
|
333
|
+
exhibitor: {
|
|
334
|
+
include: EXHIBITOR_DATA_TO_INCLUDE,
|
|
335
|
+
},
|
|
336
|
+
sponsor: {
|
|
337
|
+
include: SPONSOR_DATA_TO_INCLUDE,
|
|
338
|
+
},
|
|
339
|
+
// bookings: {
|
|
340
|
+
// include: SERVICE_BOOKING_PRIVATE_DATA_TO_INCLUDE, //make sure only to include owned bookedDays
|
|
341
|
+
// },
|
|
278
342
|
// bookedCheckouts: {
|
|
279
343
|
// include: SERVICE_BOOKING_CHECKOUT_DATA_TO_INCLUDE, //make sure only to include owned checkouts
|
|
280
344
|
// },
|
|
@@ -310,19 +374,6 @@ export interface StripeAccountExt extends StripeAccount {
|
|
|
310
374
|
logo?: Media | null;
|
|
311
375
|
}
|
|
312
376
|
|
|
313
|
-
export const VENUE_DATA_TO_CLONE = [] as const;
|
|
314
|
-
|
|
315
|
-
type VenueExtMinusDataToCloneType = Omit<
|
|
316
|
-
Venue,
|
|
317
|
-
UnionFromArray<typeof VENUE_DATA_TO_CLONE>
|
|
318
|
-
>;
|
|
319
|
-
export const VENUE_DATA_TO_REMOVE: RemoveCommonProperties<
|
|
320
|
-
Venue,
|
|
321
|
-
VenueExtMinusDataToCloneType
|
|
322
|
-
>[] = [
|
|
323
|
-
// 'bashEvents',
|
|
324
|
-
] as const;
|
|
325
|
-
|
|
326
377
|
export interface ServiceRateExt extends ServiceRate {
|
|
327
378
|
serviceSpecialRates?: ServiceSpecialRates;
|
|
328
379
|
serviceDailyRates?: ServiceDailyRates;
|
|
@@ -468,23 +519,23 @@ export interface ServiceExt extends Service {
|
|
|
468
519
|
// availableDateTimes?: Availability[];
|
|
469
520
|
|
|
470
521
|
// rates?: Rate[];
|
|
471
|
-
targetAudience?:
|
|
522
|
+
targetAudience?: TargetAudienceExt | null;
|
|
472
523
|
media?: Media[];
|
|
473
524
|
serviceLinks?: ServiceLinkExt[];
|
|
474
525
|
|
|
475
|
-
eventService?:
|
|
476
|
-
entertainmentService?:
|
|
477
|
-
vendor?:
|
|
478
|
-
exhibitor?:
|
|
479
|
-
sponsor?:
|
|
480
|
-
venue?:
|
|
481
|
-
organization?:
|
|
482
|
-
volunteerService?:
|
|
483
|
-
bashEvent:
|
|
526
|
+
eventService?: EventServiceExt;
|
|
527
|
+
entertainmentService?: EntertainmentServiceExt;
|
|
528
|
+
vendor?: VendorExt;
|
|
529
|
+
exhibitor?: ExhibitorExt;
|
|
530
|
+
sponsor?: SponsorExt;
|
|
531
|
+
venue?: VenueExt;
|
|
532
|
+
organization?: OrganizationExt;
|
|
533
|
+
volunteerService?: VolunteerServiceExt;
|
|
534
|
+
bashEvent: BashEventExt[];
|
|
484
535
|
|
|
485
536
|
serviceRatesAssociation?: ServiceRatesAssociationExt | null;
|
|
486
|
-
associatedBashesReferencingMe?:
|
|
487
|
-
associatedServicesReferencingMe?:
|
|
537
|
+
associatedBashesReferencingMe?: AssociatedBashExt[];
|
|
538
|
+
associatedServicesReferencingMe?: AssociatedServiceExt[];
|
|
488
539
|
|
|
489
540
|
// googleReviews: GoogleReview[];
|
|
490
541
|
|
|
@@ -492,41 +543,33 @@ export interface ServiceExt extends Service {
|
|
|
492
543
|
// bookings?: ServiceBookingExt[];
|
|
493
544
|
}
|
|
494
545
|
export interface EventServiceExt extends EventService {
|
|
495
|
-
service: ServiceExt;
|
|
496
546
|
crowdSize?: AmountOfGuests;
|
|
497
547
|
serviceRange?: ServiceRange;
|
|
498
548
|
}
|
|
499
549
|
|
|
500
550
|
export interface EntertainmentServiceExt extends EntertainmentService {
|
|
501
|
-
service: ServiceExt;
|
|
502
551
|
crowdSize?: AmountOfGuests;
|
|
503
552
|
serviceRange?: ServiceRange;
|
|
504
553
|
}
|
|
505
554
|
|
|
506
555
|
export interface ExhibitorExt extends Exhibitor {
|
|
507
|
-
service: ServiceExt;
|
|
508
556
|
crowdSize?: AmountOfGuests;
|
|
509
557
|
serviceRange?: ServiceRange;
|
|
510
558
|
}
|
|
511
559
|
|
|
512
560
|
export interface SponsorExt extends Sponsor {
|
|
513
|
-
service: ServiceExt;
|
|
514
561
|
crowdSize?: AmountOfGuests;
|
|
515
562
|
serviceRange?: ServiceRange;
|
|
516
563
|
}
|
|
517
564
|
|
|
518
565
|
export interface VendorExt extends Vendor {
|
|
519
|
-
service: ServiceExt;
|
|
520
566
|
crowdSize?: AmountOfGuests;
|
|
567
|
+
serviceRange?: ServiceRange;
|
|
521
568
|
}
|
|
522
569
|
|
|
523
|
-
export interface VenueExt extends Venue {
|
|
524
|
-
service: ServiceExt;
|
|
525
|
-
// crowdSize?: AmountOfGuests;
|
|
526
|
-
}
|
|
570
|
+
export interface VenueExt extends Venue {}
|
|
527
571
|
|
|
528
572
|
export interface OrganizationExt extends Organization {
|
|
529
|
-
service: ServiceExt;
|
|
530
573
|
amountOfGuests?: AmountOfGuests;
|
|
531
574
|
}
|
|
532
575
|
//-----------------------------------------
|
|
@@ -543,25 +586,6 @@ export interface ServiceLinkExt extends ServiceLink {
|
|
|
543
586
|
link: Link;
|
|
544
587
|
}
|
|
545
588
|
|
|
546
|
-
export const VENDOR_DATA_TO_INCLUDE = {
|
|
547
|
-
crowdSize: true,
|
|
548
|
-
} satisfies Prisma.VendorInclude;
|
|
549
|
-
|
|
550
|
-
export const VOLUNTEER_DATA_TO_INCLUDE = {
|
|
551
|
-
links: {
|
|
552
|
-
include: {
|
|
553
|
-
serviceLinks: true,
|
|
554
|
-
},
|
|
555
|
-
},
|
|
556
|
-
media: true,
|
|
557
|
-
serviceRange: true,
|
|
558
|
-
service: {
|
|
559
|
-
include: SERVICE_DATA_TO_INCLUDE,
|
|
560
|
-
},
|
|
561
|
-
} satisfies Prisma.VolunteerServiceInclude;
|
|
562
|
-
|
|
563
|
-
export const VENUE_DATA_TO_INCLUDE = {} satisfies Prisma.VenueInclude;
|
|
564
|
-
|
|
565
589
|
//-----------------------------------------
|
|
566
590
|
|
|
567
591
|
export interface BashNotificationExt extends BashNotification {
|
|
@@ -686,6 +710,8 @@ export interface TicketExt extends Ticket {
|
|
|
686
710
|
owner: PublicUser;
|
|
687
711
|
forUser: PublicUser;
|
|
688
712
|
checkout?: Checkout;
|
|
713
|
+
transfers?: TicketTransfer[];
|
|
714
|
+
metadata?: TicketMetadata[];
|
|
689
715
|
}
|
|
690
716
|
|
|
691
717
|
export interface CheckoutExt extends Checkout {
|
package/src/utils/objUtils.ts
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
export function isObject(value: unknown): value is Record<string, unknown> {
|
|
2
|
-
return
|
|
2
|
+
return (
|
|
3
|
+
typeof value === "object" &&
|
|
4
|
+
value !== null &&
|
|
5
|
+
!Array.isArray(value) &&
|
|
6
|
+
!(value instanceof Date)
|
|
7
|
+
);
|
|
3
8
|
}
|
|
4
|
-
|
|
5
9
|
export function deepMerge<
|
|
6
10
|
T extends Record<string, any>,
|
|
7
11
|
U extends Record<string, any>
|
|
@@ -10,7 +14,7 @@ export function deepMerge<
|
|
|
10
14
|
source: U | undefined | null,
|
|
11
15
|
mergeArrays: boolean = false,
|
|
12
16
|
mergeCommon: boolean = false
|
|
13
|
-
): T
|
|
17
|
+
): T {
|
|
14
18
|
const output = { ...(mergeCommon ? [] : target) } as T & U;
|
|
15
19
|
|
|
16
20
|
for (const key in source) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { ServiceExt } from "../../extendedSchemas";
|
|
2
|
+
import { DeepPartial } from "../typeUtils";
|
|
3
3
|
// import {
|
|
4
4
|
// specialRateConvertToDb,
|
|
5
5
|
// generalRatesConvertRatesToDB,
|
|
@@ -7,7 +7,9 @@ import { ServiceExt, ServiceSpecialRatesExt } from "../../extendedSchemas";
|
|
|
7
7
|
// generalRatesConvertRatesFromDB,
|
|
8
8
|
// } from "./serviceRateDBUtils";
|
|
9
9
|
|
|
10
|
-
export function serviceToDb(
|
|
10
|
+
export function serviceToDb(
|
|
11
|
+
service: DeepPartial<ServiceExt>
|
|
12
|
+
): DeepPartial<ServiceExt> {
|
|
11
13
|
if (service.serviceRatesAssociation) {
|
|
12
14
|
// service.serviceRatesAssociation.serviceSpecialRates =
|
|
13
15
|
// service.serviceRatesAssociation.serviceSpecialRates?.map(
|
|
@@ -157,9 +157,7 @@ export function serviceGetSpecificType<BookingType extends Service>(
|
|
|
157
157
|
return null;
|
|
158
158
|
}
|
|
159
159
|
|
|
160
|
-
const specificId = service[
|
|
161
|
-
`${specificFieldName}Id` as keyof BookingType
|
|
162
|
-
] as string;
|
|
160
|
+
const specificId = service[`${specificFieldName}Id`] as string;
|
|
163
161
|
|
|
164
162
|
return {
|
|
165
163
|
serviceId: service.id,
|
|
@@ -211,7 +209,61 @@ export const specificServiceMap: Record<ServiceTypes, ServiceSpecificName> = {
|
|
|
211
209
|
Venues: "venue",
|
|
212
210
|
Organizations: "organization",
|
|
213
211
|
} as const;
|
|
214
|
-
|
|
215
|
-
|
|
212
|
+
export const serviceTypeToField = (
|
|
213
|
+
serviceType: ServiceTypes
|
|
214
|
+
): ServiceSpecificName => {
|
|
216
215
|
return specificServiceMap[serviceType];
|
|
217
216
|
};
|
|
217
|
+
|
|
218
|
+
// export type SpecificServiceMap = {
|
|
219
|
+
// [P in keyof T]: ServiceSpecificInfo;
|
|
220
|
+
// };
|
|
221
|
+
|
|
222
|
+
// type ServiceExtKeyMap = {
|
|
223
|
+
// EventServices: "eventService";
|
|
224
|
+
// EntertainmentServices: "entertainmentService";
|
|
225
|
+
// Vendors: "vendor";
|
|
226
|
+
// Exhibitors: "exhibitor";
|
|
227
|
+
// Sponsors: "sponsor";
|
|
228
|
+
// Venues: "venue";
|
|
229
|
+
// Organizations: "organization";
|
|
230
|
+
// };
|
|
231
|
+
// export type ServiceExtKey<T extends ServiceTypes> = ServiceExtKeyMap[T];
|
|
232
|
+
// export type ServiceSpecificInfo = {
|
|
233
|
+
// description: string;
|
|
234
|
+
// };
|
|
235
|
+
|
|
236
|
+
// export type ServiceSpecificInfoMap<T> = {
|
|
237
|
+
// [P in keyof T]: ServiceSpecificInfo;
|
|
238
|
+
// };
|
|
239
|
+
// export type SpecificServiceInfoMap = {
|
|
240
|
+
// [K in ServiceTypes]: ServiceSpecificInfoMap<
|
|
241
|
+
// ServiceExt[ServiceExtKey<K>]
|
|
242
|
+
// >;
|
|
243
|
+
// };
|
|
244
|
+
|
|
245
|
+
// export const serviceSpecificInfo = {
|
|
246
|
+
// EventServices:{
|
|
247
|
+
|
|
248
|
+
// },
|
|
249
|
+
// EntertainmentServices: {
|
|
250
|
+
|
|
251
|
+
// },
|
|
252
|
+
// Vendors:{
|
|
253
|
+
|
|
254
|
+
// },
|
|
255
|
+
// Exhibitors:{
|
|
256
|
+
|
|
257
|
+
// };
|
|
258
|
+
// Sponsors:{
|
|
259
|
+
|
|
260
|
+
// },
|
|
261
|
+
// Venues:{
|
|
262
|
+
// venueTypes: {
|
|
263
|
+
// description: `venueTypes (array of primary venue types)`
|
|
264
|
+
// }
|
|
265
|
+
// },
|
|
266
|
+
// Organizations: {
|
|
267
|
+
|
|
268
|
+
// },
|
|
269
|
+
// } as SpecificServiceInfoMap;
|
package/src/utils/typeUtils.ts
CHANGED
|
@@ -6,6 +6,20 @@ export type RemoveCommonProperties<T, U> = keyof (Omit<T, keyof U> &
|
|
|
6
6
|
export type MakeOptional<T, K extends keyof T> = Omit<T, K> &
|
|
7
7
|
Partial<Pick<T, K>>;
|
|
8
8
|
|
|
9
|
+
export type MakeRequired<T, K extends keyof T> = Omit<T, K> &
|
|
10
|
+
Required<Pick<T, K>>;
|
|
11
|
+
|
|
12
|
+
export type DeepPartial<T> =
|
|
13
|
+
| T extends Function
|
|
14
|
+
? T
|
|
15
|
+
: T extends Array<infer U>
|
|
16
|
+
? Array<DeepPartial<U>>
|
|
17
|
+
: T extends object
|
|
18
|
+
? { [P in keyof T]?: DeepPartial<T[P]> }
|
|
19
|
+
: T;
|
|
20
|
+
|
|
21
|
+
export type Override<T, U> = Omit<T, keyof U> & U;
|
|
22
|
+
|
|
9
23
|
// Create the final object dynamically
|
|
10
24
|
export function createAllTrueObject<T extends string>(
|
|
11
25
|
keys: T[]
|