@glissandoo/lib 1.60.0 → 1.61.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/functions/auth.js +1 -2
- package/functions/communication.js +1 -2
- package/functions/communicationComment.js +1 -2
- package/functions/customer.js +1 -2
- package/functions/customerGroup.js +1 -2
- package/functions/event.js +2 -5
- package/functions/eventPlayer.js +2 -5
- package/functions/eventRepertory.js +1 -2
- package/functions/federation.js +1 -2
- package/functions/federationPartnership.js +1 -2
- package/functions/group.js +1 -2
- package/functions/groupPlayer.js +1 -2
- package/functions/groupRepertory.js +1 -2
- package/functions/index.js +2 -5
- package/functions/jwt.js +1 -2
- package/functions/misc.js +1 -2
- package/functions/notification.js +1 -2
- package/functions/partner.js +1 -2
- package/functions/partnership.js +1 -2
- package/functions/partnershipGroup.js +1 -2
- package/functions/partnershipPlan.js +1 -2
- package/functions/regions.js +124 -128
- package/functions/subscription.js +1 -2
- package/functions/user.js +1 -2
- package/helpers/appScenes.js +2 -5
- package/helpers/audios.js +5 -9
- package/helpers/auth.js +5 -9
- package/helpers/badges.js +10 -19
- package/helpers/collections.js +2 -5
- package/helpers/countries.js +1 -4
- package/helpers/dlinks.js +2 -5
- package/helpers/errors.js +2 -5
- package/helpers/fileSections/index.js +5 -8
- package/helpers/fileSections/orders.js +11 -16
- package/helpers/glissandooAdmin.js +2 -6
- package/helpers/instruments/index.js +3 -6
- package/helpers/instruments/lists.js +11 -19
- package/helpers/musicStyles/index.js +29 -36
- package/helpers/musicStyles/orders.js +174 -179
- package/helpers/notifications/index.js +119 -122
- package/helpers/notifications/placeholders.js +18 -26
- package/helpers/objects.js +15 -23
- package/helpers/payments.js +5 -8
- package/helpers/plans.js +6 -9
- package/helpers/rates.js +2 -6
- package/helpers/reasons.js +17 -21
- package/helpers/slate.js +5 -12
- package/helpers/styles.js +1 -4
- package/helpers/ts-extras/array-includes.js +1 -5
- package/helpers/ts-extras/as-mutable.js +1 -5
- package/helpers/ts-extras/assert-error.js +1 -5
- package/helpers/ts-extras/index.js +15 -33
- package/helpers/ts-extras/is-defined.js +1 -5
- package/helpers/ts-extras/is-empty.js +1 -5
- package/helpers/ts-extras/is-finite.js +1 -4
- package/helpers/ts-extras/is-infinite.js +1 -5
- package/helpers/ts-extras/is-integer.js +1 -4
- package/helpers/ts-extras/is-present.js +1 -5
- package/helpers/ts-extras/is-safe-integer.js +1 -4
- package/helpers/ts-extras/object-entries.js +1 -4
- package/helpers/ts-extras/object-from-entries.js +1 -4
- package/helpers/ts-extras/object-has-own.js +1 -5
- package/helpers/ts-extras/object-keys.js +1 -4
- package/helpers/ts-extras/set-has.js +1 -5
- package/helpers/types.js +2 -5
- package/helpers/utils.js +8 -16
- package/lang/index.js +42 -51
- package/models/Communication/Comment/index.d.ts +4 -4
- package/models/Communication/Comment/index.js +5 -12
- package/models/Communication/Comment/types.js +1 -2
- package/models/Communication/index.d.ts +3 -2
- package/models/Communication/index.js +15 -21
- package/models/Communication/types.js +4 -7
- package/models/Counters/Group/Analytics/index.d.ts +2 -3
- package/models/Counters/Group/Analytics/index.js +5 -12
- package/models/Counters/Group/Analytics/types.js +2 -5
- package/models/Counters/Group/index.d.ts +2 -3
- package/models/Counters/Group/index.js +2 -8
- package/models/Counters/Group/types.js +1 -2
- package/models/Counters/event.d.ts +2 -2
- package/models/Counters/event.js +2 -8
- package/models/Counters/index.d.ts +2 -3
- package/models/Counters/index.js +2 -8
- package/models/Counters/types.js +1 -2
- package/models/Customer/Group/index.d.ts +2 -2
- package/models/Customer/Group/index.js +7 -14
- package/models/Customer/Group/types.js +1 -2
- package/models/Customer/basic.d.ts +2 -3
- package/models/Customer/basic.js +4 -10
- package/models/Customer/index.d.ts +2 -2
- package/models/Customer/index.js +5 -11
- package/models/Customer/types.js +2 -5
- package/models/Evento/Player/basic.js +10 -11
- package/models/Evento/Player/index.d.ts +4 -4
- package/models/Evento/Player/index.js +12 -18
- package/models/Evento/Player/types.js +4 -7
- package/models/Evento/Repertory/index.d.ts +3 -3
- package/models/Evento/Repertory/index.js +3 -10
- package/models/Evento/Repertory/types.js +1 -2
- package/models/Evento/basic.d.ts +2 -2
- package/models/Evento/basic.js +12 -18
- package/models/Evento/index.d.ts +3 -2
- package/models/Evento/index.js +32 -38
- package/models/Evento/promoter.d.ts +3 -2
- package/models/Evento/promoter.js +2 -8
- package/models/Evento/tiny.js +9 -9
- package/models/Evento/types.js +14 -17
- package/models/Federation/Partnership/index.d.ts +2 -2
- package/models/Federation/Partnership/index.js +3 -10
- package/models/Federation/Partnership/types.js +1 -2
- package/models/Federation/index.d.ts +2 -3
- package/models/Federation/index.js +7 -13
- package/models/Federation/types.js +1 -2
- package/models/Group/Analytics/index.d.ts +3 -4
- package/models/Group/Analytics/index.js +5 -12
- package/models/Group/Analytics/types.js +2 -5
- package/models/Group/Event/index.d.ts +2 -2
- package/models/Group/Event/index.js +6 -12
- package/models/Group/Event/types.js +1 -2
- package/models/Group/Player/Event/index.d.ts +2 -2
- package/models/Group/Player/Event/index.js +11 -18
- package/models/Group/Player/Event/types.js +1 -2
- package/models/Group/Player/Log/index.d.ts +2 -3
- package/models/Group/Player/Log/index.js +2 -8
- package/models/Group/Player/Log/types.js +1 -2
- package/models/Group/Player/index.d.ts +5 -5
- package/models/Group/Player/index.js +18 -24
- package/models/Group/Player/types.js +2 -5
- package/models/Group/Repertory/File/Section/index.js +12 -16
- package/models/Group/Repertory/File/Section/types.js +2 -5
- package/models/Group/Repertory/File/index.js +11 -12
- package/models/Group/Repertory/File/types.js +1 -2
- package/models/Group/Repertory/FilePath/index.js +12 -15
- package/models/Group/Repertory/index.d.ts +8 -8
- package/models/Group/Repertory/index.js +25 -32
- package/models/Group/Repertory/types.js +2 -5
- package/models/Group/StageTemplate/index.d.ts +2 -3
- package/models/Group/StageTemplate/index.js +2 -8
- package/models/Group/StageTemplate/types.js +1 -2
- package/models/Group/basic.d.ts +2 -2
- package/models/Group/basic.js +5 -11
- package/models/Group/index.d.ts +3 -2
- package/models/Group/index.js +41 -47
- package/models/Group/types.js +14 -17
- package/models/Instrument/group.js +6 -11
- package/models/Instrument/index.js +8 -9
- package/models/Metrics/index.d.ts +4 -5
- package/models/Metrics/index.js +10 -16
- package/models/Metrics/types.js +1 -2
- package/models/Model/index.d.ts +15 -3
- package/models/Model/index.js +8 -7
- package/models/Model/lang.d.ts +2 -3
- package/models/Model/lang.js +5 -10
- package/models/MusicStyle/index.js +9 -10
- package/models/Notification/index.d.ts +4 -5
- package/models/Notification/index.js +2 -8
- package/models/Notification/types.js +2 -5
- package/models/Partner/basic.d.ts +2 -2
- package/models/Partner/basic.js +6 -12
- package/models/Partner/index.d.ts +2 -2
- package/models/Partner/index.js +4 -10
- package/models/Partner/tiny.d.ts +2 -3
- package/models/Partner/tiny.js +2 -8
- package/models/Partner/types.js +2 -5
- package/models/Partnership/Group/index.d.ts +2 -2
- package/models/Partnership/Group/index.js +5 -12
- package/models/Partnership/Group/types.js +1 -2
- package/models/Partnership/Partner/Subscription/index.d.ts +2 -2
- package/models/Partnership/Partner/Subscription/index.js +8 -15
- package/models/Partnership/Partner/Subscription/types.js +2 -5
- package/models/Partnership/Partner/index.d.ts +2 -2
- package/models/Partnership/Partner/index.js +3 -10
- package/models/Partnership/Partner/types.js +1 -2
- package/models/Partnership/Payment/index.d.ts +2 -2
- package/models/Partnership/Payment/index.js +2 -8
- package/models/Partnership/Payment/types.js +1 -2
- package/models/Partnership/Plan/basic.d.ts +2 -3
- package/models/Partnership/Plan/basic.js +12 -18
- package/models/Partnership/Plan/index.d.ts +2 -2
- package/models/Partnership/Plan/index.js +3 -10
- package/models/Partnership/Plan/types.js +2 -5
- package/models/Partnership/basic.d.ts +2 -3
- package/models/Partnership/basic.js +4 -10
- package/models/Partnership/index.d.ts +2 -2
- package/models/Partnership/index.js +5 -11
- package/models/Partnership/types.js +4 -7
- package/models/Payment/basic.d.ts +3 -4
- package/models/Payment/basic.js +7 -13
- package/models/Payment/index.d.ts +2 -2
- package/models/Payment/index.js +2 -8
- package/models/Payment/types.js +4 -7
- package/models/Player/basic.d.ts +2 -2
- package/models/Player/basic.js +4 -10
- package/models/Player/types.js +1 -2
- package/models/Repertory/basic.d.ts +2 -3
- package/models/Repertory/basic.js +2 -8
- package/models/Repertory/types.js +1 -2
- package/models/User/Group/index.d.ts +2 -2
- package/models/User/Group/index.js +8 -15
- package/models/User/Group/types.js +1 -2
- package/models/User/Notification/index.d.ts +6 -6
- package/models/User/Notification/index.js +18 -20
- package/models/User/Notification/types.js +1 -2
- package/models/User/basic.d.ts +2 -2
- package/models/User/basic.js +4 -10
- package/models/User/index.d.ts +2 -2
- package/models/User/index.js +18 -24
- package/models/User/types.js +12 -15
- package/models/WebhookEvent/index.d.ts +2 -3
- package/models/WebhookEvent/index.js +2 -8
- package/models/WebhookEvent/types.js +2 -5
- package/package.json +1 -1
- package/types/firestore.js +2 -5
- package/types/messagebirdChatWidget.js +1 -2
|
@@ -1,19 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const lang_1 = require("../../../lang");
|
|
9
|
-
const basic_1 = __importDefault(require("../../Player/basic"));
|
|
10
|
-
const types_1 = require("./types");
|
|
11
|
-
class GroupPlayer extends basic_1.default {
|
|
12
|
-
constructor(doc, lang = lang_1.defaultLocale) {
|
|
1
|
+
import { get, isNull } from 'lodash';
|
|
2
|
+
import { BadgesTypes, getLevelsCountBadge } from '../../../helpers/badges';
|
|
3
|
+
import { defaultLocale } from '../../../lang';
|
|
4
|
+
import PlayerBasic from '../../Player/basic';
|
|
5
|
+
import { GroupPlayerRole } from './types';
|
|
6
|
+
export default class GroupPlayer extends PlayerBasic {
|
|
7
|
+
constructor(doc, lang = defaultLocale) {
|
|
13
8
|
super(doc, lang);
|
|
14
9
|
}
|
|
15
10
|
get groupId() {
|
|
16
|
-
return
|
|
11
|
+
return this.ref.path.split('/').at(-3);
|
|
17
12
|
}
|
|
18
13
|
get instruments() {
|
|
19
14
|
return this.data.instruments || [];
|
|
@@ -25,7 +20,7 @@ class GroupPlayer extends basic_1.default {
|
|
|
25
20
|
return this.data.role;
|
|
26
21
|
}
|
|
27
22
|
get isAdmin() {
|
|
28
|
-
return this.role ===
|
|
23
|
+
return this.role === GroupPlayerRole.Admin;
|
|
29
24
|
}
|
|
30
25
|
get joinedAt() {
|
|
31
26
|
return this.data.joinedAt;
|
|
@@ -34,7 +29,7 @@ class GroupPlayer extends basic_1.default {
|
|
|
34
29
|
return this.data.leavedAt || null;
|
|
35
30
|
}
|
|
36
31
|
get isActive() {
|
|
37
|
-
return this.exists &&
|
|
32
|
+
return this.exists && isNull(this.leavedAt);
|
|
38
33
|
}
|
|
39
34
|
get eventsInvited() {
|
|
40
35
|
return this.data.events_invited_count || 0;
|
|
@@ -137,11 +132,11 @@ class GroupPlayer extends basic_1.default {
|
|
|
137
132
|
}
|
|
138
133
|
countStatus(type, action) {
|
|
139
134
|
const field = [type, action, 'count'].join('_');
|
|
140
|
-
return
|
|
135
|
+
return get(this.data, field) || 0;
|
|
141
136
|
}
|
|
142
137
|
countRollcall(type, action) {
|
|
143
138
|
const field = [type, 'rollcall', action, 'count'].join('_');
|
|
144
|
-
return
|
|
139
|
+
return get(this.data, field) || 0;
|
|
145
140
|
}
|
|
146
141
|
// public rollCallData(type?: EventType) {
|
|
147
142
|
// if (type) {
|
|
@@ -196,7 +191,7 @@ class GroupPlayer extends basic_1.default {
|
|
|
196
191
|
return badge[nameLevel];
|
|
197
192
|
}
|
|
198
193
|
getCurrentBadgeLevel(field) {
|
|
199
|
-
const levels =
|
|
194
|
+
const levels = getLevelsCountBadge(field);
|
|
200
195
|
if (!levels)
|
|
201
196
|
return null;
|
|
202
197
|
let level = levels.length;
|
|
@@ -210,13 +205,13 @@ class GroupPlayer extends basic_1.default {
|
|
|
210
205
|
}
|
|
211
206
|
getValueByBadgeType(field) {
|
|
212
207
|
switch (field) {
|
|
213
|
-
case
|
|
208
|
+
case BadgesTypes.AccPractices:
|
|
214
209
|
return this.practiceRollCallConfirmed;
|
|
215
|
-
case
|
|
210
|
+
case BadgesTypes.AccPerformances:
|
|
216
211
|
return this.performanceRollCallConfirmed;
|
|
217
|
-
case
|
|
212
|
+
case BadgesTypes.AnswerEvents:
|
|
218
213
|
return this.eventsAnswered;
|
|
219
|
-
case
|
|
214
|
+
case BadgesTypes.StrikePractices:
|
|
220
215
|
return this.practiceRollCallConfirmedStrike;
|
|
221
216
|
default:
|
|
222
217
|
return 0;
|
|
@@ -236,7 +231,7 @@ class GroupPlayer extends basic_1.default {
|
|
|
236
231
|
}
|
|
237
232
|
get badges() {
|
|
238
233
|
const badges = [];
|
|
239
|
-
for (const badge of Object.values(
|
|
234
|
+
for (const badge of Object.values(BadgesTypes)) {
|
|
240
235
|
const obtainAt = this.getBadgeLevel(badge);
|
|
241
236
|
badges.push({
|
|
242
237
|
id: badge,
|
|
@@ -248,4 +243,3 @@ class GroupPlayer extends basic_1.default {
|
|
|
248
243
|
return badges;
|
|
249
244
|
}
|
|
250
245
|
}
|
|
251
|
-
exports.default = GroupPlayer;
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GroupPlayerRole = void 0;
|
|
4
|
-
var GroupPlayerRole;
|
|
1
|
+
export var GroupPlayerRole;
|
|
5
2
|
(function (GroupPlayerRole) {
|
|
6
3
|
GroupPlayerRole["Admin"] = "admin";
|
|
7
4
|
GroupPlayerRole["Member"] = "member";
|
|
8
5
|
GroupPlayerRole["Guest"] = "guest";
|
|
9
|
-
})(GroupPlayerRole
|
|
6
|
+
})(GroupPlayerRole || (GroupPlayerRole = {}));
|
|
@@ -1,24 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const types_1 = require("./types");
|
|
10
|
-
class GroupRepertoryFileSection {
|
|
11
|
-
constructor(id, lang = lang_1.defaultLocale) {
|
|
1
|
+
import { getOrderByMusicStyle } from '../../../../../helpers/fileSections/orders';
|
|
2
|
+
import { defaultLocale, getTranslation } from '../../../../../lang';
|
|
3
|
+
import Instrument from '../../../../Instrument';
|
|
4
|
+
import { FileSectionIdReserved } from './types';
|
|
5
|
+
export default class GroupRepertoryFileSection {
|
|
6
|
+
id;
|
|
7
|
+
lang;
|
|
8
|
+
constructor(id, lang = defaultLocale) {
|
|
12
9
|
this.id = id;
|
|
13
10
|
this.lang = lang;
|
|
14
11
|
}
|
|
15
12
|
get name() {
|
|
16
|
-
return ((this.id ===
|
|
17
|
-
?
|
|
18
|
-
: new
|
|
13
|
+
return ((this.id === FileSectionIdReserved.All
|
|
14
|
+
? getTranslation(`sections.all`, this.lang)
|
|
15
|
+
: new Instrument(this.id, this.lang).name) || this.id);
|
|
19
16
|
}
|
|
20
17
|
getOrder(musicStyle) {
|
|
21
|
-
return
|
|
18
|
+
return getOrderByMusicStyle(musicStyle).indexOf(this.id) + 1 || Infinity;
|
|
22
19
|
}
|
|
23
20
|
}
|
|
24
|
-
exports.default = GroupRepertoryFileSection;
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FileSectionIdReserved = void 0;
|
|
4
|
-
var FileSectionIdReserved;
|
|
1
|
+
export var FileSectionIdReserved;
|
|
5
2
|
(function (FileSectionIdReserved) {
|
|
6
3
|
FileSectionIdReserved["All"] = "all";
|
|
7
|
-
})(FileSectionIdReserved
|
|
4
|
+
})(FileSectionIdReserved || (FileSectionIdReserved = {}));
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { groupBy, mapValues } from 'lodash';
|
|
2
|
+
import { mapToArray } from '../../../../helpers/objects';
|
|
3
|
+
import { GroupRepertoireTagReserved as TagReserved } from '../../types';
|
|
4
|
+
export default class ThemeFile {
|
|
5
|
+
id;
|
|
6
|
+
data;
|
|
7
7
|
constructor(id, data) {
|
|
8
8
|
this.id = id;
|
|
9
9
|
this.data = data;
|
|
@@ -39,14 +39,14 @@ class ThemeFile {
|
|
|
39
39
|
return Object.keys(this.sections);
|
|
40
40
|
}
|
|
41
41
|
get sectionsList() {
|
|
42
|
-
const list =
|
|
42
|
+
const list = mapToArray(this.sections);
|
|
43
43
|
return list.map((section) => {
|
|
44
44
|
const sectionId = section.id;
|
|
45
45
|
if (this.isFileByPages) {
|
|
46
46
|
const items = Object.entries(section.pages || {}).flatMap(([page, { tags }]) => this.isNoTag(tags)
|
|
47
|
-
? { page: Number(page), tag:
|
|
47
|
+
? { page: Number(page), tag: TagReserved.NoTag }
|
|
48
48
|
: tags.map((tag) => ({ page: Number(page), tag })));
|
|
49
|
-
const tagsByPages =
|
|
49
|
+
const tagsByPages = mapValues(groupBy(items, 'tag'), (v) => v.map((t) => t.page));
|
|
50
50
|
return {
|
|
51
51
|
sectionId,
|
|
52
52
|
tagsByFile: [],
|
|
@@ -55,7 +55,7 @@ class ThemeFile {
|
|
|
55
55
|
}
|
|
56
56
|
return {
|
|
57
57
|
sectionId,
|
|
58
|
-
tagsByFile: this.isNoTag(section.tags) ? [
|
|
58
|
+
tagsByFile: this.isNoTag(section.tags) ? [TagReserved.NoTag] : section.tags || [],
|
|
59
59
|
tagsByPages: {},
|
|
60
60
|
};
|
|
61
61
|
});
|
|
@@ -75,7 +75,6 @@ class ThemeFile {
|
|
|
75
75
|
return this.data.identifyAt || null;
|
|
76
76
|
}
|
|
77
77
|
isNoTag(tags = []) {
|
|
78
|
-
return tags.length === 0 || tags.includes(
|
|
78
|
+
return tags.length === 0 || tags.includes(TagReserved.NoTag);
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
|
-
exports.default = ThemeFile;
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
class ThemeFilePath {
|
|
11
|
-
constructor(sectionId, data, lang = lang_1.defaultLocale) {
|
|
1
|
+
import { defaultLocale } from '../../../../lang';
|
|
2
|
+
import FileSection from '../File/Section';
|
|
3
|
+
import path from 'path';
|
|
4
|
+
import { audioExtensions } from '../../../../helpers/audios';
|
|
5
|
+
export default class ThemeFilePath {
|
|
6
|
+
sectionId;
|
|
7
|
+
data;
|
|
8
|
+
lang;
|
|
9
|
+
constructor(sectionId, data, lang = defaultLocale) {
|
|
12
10
|
this.sectionId = sectionId;
|
|
13
11
|
this.data = data;
|
|
14
12
|
this.lang = lang;
|
|
@@ -17,7 +15,7 @@ class ThemeFilePath {
|
|
|
17
15
|
return this.data.path;
|
|
18
16
|
}
|
|
19
17
|
get parsedPath() {
|
|
20
|
-
return
|
|
18
|
+
return path.parse(this.path);
|
|
21
19
|
}
|
|
22
20
|
get ext() {
|
|
23
21
|
return this.parsedPath.ext;
|
|
@@ -26,10 +24,10 @@ class ThemeFilePath {
|
|
|
26
24
|
return this.ext === '.pdf';
|
|
27
25
|
}
|
|
28
26
|
get isAudio() {
|
|
29
|
-
return
|
|
27
|
+
return audioExtensions.includes(this.ext);
|
|
30
28
|
}
|
|
31
29
|
get section() {
|
|
32
|
-
return new
|
|
30
|
+
return new FileSection(this.sectionId, this.lang);
|
|
33
31
|
}
|
|
34
32
|
get tag() {
|
|
35
33
|
return this.data.tag;
|
|
@@ -38,4 +36,3 @@ class ThemeFilePath {
|
|
|
38
36
|
return group.getRepertoireTagName(this.tag);
|
|
39
37
|
}
|
|
40
38
|
}
|
|
41
|
-
exports.default = ThemeFilePath;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import * as firestore from '@google-cloud/firestore';
|
|
2
1
|
import { InstrumentId } from '../../../helpers/instruments';
|
|
3
2
|
import { LanguagesTypes } from '../../../lang';
|
|
4
3
|
import EventoTiny from '../../Evento/tiny';
|
|
4
|
+
import { DocumentModel } from '../../Model';
|
|
5
5
|
import Theme from '../../Repertory/basic';
|
|
6
6
|
import { FileSectionId } from './File/Section/types';
|
|
7
7
|
import { GroupRepertoireVisibility, GroupRepertoryData } from './types';
|
|
8
8
|
export default class GroupRepertory extends Theme<GroupRepertoryData> {
|
|
9
9
|
lang: LanguagesTypes;
|
|
10
|
-
constructor(doc:
|
|
10
|
+
constructor(doc: DocumentModel, lang?: LanguagesTypes);
|
|
11
11
|
get groupId(): string;
|
|
12
12
|
get tagsAlgolia(): import("./types").GroupRepertoryTagAlgoliaData[];
|
|
13
13
|
/** @deprecated use sections */
|
|
@@ -43,22 +43,22 @@ export default class GroupRepertory extends Theme<GroupRepertoryData> {
|
|
|
43
43
|
get nextEvent(): EventoTiny | null;
|
|
44
44
|
/** @deprecated use sections */
|
|
45
45
|
get scoresByInstruments(): boolean;
|
|
46
|
-
get editedAt():
|
|
47
|
-
get createdAt():
|
|
46
|
+
get editedAt(): FirebaseFirestore.Timestamp | null;
|
|
47
|
+
get createdAt(): FirebaseFirestore.Timestamp;
|
|
48
48
|
/** @deprecated use sections */
|
|
49
49
|
get audios(): string[];
|
|
50
50
|
/** @deprecated use sections */
|
|
51
|
-
get identifyAt():
|
|
51
|
+
get identifyAt(): FirebaseFirestore.Timestamp | null;
|
|
52
52
|
/** @deprecated use sections */
|
|
53
53
|
get isIdentify(): boolean;
|
|
54
54
|
get isActive(): boolean;
|
|
55
55
|
get thumbnailURL(): string | null;
|
|
56
56
|
get ownerId(): string;
|
|
57
|
-
get lastEventDatetime():
|
|
57
|
+
get lastEventDatetime(): FirebaseFirestore.Timestamp | null;
|
|
58
58
|
get claims(): Partial<Record<InstrumentId, Record<string, import("./types").GroupRepertoryClaimType>>>;
|
|
59
59
|
get claimsList(): {
|
|
60
|
-
createdAt:
|
|
61
|
-
notifiedAt:
|
|
60
|
+
createdAt: FirebaseFirestore.Timestamp;
|
|
61
|
+
notifiedAt: FirebaseFirestore.Timestamp | null;
|
|
62
62
|
userId: string;
|
|
63
63
|
instrumentId: InstrumentId;
|
|
64
64
|
hasFile: boolean;
|
|
@@ -1,28 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const basic_1 = __importDefault(require("../../Repertory/basic"));
|
|
16
|
-
const types_1 = require("./File/Section/types");
|
|
17
|
-
const types_2 = require("./types");
|
|
18
|
-
class GroupRepertory extends basic_1.default {
|
|
19
|
-
constructor(doc, lang = lang_1.defaultLocale) {
|
|
1
|
+
import endOfDay from 'date-fns/endOfDay';
|
|
2
|
+
import isFuture from 'date-fns/isFuture';
|
|
3
|
+
import { uniq } from 'lodash';
|
|
4
|
+
import orderBy from 'lodash/orderBy';
|
|
5
|
+
import { mapToArray } from '../../../helpers/objects';
|
|
6
|
+
import { objectEntries } from '../../../helpers/ts-extras';
|
|
7
|
+
import { defaultLocale } from '../../../lang';
|
|
8
|
+
import EventoTiny from '../../Evento/tiny';
|
|
9
|
+
import Theme from '../../Repertory/basic';
|
|
10
|
+
import { FileSectionIdReserved } from './File/Section/types';
|
|
11
|
+
import { GroupRepertoireVisibility } from './types';
|
|
12
|
+
export default class GroupRepertory extends Theme {
|
|
13
|
+
lang = defaultLocale;
|
|
14
|
+
constructor(doc, lang = defaultLocale) {
|
|
20
15
|
super(doc);
|
|
21
|
-
this.lang = lang_1.defaultLocale;
|
|
22
16
|
this.lang = lang;
|
|
23
17
|
}
|
|
24
18
|
get groupId() {
|
|
25
|
-
return
|
|
19
|
+
return this.ref.path.split('/').at(-3);
|
|
26
20
|
}
|
|
27
21
|
get tagsAlgolia() {
|
|
28
22
|
return this.data.tagsAlgolia || [];
|
|
@@ -39,10 +33,10 @@ class GroupRepertory extends basic_1.default {
|
|
|
39
33
|
return this.data.files || {};
|
|
40
34
|
}
|
|
41
35
|
get fileList() {
|
|
42
|
-
return
|
|
36
|
+
return mapToArray(this.files);
|
|
43
37
|
}
|
|
44
38
|
get sectionIds() {
|
|
45
|
-
return
|
|
39
|
+
return uniq(this.fileList.map((file) => Object.keys(file.sections)).flat());
|
|
46
40
|
}
|
|
47
41
|
get filesPath() {
|
|
48
42
|
return this.data.filesPath || {};
|
|
@@ -57,7 +51,7 @@ class GroupRepertory extends basic_1.default {
|
|
|
57
51
|
return this.data.mainFilePath;
|
|
58
52
|
}
|
|
59
53
|
get visibility() {
|
|
60
|
-
return this.data.visibility ||
|
|
54
|
+
return this.data.visibility || GroupRepertoireVisibility.ByEvent;
|
|
61
55
|
}
|
|
62
56
|
get votes() {
|
|
63
57
|
return this.data.votes || {};
|
|
@@ -81,11 +75,11 @@ class GroupRepertory extends basic_1.default {
|
|
|
81
75
|
return this.data.eventsTL || {};
|
|
82
76
|
}
|
|
83
77
|
get eventsList() {
|
|
84
|
-
return Object.keys(this.eventsTL).map((id) => new
|
|
78
|
+
return Object.keys(this.eventsTL).map((id) => new EventoTiny(id, this.eventsTL[id], this.lang));
|
|
85
79
|
}
|
|
86
80
|
/** @deprecated use getNextEvents */
|
|
87
81
|
get nextEvents() {
|
|
88
|
-
return this.getEventsByOrder().filter((ev) => (
|
|
82
|
+
return this.getEventsByOrder().filter((ev) => isFuture(ev.datetime.toDate()));
|
|
89
83
|
}
|
|
90
84
|
/** @deprecated use getNextEvent */
|
|
91
85
|
get nextEvent() {
|
|
@@ -132,8 +126,8 @@ class GroupRepertory extends basic_1.default {
|
|
|
132
126
|
return this.data.claims || {};
|
|
133
127
|
}
|
|
134
128
|
get claimsList() {
|
|
135
|
-
return
|
|
136
|
-
.map(([iId, users]) =>
|
|
129
|
+
return objectEntries(this.claims)
|
|
130
|
+
.map(([iId, users]) => objectEntries(users || {}).map(([userId, claim]) => ({
|
|
137
131
|
userId,
|
|
138
132
|
instrumentId: iId,
|
|
139
133
|
hasFile: this.hasInstrumentAFile(iId),
|
|
@@ -142,7 +136,7 @@ class GroupRepertory extends basic_1.default {
|
|
|
142
136
|
.flat();
|
|
143
137
|
}
|
|
144
138
|
hasInstrumentAFile(instrumentId) {
|
|
145
|
-
return (this.sectionIds.includes(
|
|
139
|
+
return (this.sectionIds.includes(FileSectionIdReserved.All) ||
|
|
146
140
|
this.sectionIds.includes(instrumentId));
|
|
147
141
|
}
|
|
148
142
|
claimsByInstrument(instrumentId) {
|
|
@@ -172,10 +166,10 @@ class GroupRepertory extends basic_1.default {
|
|
|
172
166
|
return this.instruments.find((i) => i.id === id);
|
|
173
167
|
}
|
|
174
168
|
getEventsByOrder(order = 'desc') {
|
|
175
|
-
return (
|
|
169
|
+
return orderBy(this.eventsList, (e) => e.datetime.toDate(), [order]);
|
|
176
170
|
}
|
|
177
171
|
getNextEvents(endDay = false) {
|
|
178
|
-
return this.getEventsByOrder().filter((ev) => endDay ? (
|
|
172
|
+
return this.getEventsByOrder().filter((ev) => endDay ? isFuture(endOfDay(ev.datetime.toDate())) : isFuture(ev.datetime.toDate()));
|
|
179
173
|
}
|
|
180
174
|
getNextEvent(endDay = false) {
|
|
181
175
|
const events = this.getNextEvents(endDay);
|
|
@@ -185,4 +179,3 @@ class GroupRepertory extends basic_1.default {
|
|
|
185
179
|
return events[events.length - 1];
|
|
186
180
|
}
|
|
187
181
|
}
|
|
188
|
-
exports.default = GroupRepertory;
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GroupRepertoireVisibility = void 0;
|
|
4
|
-
var GroupRepertoireVisibility;
|
|
1
|
+
export var GroupRepertoireVisibility;
|
|
5
2
|
(function (GroupRepertoireVisibility) {
|
|
6
3
|
GroupRepertoireVisibility["Always"] = "always";
|
|
7
4
|
GroupRepertoireVisibility["ByEvent"] = "byEvent";
|
|
8
|
-
})(GroupRepertoireVisibility
|
|
5
|
+
})(GroupRepertoireVisibility || (GroupRepertoireVisibility = {}));
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import Model from '../../Model';
|
|
1
|
+
import Model, { DocumentModel } from '../../Model';
|
|
3
2
|
import { StageTemplateData } from './types';
|
|
4
3
|
export default class GroupStageTemplate extends Model<StageTemplateData> {
|
|
5
|
-
constructor(doc:
|
|
4
|
+
constructor(doc: DocumentModel);
|
|
6
5
|
get title(): string;
|
|
7
6
|
get boardMap(): Record<string, import("./types").BoardCoordinates>;
|
|
8
7
|
get boardSettings(): import("./types").BoardSettings;
|
|
@@ -1,10 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const Model_1 = __importDefault(require("../../Model"));
|
|
7
|
-
class GroupStageTemplate extends Model_1.default {
|
|
1
|
+
import Model from '../../Model';
|
|
2
|
+
export default class GroupStageTemplate extends Model {
|
|
8
3
|
constructor(doc) {
|
|
9
4
|
super(doc);
|
|
10
5
|
}
|
|
@@ -30,4 +25,3 @@ class GroupStageTemplate extends Model_1.default {
|
|
|
30
25
|
return this.data.createdAt;
|
|
31
26
|
}
|
|
32
27
|
}
|
|
33
|
-
exports.default = GroupStageTemplate;
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
package/models/Group/basic.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { DocumentSnapshot } from '@google-cloud/firestore';
|
|
2
1
|
import { LanguagesTypes } from '../../lang';
|
|
2
|
+
import { DocumentModel } from '../Model';
|
|
3
3
|
import ModelWithLang from '../Model/lang';
|
|
4
4
|
import { GroupBasicData, GroupTinyData } from './types';
|
|
5
5
|
export default class GroupBasic<D> extends ModelWithLang<D & GroupBasicData> {
|
|
6
|
-
constructor(doc:
|
|
6
|
+
constructor(doc: DocumentModel, lang?: LanguagesTypes);
|
|
7
7
|
get tinyInfo(): GroupTinyData;
|
|
8
8
|
get basicInfo(): GroupBasicData;
|
|
9
9
|
get displayName(): string;
|
package/models/Group/basic.js
CHANGED
|
@@ -1,12 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const lang_1 = require("../../lang");
|
|
7
|
-
const lang_2 = __importDefault(require("../Model/lang"));
|
|
8
|
-
class GroupBasic extends lang_2.default {
|
|
9
|
-
constructor(doc, lang = lang_1.defaultLocale) {
|
|
1
|
+
import { defaultLocale, getTranslation } from '../../lang';
|
|
2
|
+
import ModelWithLang from '../Model/lang';
|
|
3
|
+
export default class GroupBasic extends ModelWithLang {
|
|
4
|
+
constructor(doc, lang = defaultLocale) {
|
|
10
5
|
super(doc, lang);
|
|
11
6
|
}
|
|
12
7
|
get tinyInfo() {
|
|
@@ -44,8 +39,7 @@ class GroupBasic extends lang_2.default {
|
|
|
44
39
|
return this.data.musicStyle;
|
|
45
40
|
}
|
|
46
41
|
get musicStyleString() {
|
|
47
|
-
const translation =
|
|
42
|
+
const translation = getTranslation(`musicStyles.${this.musicStyle}`, this.lang);
|
|
48
43
|
return translation || this.musicStyle;
|
|
49
44
|
}
|
|
50
45
|
}
|
|
51
|
-
exports.default = GroupBasic;
|
package/models/Group/index.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { DocumentReference
|
|
1
|
+
import { DocumentReference } from '@google-cloud/firestore';
|
|
2
2
|
import { PlansGroup } from '../../helpers/plans';
|
|
3
3
|
import { LanguagesTypes } from '../../lang';
|
|
4
|
+
import { DocumentModel } from '../Model';
|
|
4
5
|
import GroupBasic from './basic';
|
|
5
6
|
import { GroupConfigShowAttendanceToMembers, GroupData, GroupStatus, SocialNetwork } from './types';
|
|
6
7
|
export default class Group extends GroupBasic<GroupData> {
|
|
7
|
-
constructor(doc:
|
|
8
|
+
constructor(doc: DocumentModel, lang?: LanguagesTypes);
|
|
8
9
|
get owner(): DocumentReference;
|
|
9
10
|
get playerIds(): string[];
|
|
10
11
|
get players(): Record<string, import("../Player/types").PlayerBasicData>;
|