@glissandoo/lib 1.0.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/communication.d.ts +31 -0
- package/functions/communication.js +2 -0
- package/functions/event.d.ts +113 -0
- package/functions/event.js +18 -0
- package/functions/eventPlayer.d.ts +20 -0
- package/functions/eventPlayer.js +13 -0
- package/functions/eventRepertory.d.ts +9 -0
- package/functions/eventRepertory.js +2 -0
- package/functions/federation.d.ts +23 -0
- package/functions/federation.js +2 -0
- package/functions/federationPartnership.d.ts +34 -0
- package/functions/federationPartnership.js +2 -0
- package/functions/group.d.ts +32 -0
- package/functions/group.js +2 -0
- package/functions/groupPlayer.d.ts +37 -0
- package/functions/groupPlayer.js +2 -0
- package/functions/groupRepertory.d.ts +54 -0
- package/functions/groupRepertory.js +2 -0
- package/functions/index.d.ts +73 -0
- package/functions/index.js +77 -0
- package/functions/misc.d.ts +9 -0
- package/functions/misc.js +2 -0
- package/functions/notification.d.ts +4 -0
- package/functions/notification.js +2 -0
- package/functions/partner.d.ts +63 -0
- package/functions/partner.js +2 -0
- package/functions/partnership.d.ts +23 -0
- package/functions/partnership.js +2 -0
- package/functions/partnershipGroup.d.ts +12 -0
- package/functions/partnershipGroup.js +2 -0
- package/functions/partnershipPlan.d.ts +23 -0
- package/functions/partnershipPlan.js +2 -0
- package/functions/regions.d.ts +6 -0
- package/functions/regions.js +85 -0
- package/functions/subscription.d.ts +20 -0
- package/functions/subscription.js +2 -0
- package/functions/user.d.ts +19 -0
- package/functions/user.js +2 -0
- package/helpers/appScenes.d.ts +45 -0
- package/helpers/appScenes.js +49 -0
- package/helpers/badges.d.ts +21 -0
- package/helpers/badges.js +162 -0
- package/helpers/collections.d.ts +28 -0
- package/helpers/collections.js +32 -0
- package/helpers/instruments/index.d.ts +67 -0
- package/helpers/instruments/index.js +145 -0
- package/helpers/musicStyles/index.d.ts +9 -0
- package/helpers/musicStyles/index.js +16 -0
- package/helpers/musicStyles/orders.d.ts +4 -0
- package/helpers/musicStyles/orders.js +128 -0
- package/helpers/notifications.d.ts +40 -0
- package/helpers/notifications.js +120 -0
- package/helpers/payments.d.ts +2 -0
- package/helpers/payments.js +9 -0
- package/helpers/utils.d.ts +6 -0
- package/helpers/utils.js +99 -0
- package/index.d.ts +0 -0
- package/index.js +1 -0
- package/lang/ca.json +194 -0
- package/lang/de.json +194 -0
- package/lang/en.json +194 -0
- package/lang/es.json +194 -0
- package/lang/gl.json +194 -0
- package/lang/index.d.ts +1078 -0
- package/lang/index.js +101 -0
- package/models/Communication/index.d.ts +47 -0
- package/models/Communication/index.js +138 -0
- package/models/Communication/types.d.ts +53 -0
- package/models/Communication/types.js +13 -0
- package/models/Counters/index.d.ts +7 -0
- package/models/Counters/index.js +15 -0
- package/models/Counters/types.d.ts +3 -0
- package/models/Counters/types.js +2 -0
- package/models/Evento/Player/index.d.ts +17 -0
- package/models/Evento/Player/index.js +45 -0
- package/models/Evento/Player/types.d.ts +15 -0
- package/models/Evento/Player/types.js +8 -0
- package/models/Evento/Repertory/index.d.ts +9 -0
- package/models/Evento/Repertory/index.js +22 -0
- package/models/Evento/Repertory/types.d.ts +5 -0
- package/models/Evento/Repertory/types.js +2 -0
- package/models/Evento/basic.d.ts +22 -0
- package/models/Evento/basic.js +72 -0
- package/models/Evento/index.d.ts +66 -0
- package/models/Evento/index.js +178 -0
- package/models/Evento/promoter.d.ts +11 -0
- package/models/Evento/promoter.js +24 -0
- package/models/Evento/tiny.d.ts +13 -0
- package/models/Evento/tiny.js +32 -0
- package/models/Evento/types.d.ts +76 -0
- package/models/Evento/types.js +22 -0
- package/models/Federation/Partnership/index.d.ts +12 -0
- package/models/Federation/Partnership/index.js +31 -0
- package/models/Federation/Partnership/types.d.ts +8 -0
- package/models/Federation/Partnership/types.js +2 -0
- package/models/Federation/index.d.ts +20 -0
- package/models/Federation/index.js +54 -0
- package/models/Federation/types.d.ts +16 -0
- package/models/Federation/types.js +2 -0
- package/models/Group/Analytics/index.d.ts +11 -0
- package/models/Group/Analytics/index.js +29 -0
- package/models/Group/Analytics/types.d.ts +20 -0
- package/models/Group/Analytics/types.js +13 -0
- package/models/Group/Event/index.d.ts +15 -0
- package/models/Group/Event/index.js +38 -0
- package/models/Group/Event/types.d.ts +11 -0
- package/models/Group/Event/types.js +2 -0
- package/models/Group/Player/Event/index.d.ts +17 -0
- package/models/Group/Player/Event/index.js +42 -0
- package/models/Group/Player/Event/types.d.ts +8 -0
- package/models/Group/Player/Event/types.js +2 -0
- package/models/Group/Player/Log/index.d.ts +12 -0
- package/models/Group/Player/Log/index.js +24 -0
- package/models/Group/Player/Log/types.d.ts +11 -0
- package/models/Group/Player/Log/types.js +2 -0
- package/models/Group/Player/index.d.ts +55 -0
- package/models/Group/Player/index.js +221 -0
- package/models/Group/Player/types.d.ts +43 -0
- package/models/Group/Player/types.js +9 -0
- package/models/Group/Repertory/index.d.ts +67 -0
- package/models/Group/Repertory/index.js +149 -0
- package/models/Group/Repertory/types.d.ts +43 -0
- package/models/Group/Repertory/types.js +2 -0
- package/models/Group/basic.d.ts +17 -0
- package/models/Group/basic.js +51 -0
- package/models/Group/index.d.ts +43 -0
- package/models/Group/index.js +115 -0
- package/models/Group/types.d.ts +68 -0
- package/models/Group/types.js +21 -0
- package/models/Instrument/index.d.ts +9 -0
- package/models/Instrument/index.js +17 -0
- package/models/Metrics/index.d.ts +17 -0
- package/models/Metrics/index.js +47 -0
- package/models/Metrics/types.d.ts +12 -0
- package/models/Metrics/types.js +2 -0
- package/models/Model.d.ts +10 -0
- package/models/Model.js +21 -0
- package/models/MusicStyle/index.d.ts +8 -0
- package/models/MusicStyle/index.js +13 -0
- package/models/Notification/index.d.ts +12 -0
- package/models/Notification/index.js +26 -0
- package/models/Notification/types.d.ts +71 -0
- package/models/Notification/types.js +68 -0
- package/models/Partner/basic.d.ts +14 -0
- package/models/Partner/basic.js +43 -0
- package/models/Partner/index.d.ts +16 -0
- package/models/Partner/index.js +48 -0
- package/models/Partner/tiny.d.ts +9 -0
- package/models/Partner/tiny.js +24 -0
- package/models/Partner/types.d.ts +43 -0
- package/models/Partner/types.js +9 -0
- package/models/Partnership/Group/index.d.ts +8 -0
- package/models/Partnership/Group/index.js +17 -0
- package/models/Partnership/Group/types.d.ts +2 -0
- package/models/Partnership/Group/types.js +2 -0
- package/models/Partnership/Partner/Subscription/index.d.ts +19 -0
- package/models/Partnership/Partner/Subscription/index.js +56 -0
- package/models/Partnership/Partner/Subscription/types.d.ts +21 -0
- package/models/Partnership/Partner/Subscription/types.js +9 -0
- package/models/Partnership/Partner/index.d.ts +9 -0
- package/models/Partnership/Partner/index.js +22 -0
- package/models/Partnership/Partner/types.d.ts +5 -0
- package/models/Partnership/Partner/types.js +2 -0
- package/models/Partnership/Payment/index.d.ts +8 -0
- package/models/Partnership/Payment/index.js +18 -0
- package/models/Partnership/Payment/types.d.ts +6 -0
- package/models/Partnership/Payment/types.js +2 -0
- package/models/Partnership/Plan/basic.d.ts +19 -0
- package/models/Partnership/Plan/basic.js +65 -0
- package/models/Partnership/Plan/index.d.ts +12 -0
- package/models/Partnership/Plan/index.js +31 -0
- package/models/Partnership/Plan/types.d.ts +23 -0
- package/models/Partnership/Plan/types.js +10 -0
- package/models/Partnership/basic.d.ts +17 -0
- package/models/Partnership/basic.js +58 -0
- package/models/Partnership/index.d.ts +18 -0
- package/models/Partnership/index.js +55 -0
- package/models/Partnership/types.d.ts +37 -0
- package/models/Partnership/types.js +9 -0
- package/models/Payment/basic.d.ts +17 -0
- package/models/Payment/basic.js +53 -0
- package/models/Payment/index.d.ts +13 -0
- package/models/Payment/index.js +33 -0
- package/models/Payment/types.d.ts +32 -0
- package/models/Payment/types.js +17 -0
- package/models/Player/basic.d.ts +10 -0
- package/models/Player/basic.js +27 -0
- package/models/Player/types.d.ts +8 -0
- package/models/Player/types.js +2 -0
- package/models/Repertory/basic.d.ts +11 -0
- package/models/Repertory/basic.js +32 -0
- package/models/Repertory/types.d.ts +21 -0
- package/models/Repertory/types.js +2 -0
- package/models/User/Group/index.d.ts +15 -0
- package/models/User/Group/index.js +36 -0
- package/models/User/Group/types.d.ts +10 -0
- package/models/User/Group/types.js +2 -0
- package/models/User/Notification/index.d.ts +25 -0
- package/models/User/Notification/index.js +73 -0
- package/models/User/Notification/types.d.ts +25 -0
- package/models/User/Notification/types.js +2 -0
- package/models/User/basic.d.ts +13 -0
- package/models/User/basic.js +35 -0
- package/models/User/index.d.ts +46 -0
- package/models/User/index.js +119 -0
- package/models/User/types.d.ts +68 -0
- package/models/User/types.js +26 -0
- package/package.json +39 -0
package/lang/index.js
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getTranslation = exports.getDateLang = exports.defaultLocale = exports.LanguagesTypes = void 0;
|
|
7
|
+
const ca_1 = __importDefault(require("date-fns/locale/ca"));
|
|
8
|
+
const de_1 = __importDefault(require("date-fns/locale/de"));
|
|
9
|
+
const en_US_1 = __importDefault(require("date-fns/locale/en-US"));
|
|
10
|
+
const es_1 = __importDefault(require("date-fns/locale/es"));
|
|
11
|
+
const gl_1 = __importDefault(require("date-fns/locale/gl"));
|
|
12
|
+
const get_1 = __importDefault(require("lodash/get"));
|
|
13
|
+
const ca_json_1 = __importDefault(require("./ca.json"));
|
|
14
|
+
const de_json_1 = __importDefault(require("./de.json"));
|
|
15
|
+
const en_json_1 = __importDefault(require("./en.json"));
|
|
16
|
+
const es_json_1 = __importDefault(require("./es.json"));
|
|
17
|
+
const gl_json_1 = __importDefault(require("./gl.json"));
|
|
18
|
+
var LanguagesTypes;
|
|
19
|
+
(function (LanguagesTypes) {
|
|
20
|
+
LanguagesTypes["ES"] = "es";
|
|
21
|
+
LanguagesTypes["EN"] = "en";
|
|
22
|
+
LanguagesTypes["CA"] = "ca";
|
|
23
|
+
LanguagesTypes["GL"] = "gl";
|
|
24
|
+
LanguagesTypes["DE"] = "de";
|
|
25
|
+
})(LanguagesTypes = exports.LanguagesTypes || (exports.LanguagesTypes = {}));
|
|
26
|
+
const languageProvider = {
|
|
27
|
+
es: {
|
|
28
|
+
messages: es_json_1.default,
|
|
29
|
+
date: {
|
|
30
|
+
locale: es_1.default,
|
|
31
|
+
format: {
|
|
32
|
+
date: "iiii d 'de' MMMM",
|
|
33
|
+
datetime: "iiii d 'de' MMMM 'a las' HH:mm'h.'",
|
|
34
|
+
shortDate: 'dd/MM/yy',
|
|
35
|
+
time: "HH:mm'h.'",
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
en: {
|
|
40
|
+
messages: en_json_1.default,
|
|
41
|
+
date: {
|
|
42
|
+
locale: en_US_1.default,
|
|
43
|
+
format: {
|
|
44
|
+
date: "iiii',' MMMM d",
|
|
45
|
+
datetime: "iiii',' MMMM d 'at' h:mm aaaa",
|
|
46
|
+
shortDate: 'MM/dd/yy',
|
|
47
|
+
time: 'h:mm aaaa',
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
ca: {
|
|
52
|
+
messages: ca_json_1.default,
|
|
53
|
+
date: {
|
|
54
|
+
locale: ca_1.default,
|
|
55
|
+
format: {
|
|
56
|
+
date: "iiii d 'de' MMMM",
|
|
57
|
+
datetime: "iiii d 'de' MMMM 'a les' HH:mm'h.'",
|
|
58
|
+
shortDate: 'dd/MM/yy',
|
|
59
|
+
time: "HH:mm'h.'",
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
gl: {
|
|
64
|
+
messages: gl_json_1.default,
|
|
65
|
+
date: {
|
|
66
|
+
locale: gl_1.default,
|
|
67
|
+
format: {
|
|
68
|
+
date: "iiii d 'de' MMMM",
|
|
69
|
+
datetime: "iiii d 'de' MMMM 'a las' HH:mm'h.'",
|
|
70
|
+
shortDate: 'dd/MM/yy',
|
|
71
|
+
time: "HH:mm'h.'",
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
de: {
|
|
76
|
+
messages: de_json_1.default,
|
|
77
|
+
date: {
|
|
78
|
+
locale: de_1.default,
|
|
79
|
+
format: {
|
|
80
|
+
date: "iiii',' MMMM d",
|
|
81
|
+
datetime: "iiii',' MMMM d 'um' HH:mm 'Uhr'",
|
|
82
|
+
shortDate: 'MM/dd/yy',
|
|
83
|
+
time: "HH:mm 'Uhr'",
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
};
|
|
88
|
+
exports.defaultLocale = LanguagesTypes.ES;
|
|
89
|
+
const getDateLang = (lang) => {
|
|
90
|
+
return languageProvider[lang].date;
|
|
91
|
+
};
|
|
92
|
+
exports.getDateLang = getDateLang;
|
|
93
|
+
const getTranslation = (key, lang) => {
|
|
94
|
+
const translation = get_1.default(languageProvider, [lang, 'messages', key]);
|
|
95
|
+
if (!translation) {
|
|
96
|
+
return '';
|
|
97
|
+
}
|
|
98
|
+
return translation;
|
|
99
|
+
};
|
|
100
|
+
exports.getTranslation = getTranslation;
|
|
101
|
+
exports.default = languageProvider;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { DocumentReference, DocumentSnapshot } from '@google-cloud/firestore';
|
|
2
|
+
import { LanguagesTypes } from '../../lang';
|
|
3
|
+
import Model from '../Model';
|
|
4
|
+
import { CommunicationData, CommunicationThumbnailType, CommunicationType } from './types';
|
|
5
|
+
export default class Communication extends Model<CommunicationData> {
|
|
6
|
+
protected lang: LanguagesTypes;
|
|
7
|
+
constructor(doc: DocumentSnapshot, lang?: LanguagesTypes);
|
|
8
|
+
get title(): string;
|
|
9
|
+
get message(): import("slate").Node[];
|
|
10
|
+
get promoter(): DocumentReference;
|
|
11
|
+
get promoterInfo(): import("../Group/types").GroupTinyData;
|
|
12
|
+
get owner(): DocumentReference;
|
|
13
|
+
get ownerInfo(): import("../User/types").UserTinyData | import("../Group/types").GroupTinyData;
|
|
14
|
+
get allowAnswer(): boolean;
|
|
15
|
+
get recipients(): string[];
|
|
16
|
+
get recipientsInfo(): Record<string, import("./types").CommunicationRecipientData>;
|
|
17
|
+
get listRecipients(): (import("./types").CommunicationRecipientData & {
|
|
18
|
+
id: string;
|
|
19
|
+
})[];
|
|
20
|
+
get type(): CommunicationType;
|
|
21
|
+
get isPrivate(): boolean;
|
|
22
|
+
get isPublic(): boolean;
|
|
23
|
+
get attachmentsPath(): string[];
|
|
24
|
+
get imagesPath(): string[];
|
|
25
|
+
get deletedAt(): FirebaseFirestore.Timestamp | null;
|
|
26
|
+
get isDeleted(): boolean;
|
|
27
|
+
get isActive(): boolean;
|
|
28
|
+
get plainText(): string;
|
|
29
|
+
get createdAt(): FirebaseFirestore.Timestamp;
|
|
30
|
+
get createdToNow(): string;
|
|
31
|
+
get thumbnailType(): CommunicationThumbnailType | null;
|
|
32
|
+
get isThumbnailAvatar(): boolean;
|
|
33
|
+
get isThumbnailImage(): boolean;
|
|
34
|
+
get thumbnailURL(): string | null;
|
|
35
|
+
get avatar(): (import("../User/types").UserTinyData & {
|
|
36
|
+
id: string;
|
|
37
|
+
}) | null;
|
|
38
|
+
get thumbnail(): {
|
|
39
|
+
url: string;
|
|
40
|
+
alt: string;
|
|
41
|
+
};
|
|
42
|
+
get editedAt(): FirebaseFirestore.Timestamp | null;
|
|
43
|
+
get totalClaps(): number;
|
|
44
|
+
get totalViews(): number;
|
|
45
|
+
get isServer(): boolean;
|
|
46
|
+
getRecipient: (userId: string) => import("./types").CommunicationRecipientData | null;
|
|
47
|
+
}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const date_fns_1 = require("date-fns");
|
|
7
|
+
const lodash_1 = require("lodash");
|
|
8
|
+
const utils_1 = require("../../helpers/utils");
|
|
9
|
+
const lang_1 = require("../../lang");
|
|
10
|
+
const Model_1 = __importDefault(require("../Model"));
|
|
11
|
+
const types_1 = require("./types");
|
|
12
|
+
class Communication extends Model_1.default {
|
|
13
|
+
constructor(doc, lang = lang_1.defaultLocale) {
|
|
14
|
+
super(doc);
|
|
15
|
+
this.getRecipient = (userId) => {
|
|
16
|
+
return userId in this.recipientsInfo ? this.recipientsInfo[userId] : null;
|
|
17
|
+
};
|
|
18
|
+
this.lang = lang;
|
|
19
|
+
}
|
|
20
|
+
get title() {
|
|
21
|
+
return this.data.title;
|
|
22
|
+
}
|
|
23
|
+
get message() {
|
|
24
|
+
return this.data.message || [];
|
|
25
|
+
}
|
|
26
|
+
get promoter() {
|
|
27
|
+
return this.data.promoter;
|
|
28
|
+
}
|
|
29
|
+
get promoterInfo() {
|
|
30
|
+
return this.data.promoterInfo;
|
|
31
|
+
}
|
|
32
|
+
get owner() {
|
|
33
|
+
return this.data.owner;
|
|
34
|
+
}
|
|
35
|
+
get ownerInfo() {
|
|
36
|
+
return this.data.ownerInfo;
|
|
37
|
+
}
|
|
38
|
+
get allowAnswer() {
|
|
39
|
+
return this.data.allowAnswers || false;
|
|
40
|
+
}
|
|
41
|
+
get recipients() {
|
|
42
|
+
return this.data.recipients || [];
|
|
43
|
+
}
|
|
44
|
+
get recipientsInfo() {
|
|
45
|
+
return this.data.recipientsInfo || {};
|
|
46
|
+
}
|
|
47
|
+
get listRecipients() {
|
|
48
|
+
return Object.keys(this.recipientsInfo).map((userId) => Object.assign(this.recipientsInfo[userId], { id: userId }));
|
|
49
|
+
}
|
|
50
|
+
get type() {
|
|
51
|
+
return this.data.type;
|
|
52
|
+
}
|
|
53
|
+
get isPrivate() {
|
|
54
|
+
return this.data.type === types_1.CommunicationType.Private;
|
|
55
|
+
}
|
|
56
|
+
get isPublic() {
|
|
57
|
+
return this.data.type === types_1.CommunicationType.Public;
|
|
58
|
+
}
|
|
59
|
+
get attachmentsPath() {
|
|
60
|
+
return this.data.attachmentsPath || [];
|
|
61
|
+
}
|
|
62
|
+
get imagesPath() {
|
|
63
|
+
return this.data.imagesPath || [];
|
|
64
|
+
}
|
|
65
|
+
get deletedAt() {
|
|
66
|
+
return this.data.deletedAt || null;
|
|
67
|
+
}
|
|
68
|
+
get isDeleted() {
|
|
69
|
+
return !this.exists || !lodash_1.isNull(this.deletedAt);
|
|
70
|
+
}
|
|
71
|
+
get isActive() {
|
|
72
|
+
return !this.isDeleted;
|
|
73
|
+
}
|
|
74
|
+
get plainText() {
|
|
75
|
+
return utils_1.serializeSlateBlock(this.message);
|
|
76
|
+
}
|
|
77
|
+
get createdAt() {
|
|
78
|
+
return this.data.createdAt;
|
|
79
|
+
}
|
|
80
|
+
get createdToNow() {
|
|
81
|
+
const dateLang = lang_1.getDateLang(this.lang);
|
|
82
|
+
// @ÑAPA
|
|
83
|
+
const text = date_fns_1.formatDistanceToNow(this.createdAt.toDate(), { locale: dateLang.locale })
|
|
84
|
+
.replace('alrededor de', 'hace')
|
|
85
|
+
.replace('arredor de', 'fa');
|
|
86
|
+
return text;
|
|
87
|
+
}
|
|
88
|
+
get thumbnailType() {
|
|
89
|
+
return this.data.thumbnailType || null;
|
|
90
|
+
}
|
|
91
|
+
get isThumbnailAvatar() {
|
|
92
|
+
return this.thumbnailType === types_1.CommunicationThumbnailType.Avatar;
|
|
93
|
+
}
|
|
94
|
+
get isThumbnailImage() {
|
|
95
|
+
return this.thumbnailType === types_1.CommunicationThumbnailType.Image;
|
|
96
|
+
}
|
|
97
|
+
get thumbnailURL() {
|
|
98
|
+
return this.data.thumbnailURL || null;
|
|
99
|
+
}
|
|
100
|
+
get avatar() {
|
|
101
|
+
return this.data.avatar || null;
|
|
102
|
+
}
|
|
103
|
+
get thumbnail() {
|
|
104
|
+
if (this.isThumbnailAvatar && this.avatar) {
|
|
105
|
+
return {
|
|
106
|
+
url: this.avatar.photoURL,
|
|
107
|
+
alt: this.avatar.displayName,
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
if (this.isThumbnailImage && this.thumbnailURL) {
|
|
111
|
+
return {
|
|
112
|
+
url: this.thumbnailURL,
|
|
113
|
+
alt: '',
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
return {
|
|
117
|
+
url: this.promoterInfo.photoURL,
|
|
118
|
+
alt: this.promoterInfo.displayName,
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
get editedAt() {
|
|
122
|
+
return this.data.editedAt || null;
|
|
123
|
+
}
|
|
124
|
+
get totalClaps() {
|
|
125
|
+
return this.listRecipients
|
|
126
|
+
.map((recipient) => recipient.claps || 0)
|
|
127
|
+
.reduce((acc, current) => acc + current, 0);
|
|
128
|
+
}
|
|
129
|
+
get totalViews() {
|
|
130
|
+
return this.listRecipients
|
|
131
|
+
.map((recipient) => recipient.countViews || 0)
|
|
132
|
+
.reduce((acc, current) => acc + current, 0);
|
|
133
|
+
}
|
|
134
|
+
get isServer() {
|
|
135
|
+
return this.data.server === true;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
exports.default = Communication;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { DocumentReference, Timestamp } from '@google-cloud/firestore';
|
|
2
|
+
import { Node } from 'slate';
|
|
3
|
+
import { GroupTinyData } from '../Group/types';
|
|
4
|
+
import { UserTinyData } from '../User/types';
|
|
5
|
+
export declare enum CommunicationType {
|
|
6
|
+
Private = "user",
|
|
7
|
+
Public = "group"
|
|
8
|
+
}
|
|
9
|
+
export declare enum CommunicationThumbnailType {
|
|
10
|
+
Avatar = "avatar",
|
|
11
|
+
Image = "image"
|
|
12
|
+
}
|
|
13
|
+
export interface RichTextChildren {
|
|
14
|
+
text: string;
|
|
15
|
+
bold?: boolean;
|
|
16
|
+
italic?: boolean;
|
|
17
|
+
underline?: boolean;
|
|
18
|
+
}
|
|
19
|
+
export interface RichText {
|
|
20
|
+
type: string;
|
|
21
|
+
url?: string;
|
|
22
|
+
children: RichTextChildren[] | RichText[];
|
|
23
|
+
}
|
|
24
|
+
export interface CommunicationRecipientData {
|
|
25
|
+
sendedAt: Timestamp;
|
|
26
|
+
claps: number;
|
|
27
|
+
viewedAt: Timestamp | null;
|
|
28
|
+
lastViewedAt: Timestamp | null;
|
|
29
|
+
countViews: number;
|
|
30
|
+
}
|
|
31
|
+
export interface CommunicationData {
|
|
32
|
+
title: string;
|
|
33
|
+
message: Node[];
|
|
34
|
+
promoter: DocumentReference;
|
|
35
|
+
promoterInfo: GroupTinyData;
|
|
36
|
+
type: CommunicationType;
|
|
37
|
+
owner: DocumentReference;
|
|
38
|
+
ownerInfo: GroupTinyData | UserTinyData;
|
|
39
|
+
allowAnswers: boolean;
|
|
40
|
+
attachmentsPath: string[];
|
|
41
|
+
imagesPath: string[];
|
|
42
|
+
recipients: string[];
|
|
43
|
+
recipientsInfo: Record<string, CommunicationRecipientData>;
|
|
44
|
+
thumbnailType: CommunicationThumbnailType | null;
|
|
45
|
+
thumbnailURL: string | null;
|
|
46
|
+
avatar: (UserTinyData & {
|
|
47
|
+
id: string;
|
|
48
|
+
}) | null;
|
|
49
|
+
deletedAt: Timestamp | null;
|
|
50
|
+
editedAt: Timestamp | null;
|
|
51
|
+
readonly server: boolean;
|
|
52
|
+
readonly createdAt: Timestamp;
|
|
53
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CommunicationThumbnailType = exports.CommunicationType = void 0;
|
|
4
|
+
var CommunicationType;
|
|
5
|
+
(function (CommunicationType) {
|
|
6
|
+
CommunicationType["Private"] = "user";
|
|
7
|
+
CommunicationType["Public"] = "group";
|
|
8
|
+
})(CommunicationType = exports.CommunicationType || (exports.CommunicationType = {}));
|
|
9
|
+
var CommunicationThumbnailType;
|
|
10
|
+
(function (CommunicationThumbnailType) {
|
|
11
|
+
CommunicationThumbnailType["Avatar"] = "avatar";
|
|
12
|
+
CommunicationThumbnailType["Image"] = "image";
|
|
13
|
+
})(CommunicationThumbnailType = exports.CommunicationThumbnailType || (exports.CommunicationThumbnailType = {}));
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
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 Counters extends Model_1.default {
|
|
8
|
+
constructor(doc) {
|
|
9
|
+
super(doc);
|
|
10
|
+
}
|
|
11
|
+
get count() {
|
|
12
|
+
return this.data.count || 0;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
exports.default = Counters;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as firestore from '@google-cloud/firestore';
|
|
2
|
+
import { LanguagesTypes } from '../../../lang';
|
|
3
|
+
import PlayerBasic from '../../Player/basic';
|
|
4
|
+
import { EventPlayerData, EventPlayerStatus } from './types';
|
|
5
|
+
export default class EventoPlayer extends PlayerBasic<EventPlayerData> {
|
|
6
|
+
constructor(doc: firestore.DocumentSnapshot, lang?: LanguagesTypes);
|
|
7
|
+
get joinedAt(): firestore.Timestamp;
|
|
8
|
+
get eventId(): string;
|
|
9
|
+
get status(): EventPlayerStatus | null;
|
|
10
|
+
get isConfirmed(): boolean;
|
|
11
|
+
get isDeclined(): boolean;
|
|
12
|
+
get isPending(): boolean;
|
|
13
|
+
get rollcall(): EventPlayerStatus | null;
|
|
14
|
+
get isRollCallConfirmed(): boolean;
|
|
15
|
+
get isRollCallDeclined(): boolean;
|
|
16
|
+
get rollCalledAt(): firestore.Timestamp | null;
|
|
17
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const get_1 = __importDefault(require("lodash/get"));
|
|
7
|
+
const lang_1 = require("../../../lang");
|
|
8
|
+
const basic_1 = __importDefault(require("../../Player/basic"));
|
|
9
|
+
const types_1 = require("./types");
|
|
10
|
+
class EventoPlayer extends basic_1.default {
|
|
11
|
+
constructor(doc, lang = lang_1.defaultLocale) {
|
|
12
|
+
super(doc, lang);
|
|
13
|
+
}
|
|
14
|
+
get joinedAt() {
|
|
15
|
+
return this.data.joinedAt;
|
|
16
|
+
}
|
|
17
|
+
get eventId() {
|
|
18
|
+
return get_1.default(this.ref, 'parent.parent.id');
|
|
19
|
+
}
|
|
20
|
+
get status() {
|
|
21
|
+
return this.data.status;
|
|
22
|
+
}
|
|
23
|
+
get isConfirmed() {
|
|
24
|
+
return this.status === types_1.EventPlayerStatus.Confirmed;
|
|
25
|
+
}
|
|
26
|
+
get isDeclined() {
|
|
27
|
+
return this.status === types_1.EventPlayerStatus.Declined;
|
|
28
|
+
}
|
|
29
|
+
get isPending() {
|
|
30
|
+
return this.status === null;
|
|
31
|
+
}
|
|
32
|
+
get rollcall() {
|
|
33
|
+
return this.data.rollcall || null;
|
|
34
|
+
}
|
|
35
|
+
get isRollCallConfirmed() {
|
|
36
|
+
return this.rollcall === types_1.EventPlayerStatus.Confirmed;
|
|
37
|
+
}
|
|
38
|
+
get isRollCallDeclined() {
|
|
39
|
+
return this.rollcall === types_1.EventPlayerStatus.Declined;
|
|
40
|
+
}
|
|
41
|
+
get rollCalledAt() {
|
|
42
|
+
return this.data.rollCalledAt || null;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
exports.default = EventoPlayer;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Timestamp } from '@google-cloud/firestore';
|
|
2
|
+
import { EventPlayerBasicData } from '../types';
|
|
3
|
+
export declare enum EventPlayerStatus {
|
|
4
|
+
Confirmed = "confirmed",
|
|
5
|
+
Declined = "declined"
|
|
6
|
+
}
|
|
7
|
+
export interface EventPlayerData extends EventPlayerBasicData {
|
|
8
|
+
joinedAt: Timestamp;
|
|
9
|
+
rollCalledAt: Timestamp | null;
|
|
10
|
+
/** @deprecated use rollcall */
|
|
11
|
+
rollCallStatus?: EventPlayerStatus;
|
|
12
|
+
}
|
|
13
|
+
export interface AEventPlayerData extends EventPlayerData {
|
|
14
|
+
id: string;
|
|
15
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EventPlayerStatus = void 0;
|
|
4
|
+
var EventPlayerStatus;
|
|
5
|
+
(function (EventPlayerStatus) {
|
|
6
|
+
EventPlayerStatus["Confirmed"] = "confirmed";
|
|
7
|
+
EventPlayerStatus["Declined"] = "declined";
|
|
8
|
+
})(EventPlayerStatus = exports.EventPlayerStatus || (exports.EventPlayerStatus = {}));
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as firestore from '@google-cloud/firestore';
|
|
2
|
+
import Theme from '../../Repertory/basic';
|
|
3
|
+
import { EventRepertoryData } from './types';
|
|
4
|
+
export default class EventoRepertory extends Theme<EventRepertoryData> {
|
|
5
|
+
constructor(doc: firestore.DocumentSnapshot);
|
|
6
|
+
get createdAt(): firestore.Timestamp;
|
|
7
|
+
get eventId(): string;
|
|
8
|
+
get isActive(): boolean;
|
|
9
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const get_1 = __importDefault(require("lodash/get"));
|
|
7
|
+
const basic_1 = __importDefault(require("../../Repertory/basic"));
|
|
8
|
+
class EventoRepertory extends basic_1.default {
|
|
9
|
+
constructor(doc) {
|
|
10
|
+
super(doc);
|
|
11
|
+
}
|
|
12
|
+
get createdAt() {
|
|
13
|
+
return this.data.createdAt;
|
|
14
|
+
}
|
|
15
|
+
get eventId() {
|
|
16
|
+
return get_1.default(this.ref, 'parent.parent.id');
|
|
17
|
+
}
|
|
18
|
+
get isActive() {
|
|
19
|
+
return this.exists;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
exports.default = EventoRepertory;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { DocumentSnapshot } from '@google-cloud/firestore';
|
|
2
|
+
import { LanguagesTypes } from '../../lang';
|
|
3
|
+
import Model from '../Model';
|
|
4
|
+
import { EventBasicData, EventTinyData, EventType } from './types';
|
|
5
|
+
export default class EventoBasic<D> extends Model<EventBasicData & D> {
|
|
6
|
+
protected lang: LanguagesTypes;
|
|
7
|
+
constructor(doc: DocumentSnapshot, lang: LanguagesTypes);
|
|
8
|
+
get tinyInfo(): EventTinyData;
|
|
9
|
+
get basicInfo(): EventBasicData;
|
|
10
|
+
get displayName(): string | null;
|
|
11
|
+
get title(): string;
|
|
12
|
+
get type(): EventType;
|
|
13
|
+
get isPractice(): boolean;
|
|
14
|
+
get isPerformance(): boolean;
|
|
15
|
+
get locality(): string | null;
|
|
16
|
+
get online(): boolean;
|
|
17
|
+
get datetime(): FirebaseFirestore.Timestamp;
|
|
18
|
+
get datetimeEnd(): FirebaseFirestore.Timestamp;
|
|
19
|
+
get duration(): number;
|
|
20
|
+
get isOutDate(): boolean;
|
|
21
|
+
get isHappening(): boolean;
|
|
22
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const date_fns_1 = require("date-fns");
|
|
7
|
+
const lang_1 = require("../../lang");
|
|
8
|
+
const Model_1 = __importDefault(require("../Model"));
|
|
9
|
+
const types_1 = require("./types");
|
|
10
|
+
class EventoBasic extends Model_1.default {
|
|
11
|
+
constructor(doc, lang) {
|
|
12
|
+
super(doc);
|
|
13
|
+
this.lang = lang;
|
|
14
|
+
}
|
|
15
|
+
get tinyInfo() {
|
|
16
|
+
return {
|
|
17
|
+
displayName: this.displayName,
|
|
18
|
+
datetime: this.datetime,
|
|
19
|
+
type: this.type,
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
get basicInfo() {
|
|
23
|
+
return {
|
|
24
|
+
displayName: this.displayName,
|
|
25
|
+
locality: this.locality,
|
|
26
|
+
online: this.online,
|
|
27
|
+
datetime: this.datetime,
|
|
28
|
+
datetimeEnd: this.datetimeEnd,
|
|
29
|
+
type: this.type,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
get displayName() {
|
|
33
|
+
return this.data.displayName;
|
|
34
|
+
}
|
|
35
|
+
get title() {
|
|
36
|
+
if (this.displayName) {
|
|
37
|
+
return this.displayName;
|
|
38
|
+
}
|
|
39
|
+
return lang_1.getTranslation(this.type, this.lang) || lang_1.getTranslation('event', this.lang);
|
|
40
|
+
}
|
|
41
|
+
get type() {
|
|
42
|
+
return this.data.type;
|
|
43
|
+
}
|
|
44
|
+
get isPractice() {
|
|
45
|
+
return this.type === types_1.EventType.Practice;
|
|
46
|
+
}
|
|
47
|
+
get isPerformance() {
|
|
48
|
+
return this.type === types_1.EventType.Performance;
|
|
49
|
+
}
|
|
50
|
+
get locality() {
|
|
51
|
+
return this.data.locality;
|
|
52
|
+
}
|
|
53
|
+
get online() {
|
|
54
|
+
return this.data.online || false;
|
|
55
|
+
}
|
|
56
|
+
get datetime() {
|
|
57
|
+
return this.data.datetime;
|
|
58
|
+
}
|
|
59
|
+
get datetimeEnd() {
|
|
60
|
+
return this.data.datetimeEnd;
|
|
61
|
+
}
|
|
62
|
+
get duration() {
|
|
63
|
+
return this.datetimeEnd.seconds - this.datetime.seconds;
|
|
64
|
+
}
|
|
65
|
+
get isOutDate() {
|
|
66
|
+
return date_fns_1.isPast(this.datetimeEnd.toDate());
|
|
67
|
+
}
|
|
68
|
+
get isHappening() {
|
|
69
|
+
return date_fns_1.isPast(this.datetime.toDate()) && date_fns_1.isFuture(this.datetimeEnd.toDate());
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
exports.default = EventoBasic;
|