@sellout/models 0.0.429 → 0.0.431
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/.dist/graphql/fragments/event.fragment.d.ts +1 -0
- package/.dist/graphql/fragments/event.fragment.js +16 -0
- package/.dist/graphql/fragments/event.fragment.js.map +1 -1
- package/.dist/graphql/mutations/checkInGuestListEntry.mutation.d.ts +2 -0
- package/.dist/graphql/mutations/checkInGuestListEntry.mutation.js +23 -0
- package/.dist/graphql/mutations/checkInGuestListEntry.mutation.js.map +1 -0
- package/.dist/graphql/mutations/createGuestListEntry.mutation.d.ts +2 -0
- package/.dist/graphql/mutations/createGuestListEntry.mutation.js +23 -0
- package/.dist/graphql/mutations/createGuestListEntry.mutation.js.map +1 -0
- package/.dist/graphql/mutations/deleteGuestListEntry.mutation.d.ts +2 -0
- package/.dist/graphql/mutations/deleteGuestListEntry.mutation.js +23 -0
- package/.dist/graphql/mutations/deleteGuestListEntry.mutation.js.map +1 -0
- package/.dist/graphql/mutations/sendRegistrationEmailCode.mutation.d.ts +2 -0
- package/.dist/graphql/mutations/sendRegistrationEmailCode.mutation.js +10 -0
- package/.dist/graphql/mutations/sendRegistrationEmailCode.mutation.js.map +1 -0
- package/.dist/graphql/mutations/verifyRegistrationEmailCode.mutation.d.ts +2 -0
- package/.dist/graphql/mutations/verifyRegistrationEmailCode.mutation.js +10 -0
- package/.dist/graphql/mutations/verifyRegistrationEmailCode.mutation.js.map +1 -0
- package/.dist/graphql/queries/event.query.js +2 -0
- package/.dist/graphql/queries/event.query.js.map +1 -1
- package/.dist/graphql/queries/eventGuestList.query.d.ts +2 -0
- package/.dist/graphql/queries/eventGuestList.query.js +40 -0
- package/.dist/graphql/queries/eventGuestList.query.js.map +1 -0
- package/.dist/interfaces/IEmailVerification.d.ts +8 -0
- package/.dist/interfaces/IEmailVerification.js +3 -0
- package/.dist/interfaces/IEmailVerification.js.map +1 -0
- package/.dist/interfaces/IEvent.d.ts +2 -0
- package/.dist/interfaces/IEvent.js.map +1 -1
- package/.dist/interfaces/IGuestListCheckIn.d.ts +6 -0
- package/.dist/interfaces/IGuestListCheckIn.js +3 -0
- package/.dist/interfaces/IGuestListCheckIn.js.map +1 -0
- package/.dist/interfaces/IGuestListEntry.d.ts +9 -0
- package/.dist/interfaces/IGuestListEntry.js +3 -0
- package/.dist/interfaces/IGuestListEntry.js.map +1 -0
- package/.dist/interfaces/ITask.d.ts +2 -1
- package/.dist/interfaces/ITask.js +1 -0
- package/.dist/interfaces/ITask.js.map +1 -1
- package/.dist/schemas/Event.d.ts +46 -0
- package/.dist/schemas/Event.js +48 -0
- package/.dist/schemas/Event.js.map +1 -1
- package/.dist/sellout-proto.js +43109 -37799
- package/.dist/utils/EventUtil.d.ts +9 -0
- package/.dist/utils/EventUtil.js +59 -0
- package/.dist/utils/EventUtil.js.map +1 -1
- package/package.json +3 -3
- package/src/graphql/fragments/event.fragment.ts +17 -0
- package/src/graphql/mutations/checkInGuestListEntry.mutation.ts +22 -0
- package/src/graphql/mutations/createGuestListEntry.mutation.ts +22 -0
- package/src/graphql/mutations/deleteGuestListEntry.mutation.ts +22 -0
- package/src/graphql/mutations/sendRegistrationEmailCode.mutation.ts +10 -0
- package/src/graphql/mutations/verifyRegistrationEmailCode.mutation.ts +10 -0
- package/src/graphql/queries/event.query.ts +2 -0
- package/src/graphql/queries/eventGuestList.query.ts +36 -0
- package/src/interfaces/IEmailVerification.ts +8 -0
- package/src/interfaces/IEvent.ts +2 -0
- package/src/interfaces/IGuestListCheckIn.ts +6 -0
- package/src/interfaces/IGuestListEntry.ts +10 -0
- package/src/interfaces/ITask.ts +1 -0
- package/src/proto/event.proto +96 -0
- package/src/proto/user.proto +35 -0
- package/src/schemas/Event.ts +50 -0
- package/src/utils/EventUtil.ts +92 -0
package/src/proto/user.proto
CHANGED
|
@@ -67,6 +67,38 @@ message VerifyUserEmailResponse {
|
|
|
67
67
|
bool emailVerified = 2;
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
+
message SendRegistrationEmailCodeRequest {
|
|
71
|
+
string spanContext = 1;
|
|
72
|
+
string email = 2;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
message SendRegistrationEmailCodeResponse {
|
|
76
|
+
StatusCode status = 1;
|
|
77
|
+
repeated Error errors = 2;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
message VerifyRegistrationEmailCodeRequest {
|
|
81
|
+
string spanContext = 1;
|
|
82
|
+
string email = 2;
|
|
83
|
+
string code = 3;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
message VerifyRegistrationEmailCodeResponse {
|
|
87
|
+
StatusCode status = 1;
|
|
88
|
+
repeated Error errors = 2;
|
|
89
|
+
bool emailVerified = 3;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
message ClearExpiredRegistrationEmailCodesRequest {
|
|
93
|
+
string spanContext = 1;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
message ClearExpiredRegistrationEmailCodesResponse {
|
|
97
|
+
StatusCode status = 1;
|
|
98
|
+
repeated Error errors = 2;
|
|
99
|
+
int32 deletedCount = 3;
|
|
100
|
+
}
|
|
101
|
+
|
|
70
102
|
//Verify Phone
|
|
71
103
|
message SendUserPhoneVerificationRequest {
|
|
72
104
|
string spanContext = 1;
|
|
@@ -460,6 +492,9 @@ service UserService {
|
|
|
460
492
|
// Verify
|
|
461
493
|
rpc sendUserEmailVerification(SendUserEmailVerificationRequest) returns (SendUserEmailVerificationResponse) {}
|
|
462
494
|
rpc verifyUserEmail(VerifyUserEmailRequest) returns (VerifyUserEmailResponse) {}
|
|
495
|
+
rpc sendRegistrationEmailCode(SendRegistrationEmailCodeRequest) returns (SendRegistrationEmailCodeResponse) {}
|
|
496
|
+
rpc verifyRegistrationEmailCode(VerifyRegistrationEmailCodeRequest) returns (VerifyRegistrationEmailCodeResponse) {}
|
|
497
|
+
rpc clearExpiredRegistrationEmailCodes(ClearExpiredRegistrationEmailCodesRequest) returns (ClearExpiredRegistrationEmailCodesResponse) {}
|
|
463
498
|
rpc sendUserPhoneVerification(SendUserPhoneVerificationRequest) returns (SendUserPhoneVerificationResponse) {}
|
|
464
499
|
rpc verifyUserPhoneNumber(VerifyUserPhoneNumberRequest) returns (VerifyUserPhoneNumberResponse) {}
|
|
465
500
|
// Auth
|
package/src/schemas/Event.ts
CHANGED
|
@@ -370,6 +370,55 @@ const TicketHold = {
|
|
|
370
370
|
|
|
371
371
|
};
|
|
372
372
|
|
|
373
|
+
const GuestListCheckIn = {
|
|
374
|
+
_id: false,
|
|
375
|
+
startsAt: {
|
|
376
|
+
type: Number,
|
|
377
|
+
required: true,
|
|
378
|
+
},
|
|
379
|
+
checkedIn: {
|
|
380
|
+
type: Boolean,
|
|
381
|
+
required: true,
|
|
382
|
+
default: false,
|
|
383
|
+
},
|
|
384
|
+
checkedInAt: {
|
|
385
|
+
type: Number,
|
|
386
|
+
required: false,
|
|
387
|
+
default: null,
|
|
388
|
+
},
|
|
389
|
+
checkedInBy: {
|
|
390
|
+
type: String,
|
|
391
|
+
required: false,
|
|
392
|
+
default: null,
|
|
393
|
+
},
|
|
394
|
+
};
|
|
395
|
+
|
|
396
|
+
const GuestListEntry = {
|
|
397
|
+
_id: {
|
|
398
|
+
type: String,
|
|
399
|
+
default: shortid.generate,
|
|
400
|
+
},
|
|
401
|
+
firstName: {
|
|
402
|
+
type: String,
|
|
403
|
+
required: true,
|
|
404
|
+
trim: true,
|
|
405
|
+
},
|
|
406
|
+
lastName: {
|
|
407
|
+
type: String,
|
|
408
|
+
required: true,
|
|
409
|
+
trim: true,
|
|
410
|
+
},
|
|
411
|
+
createdAt: {
|
|
412
|
+
type: Number,
|
|
413
|
+
required: true,
|
|
414
|
+
},
|
|
415
|
+
createdBy: {
|
|
416
|
+
type: String,
|
|
417
|
+
required: false,
|
|
418
|
+
},
|
|
419
|
+
checkIns: [GuestListCheckIn],
|
|
420
|
+
};
|
|
421
|
+
|
|
373
422
|
const TicketTier = {
|
|
374
423
|
_id: {
|
|
375
424
|
type: String,
|
|
@@ -618,6 +667,7 @@ export default {
|
|
|
618
667
|
performances: [Performance],
|
|
619
668
|
ticketTypes: [TicketType],
|
|
620
669
|
holds: [TicketHold],
|
|
670
|
+
guestList: [GuestListEntry],
|
|
621
671
|
upgrades: [EventUpgrade],
|
|
622
672
|
promotions: [EventPromotion],
|
|
623
673
|
customFields: [EventCustomFields],
|
package/src/utils/EventUtil.ts
CHANGED
|
@@ -16,6 +16,8 @@ import { DropDownEnum } from "../enums/DropDownEnum";
|
|
|
16
16
|
import { SendQRCodeEnum } from "../interfaces/IEvent";
|
|
17
17
|
import IEventSchedule from "../interfaces/IEventSchedule";
|
|
18
18
|
import ITicketHold from "../interfaces/ITicketHold";
|
|
19
|
+
import IGuestListEntry from "../interfaces/IGuestListEntry";
|
|
20
|
+
import IGuestListCheckIn from "../interfaces/IGuestListCheckIn";
|
|
19
21
|
import IEmailHolders from "../interfaces/IEmailHolders";
|
|
20
22
|
|
|
21
23
|
export default {
|
|
@@ -241,6 +243,96 @@ export default {
|
|
|
241
243
|
return event?.holds.find((ticketHold) => ticketHold._id === ticketHoldId);
|
|
242
244
|
},
|
|
243
245
|
|
|
246
|
+
/****************************************************************************************
|
|
247
|
+
* Guest List
|
|
248
|
+
****************************************************************************************/
|
|
249
|
+
|
|
250
|
+
plainGuestEntry(value: any): any {
|
|
251
|
+
return value && typeof value.toObject === "function"
|
|
252
|
+
? value.toObject()
|
|
253
|
+
: value;
|
|
254
|
+
},
|
|
255
|
+
|
|
256
|
+
guestListDays(event: IEvent): number[] {
|
|
257
|
+
const scheduled = (event?.performances?.[0]?.schedule ?? [])
|
|
258
|
+
.map((day) => day?.startsAt)
|
|
259
|
+
.filter((startsAt): startsAt is number => Boolean(startsAt));
|
|
260
|
+
|
|
261
|
+
if (scheduled.length) {
|
|
262
|
+
return Array.from(new Set(scheduled)).sort((a, b) => a - b);
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
return event?.schedule?.startsAt ? [event.schedule.startsAt] : [];
|
|
266
|
+
},
|
|
267
|
+
|
|
268
|
+
syncGuestListDays(event: IEvent): IGuestListEntry[] {
|
|
269
|
+
const guestList = event?.guestList ?? [];
|
|
270
|
+
|
|
271
|
+
if (!guestList.length) return guestList;
|
|
272
|
+
|
|
273
|
+
const days = this.guestListDays(event);
|
|
274
|
+
|
|
275
|
+
if (!days.length) return guestList;
|
|
276
|
+
|
|
277
|
+
const isCurrentDay = new Set(days);
|
|
278
|
+
|
|
279
|
+
return guestList.map((hydrated) => {
|
|
280
|
+
const entry = this.plainGuestEntry(hydrated);
|
|
281
|
+
const existing: IGuestListCheckIn[] = (entry?.checkIns ?? []).map(
|
|
282
|
+
(checkIn) => this.plainGuestEntry(checkIn)
|
|
283
|
+
);
|
|
284
|
+
const byDay = new Map(existing.map((checkIn) => [checkIn.startsAt, checkIn]));
|
|
285
|
+
|
|
286
|
+
const current: IGuestListCheckIn[] = days.map(
|
|
287
|
+
(startsAt) =>
|
|
288
|
+
byDay.get(startsAt) ?? {
|
|
289
|
+
startsAt,
|
|
290
|
+
checkedIn: false,
|
|
291
|
+
checkedInAt: null,
|
|
292
|
+
checkedInBy: null,
|
|
293
|
+
}
|
|
294
|
+
);
|
|
295
|
+
|
|
296
|
+
const attended = existing.filter(
|
|
297
|
+
(checkIn) => checkIn.checkedIn && !isCurrentDay.has(checkIn.startsAt)
|
|
298
|
+
);
|
|
299
|
+
|
|
300
|
+
return {
|
|
301
|
+
...entry,
|
|
302
|
+
checkIns: [...current, ...attended].sort(
|
|
303
|
+
(a, b) => a.startsAt - b.startsAt
|
|
304
|
+
),
|
|
305
|
+
};
|
|
306
|
+
});
|
|
307
|
+
},
|
|
308
|
+
|
|
309
|
+
shiftGuestListDays(event: IEvent, timeDelta: number): IGuestListEntry[] {
|
|
310
|
+
return (event?.guestList ?? []).map((hydrated) => {
|
|
311
|
+
const entry = this.plainGuestEntry(hydrated);
|
|
312
|
+
return {
|
|
313
|
+
...entry,
|
|
314
|
+
checkIns: (entry?.checkIns ?? []).map((checkIn) => ({
|
|
315
|
+
...this.plainGuestEntry(checkIn),
|
|
316
|
+
startsAt: checkIn.startsAt + timeDelta,
|
|
317
|
+
})),
|
|
318
|
+
};
|
|
319
|
+
});
|
|
320
|
+
},
|
|
321
|
+
|
|
322
|
+
currentGuestListDay(
|
|
323
|
+
event: IEvent,
|
|
324
|
+
timezone: string,
|
|
325
|
+
at: number = Time.now()
|
|
326
|
+
): number | null {
|
|
327
|
+
const day = (seconds: number) => Time.format(seconds, "YYYY-MM-DD", timezone);
|
|
328
|
+
const today = day(at);
|
|
329
|
+
|
|
330
|
+
return (
|
|
331
|
+
this.guestListDays(event).find((startsAt) => day(startsAt) === today) ??
|
|
332
|
+
null
|
|
333
|
+
);
|
|
334
|
+
},
|
|
335
|
+
|
|
244
336
|
/****************************************************************************************
|
|
245
337
|
* Tickets
|
|
246
338
|
****************************************************************************************/
|