@glissandoo/lib 1.53.2 → 1.53.4
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,12 +1,9 @@
|
|
|
1
|
-
import { LanguagesTypes } from '../../../lang';
|
|
2
1
|
import { AEventPlayerBasicData } from '../types';
|
|
3
2
|
import { EventPlayerStatus } from './types';
|
|
4
3
|
export default class EventoPlayerBasic {
|
|
5
4
|
eventId: string;
|
|
6
|
-
exists: boolean;
|
|
7
5
|
protected data: AEventPlayerBasicData;
|
|
8
|
-
|
|
9
|
-
constructor(eventId: string, data: AEventPlayerBasicData | null, lang?: LanguagesTypes);
|
|
6
|
+
constructor(eventId: string, data: AEventPlayerBasicData);
|
|
10
7
|
get id(): string;
|
|
11
8
|
get username(): string;
|
|
12
9
|
get displayName(): string;
|
|
@@ -20,6 +17,9 @@ export default class EventoPlayerBasic {
|
|
|
20
17
|
get selected(): boolean | null;
|
|
21
18
|
get isActive(): boolean;
|
|
22
19
|
get isInterested(): boolean;
|
|
20
|
+
get isPendingInterested(): boolean;
|
|
21
|
+
get isSelected(): boolean;
|
|
22
|
+
get isDiscarded(): boolean;
|
|
23
23
|
get isConfirmed(): boolean;
|
|
24
24
|
get isDeclined(): boolean;
|
|
25
25
|
get isPending(): boolean;
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const lodash_1 = require("lodash");
|
|
4
|
-
const lang_1 = require("../../../lang");
|
|
5
4
|
const types_1 = require("./types");
|
|
6
5
|
class EventoPlayerBasic {
|
|
7
|
-
constructor(eventId, data
|
|
6
|
+
constructor(eventId, data) {
|
|
8
7
|
this.eventId = eventId;
|
|
9
|
-
this.data = data
|
|
10
|
-
this.exists = data !== null;
|
|
11
|
-
this.lang = lang;
|
|
8
|
+
this.data = data;
|
|
12
9
|
}
|
|
13
10
|
get id() {
|
|
14
11
|
return this.data.id;
|
|
@@ -44,11 +41,20 @@ class EventoPlayerBasic {
|
|
|
44
41
|
return !(0, lodash_1.isUndefined)(this.data.selected) ? this.data.selected : null;
|
|
45
42
|
}
|
|
46
43
|
get isActive() {
|
|
47
|
-
return this.
|
|
44
|
+
return !this.isDiscarded;
|
|
48
45
|
}
|
|
49
46
|
get isInterested() {
|
|
50
47
|
return this.interested === true;
|
|
51
48
|
}
|
|
49
|
+
get isPendingInterested() {
|
|
50
|
+
return this.interested === null;
|
|
51
|
+
}
|
|
52
|
+
get isSelected() {
|
|
53
|
+
return this.selected === true;
|
|
54
|
+
}
|
|
55
|
+
get isDiscarded() {
|
|
56
|
+
return this.selected === false;
|
|
57
|
+
}
|
|
52
58
|
get isConfirmed() {
|
|
53
59
|
return this.status === types_1.EventPlayerStatus.Confirmed;
|
|
54
60
|
}
|
package/models/Evento/index.d.ts
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import { InstrumentId } from '../../helpers/instruments';
|
|
2
2
|
import { LanguagesTypes } from '../../lang';
|
|
3
3
|
import { DocumentReference, DocumentSnapshot } from '../../types/firestore';
|
|
4
|
+
import EventoPlayerBasic from './Player/basic';
|
|
4
5
|
import EventoPromoter from './promoter';
|
|
5
|
-
import { EventData, EventResponseDeadlineOptions, EventStatusByTime } from './types';
|
|
6
|
-
|
|
6
|
+
import { AEventPlayerBasicData, EventData, EventResponseDeadlineOptions, EventStatusByTime } from './types';
|
|
7
|
+
interface PlayerListOptions {
|
|
8
|
+
showAll?: boolean;
|
|
9
|
+
order?: InstrumentId[];
|
|
10
|
+
asObject?: boolean;
|
|
11
|
+
}
|
|
7
12
|
export default class Evento extends EventoPromoter<EventData> {
|
|
8
13
|
constructor(doc: DocumentSnapshot, lang?: LanguagesTypes);
|
|
9
14
|
get maxAttendance(): number | null;
|
|
@@ -17,9 +22,7 @@ export default class Evento extends EventoPromoter<EventData> {
|
|
|
17
22
|
get relEvents(): string[];
|
|
18
23
|
get isASerie(): boolean;
|
|
19
24
|
get playerIds(): string[];
|
|
20
|
-
get players():
|
|
21
|
-
[x: string]: EventoPlayerBasic;
|
|
22
|
-
};
|
|
25
|
+
get players(): Record<string, import("./types").EventPlayerBasicData>;
|
|
23
26
|
get playersCount(): number;
|
|
24
27
|
get repertory(): Record<string, import("./types").EventThemeBasicData>;
|
|
25
28
|
get repertoryIds(): string[];
|
|
@@ -48,22 +51,19 @@ export default class Evento extends EventoPromoter<EventData> {
|
|
|
48
51
|
tags: string[];
|
|
49
52
|
media: import("../Repertory/types").ThemeMediaType | null;
|
|
50
53
|
}[];
|
|
51
|
-
playersList(
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
get
|
|
56
|
-
get
|
|
57
|
-
get
|
|
58
|
-
get pendingPlayers(): string[];
|
|
59
|
-
get confirmedRollCallPlayers(): string[];
|
|
60
|
-
get declinedRollCallPlayers(): string[];
|
|
54
|
+
playersList<T extends PlayerListOptions>(data?: T): T['asObject'] extends true ? AEventPlayerBasicData[] : EventoPlayerBasic[];
|
|
55
|
+
get interestedPlayers(): EventoPlayerBasic[];
|
|
56
|
+
get confirmedPlayers(): EventoPlayerBasic[];
|
|
57
|
+
get declinedPlayers(): EventoPlayerBasic[];
|
|
58
|
+
get pendingPlayers(): EventoPlayerBasic[];
|
|
59
|
+
get confirmedRollCallPlayers(): EventoPlayerBasic[];
|
|
60
|
+
get declinedRollCallPlayers(): EventoPlayerBasic[];
|
|
61
61
|
get isRollCalled(): boolean;
|
|
62
62
|
get isActiveRollCall(): boolean;
|
|
63
63
|
get templateId(): string | null;
|
|
64
64
|
get repeat(): import("./types").EventRepeatType | null;
|
|
65
65
|
isPlayer: (userId: string) => boolean;
|
|
66
|
-
getPlayer: (userId: string) => EventoPlayerBasic;
|
|
66
|
+
getPlayer: (userId: string) => EventoPlayerBasic | null;
|
|
67
67
|
get responseDeadline(): {
|
|
68
68
|
option: EventResponseDeadlineOptions;
|
|
69
69
|
customAt: import("../../types/firestore").Timestamp | null;
|
|
@@ -73,3 +73,4 @@ export default class Evento extends EventoPromoter<EventData> {
|
|
|
73
73
|
get isSelectionModeClose(): boolean;
|
|
74
74
|
get isSelectionModeOpen(): boolean;
|
|
75
75
|
}
|
|
76
|
+
export {};
|
package/models/Evento/index.js
CHANGED
|
@@ -8,9 +8,9 @@ const lodash_1 = require("lodash");
|
|
|
8
8
|
const orders_1 = require("../../helpers/musicStyles/orders");
|
|
9
9
|
const utils_1 = require("../../helpers/utils");
|
|
10
10
|
const lang_1 = require("../../lang");
|
|
11
|
+
const basic_1 = __importDefault(require("./Player/basic"));
|
|
11
12
|
const promoter_1 = __importDefault(require("./promoter"));
|
|
12
13
|
const types_1 = require("./types");
|
|
13
|
-
const Basic_1 = __importDefault(require("./Player/Basic"));
|
|
14
14
|
class Evento extends promoter_1.default {
|
|
15
15
|
constructor(doc, lang = lang_1.defaultLocale) {
|
|
16
16
|
super(doc, lang);
|
|
@@ -19,8 +19,8 @@ class Evento extends promoter_1.default {
|
|
|
19
19
|
};
|
|
20
20
|
this.getPlayer = (userId) => {
|
|
21
21
|
return userId in this.players
|
|
22
|
-
? this.players[userId]
|
|
23
|
-
:
|
|
22
|
+
? new basic_1.default(this.id, { id: userId, ...this.players[userId] })
|
|
23
|
+
: null;
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
26
|
get maxAttendance() {
|
|
@@ -57,7 +57,7 @@ class Evento extends promoter_1.default {
|
|
|
57
57
|
return this.data.playerIds || [];
|
|
58
58
|
}
|
|
59
59
|
get players() {
|
|
60
|
-
return
|
|
60
|
+
return this.data.players || {};
|
|
61
61
|
}
|
|
62
62
|
get playersCount() {
|
|
63
63
|
return this.data.playerIds.length;
|
|
@@ -133,32 +133,37 @@ class Evento extends promoter_1.default {
|
|
|
133
133
|
}));
|
|
134
134
|
return (0, lodash_1.orderBy)(repertory, 'order', 'asc');
|
|
135
135
|
}
|
|
136
|
-
playersList({ showAll, order } = {}) {
|
|
137
|
-
const players =
|
|
136
|
+
playersList({ showAll, order, asObject } = {}) {
|
|
137
|
+
const players = asObject
|
|
138
|
+
? Object.entries(this.players).map(([id, player]) => ({
|
|
139
|
+
id,
|
|
140
|
+
...player,
|
|
141
|
+
}))
|
|
142
|
+
: Object.entries(this.players).map(([id, player]) => new basic_1.default(this.id, { id, ...player }));
|
|
138
143
|
const orderedPlayers = order
|
|
139
144
|
? (0, utils_1.sortByMatch)(players, 'mainInstrument', order)
|
|
140
145
|
: (0, orders_1.orderByMusicStyle)(players, 'mainInstrument', this.promoterInfo.musicStyle);
|
|
141
146
|
if (showAll)
|
|
142
147
|
return orderedPlayers;
|
|
143
|
-
return orderedPlayers.filter((player) => player.
|
|
148
|
+
return orderedPlayers.filter((player) => player.selected !== false);
|
|
144
149
|
}
|
|
145
150
|
get interestedPlayers() {
|
|
146
|
-
return this.
|
|
151
|
+
return this.playersList({ showAll: true }).filter((player) => player.isInterested);
|
|
147
152
|
}
|
|
148
153
|
get confirmedPlayers() {
|
|
149
|
-
return this.
|
|
154
|
+
return this.playersList().filter((player) => player.isConfirmed);
|
|
150
155
|
}
|
|
151
156
|
get declinedPlayers() {
|
|
152
|
-
return this.
|
|
157
|
+
return this.playersList().filter((player) => player.isDeclined);
|
|
153
158
|
}
|
|
154
159
|
get pendingPlayers() {
|
|
155
|
-
return this.
|
|
160
|
+
return this.playersList().filter((player) => player.isPending);
|
|
156
161
|
}
|
|
157
162
|
get confirmedRollCallPlayers() {
|
|
158
|
-
return this.
|
|
163
|
+
return this.playersList().filter((player) => player.isRollCallConfirmed);
|
|
159
164
|
}
|
|
160
165
|
get declinedRollCallPlayers() {
|
|
161
|
-
return this.
|
|
166
|
+
return this.playersList().filter((player) => player.isRollCallDeclined);
|
|
162
167
|
}
|
|
163
168
|
get isRollCalled() {
|
|
164
169
|
return this.rollCalledAt !== null;
|