@dev-crew-berlin/enter-js-utils 0.20.0 → 0.21.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/dist/models/attendee.d.ts +2 -1
- package/dist/models/attendee.js +15 -0
- package/package.json +1 -1
|
@@ -8,7 +8,7 @@ export declare type AttendeeJSON = {
|
|
|
8
8
|
userdata: Record<string, FieldValue>;
|
|
9
9
|
tags: string[] | null;
|
|
10
10
|
language: string | null;
|
|
11
|
-
time:
|
|
11
|
+
time: string;
|
|
12
12
|
rsvp: Record<string, number | null>;
|
|
13
13
|
checkin: Record<string, CheckinsJSON>;
|
|
14
14
|
companions: {
|
|
@@ -48,6 +48,7 @@ export declare class Attendee {
|
|
|
48
48
|
} | null;
|
|
49
49
|
deleted: boolean;
|
|
50
50
|
constructor(rawAttendee: RawAttendee);
|
|
51
|
+
toJSON(): AttendeeJSON;
|
|
51
52
|
getRsvpCountForTag(checkinTag: string): number;
|
|
52
53
|
getResponseForTag(checkinTag: string): 'no-response' | 'negative-repsone' | 'positive-response';
|
|
53
54
|
getCheckinsForTag(checkinTag: string): Checkins;
|
package/dist/models/attendee.js
CHANGED
|
@@ -18,6 +18,21 @@ export class Attendee {
|
|
|
18
18
|
this.deleted = rawAttendee.deleted;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
+
toJSON() {
|
|
22
|
+
// this is exactly what js also provides out of the box
|
|
23
|
+
// but then typescript complains that there is no toJSON function
|
|
24
|
+
// so we implement it here again by hand
|
|
25
|
+
// convert each checkin to its json representation
|
|
26
|
+
const checkin = Object.entries(this.checkin).reduce((obj, [tag, checkins]) => {
|
|
27
|
+
obj[tag] = checkins.toJSON();
|
|
28
|
+
return obj;
|
|
29
|
+
}, {});
|
|
30
|
+
return { ...this,
|
|
31
|
+
time: this.time.toISOString(),
|
|
32
|
+
checkin
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
|
|
21
36
|
getRsvpCountForTag(checkinTag) {
|
|
22
37
|
const rsvp = this.rsvp[checkinTag];
|
|
23
38
|
if (!rsvp) return 0;
|