@glissandoo/lib 1.9.2 → 1.10.1
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/helpers/appScenes.d.ts +1 -0
- package/helpers/appScenes.js +1 -0
- package/helpers/notifications.d.ts +2 -4
- package/helpers/notifications.js +5 -4
- package/models/Group/Repertory/index.d.ts +3 -0
- package/models/Group/Repertory/index.js +13 -0
- package/models/Group/Repertory/types.d.ts +1 -0
- package/models/User/index.d.ts +3 -12
- package/models/User/index.js +5 -19
- package/models/User/types.d.ts +6 -0
- package/models/User/types.js +6 -1
- package/package.json +1 -1
package/helpers/appScenes.d.ts
CHANGED
|
@@ -24,6 +24,7 @@ export declare enum AppScenes {
|
|
|
24
24
|
EditProfilePhotoURL = "EditProfilePhotoURL",
|
|
25
25
|
EditProfileDescription = "EditProfileDescription",
|
|
26
26
|
EditProfileLanguage = "EditProfileLanguage",
|
|
27
|
+
EditProfileNotifications = "EditProfileNotifications",
|
|
27
28
|
CommunicationList = "communications",
|
|
28
29
|
CommunicationNewComment = "communicationNewComment",
|
|
29
30
|
Communication = "communication",
|
package/helpers/appScenes.js
CHANGED
|
@@ -28,6 +28,7 @@ var AppScenes;
|
|
|
28
28
|
AppScenes["EditProfilePhotoURL"] = "EditProfilePhotoURL";
|
|
29
29
|
AppScenes["EditProfileDescription"] = "EditProfileDescription";
|
|
30
30
|
AppScenes["EditProfileLanguage"] = "EditProfileLanguage";
|
|
31
|
+
AppScenes["EditProfileNotifications"] = "EditProfileNotifications";
|
|
31
32
|
AppScenes["CommunicationList"] = "communications";
|
|
32
33
|
AppScenes["CommunicationNewComment"] = "communicationNewComment";
|
|
33
34
|
AppScenes["Communication"] = "communication";
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { EventoFbFunctionsTypes } from '../functions/event';
|
|
2
2
|
import { NotificationActions } from '../models/Notification/types';
|
|
3
|
+
import { UserNotificationSettings } from '../models/User/types';
|
|
3
4
|
import { BadgesTypes } from './badges';
|
|
4
5
|
export declare const notificationActionsBadges: Record<BadgesTypes, {
|
|
5
6
|
firstLevel: NotificationActions;
|
|
@@ -32,8 +33,5 @@ declare type RelationActionNotification = Record<NotificationEventActions, Notif
|
|
|
32
33
|
export declare const notificationPerformance: RelationActionNotification;
|
|
33
34
|
export declare const notificationSinglePractice: RelationActionNotification;
|
|
34
35
|
export declare const notificationMultiplePractice: RelationActionNotification;
|
|
35
|
-
export declare const
|
|
36
|
-
eventAssistanceConfirm: NotificationActions[];
|
|
37
|
-
eventAssistanceDecline: NotificationActions[];
|
|
38
|
-
};
|
|
36
|
+
export declare const userNotificationSettings: Record<UserNotificationSettings, NotificationActions[]>;
|
|
39
37
|
export {};
|
package/helpers/notifications.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.userNotificationSettings = exports.notificationMultiplePractice = exports.notificationSinglePractice = exports.notificationPerformance = exports.editScopeToAction = exports.NotificationEventActions = exports.notificationActionsBadges = void 0;
|
|
4
4
|
const types_1 = require("../models/Notification/types");
|
|
5
|
+
const types_2 = require("../models/User/types");
|
|
5
6
|
const badges_1 = require("./badges");
|
|
6
7
|
exports.notificationActionsBadges = {
|
|
7
8
|
[badges_1.BadgesTypes.AccPerformances]: {
|
|
@@ -113,12 +114,12 @@ exports.notificationMultiplePractice = {
|
|
|
113
114
|
reminderMorningPending: types_1.NotificationActions.PracticeMorningReminderPending,
|
|
114
115
|
reminderRollcall: types_1.NotificationActions.PracticeRollCallReminder,
|
|
115
116
|
};
|
|
116
|
-
exports.
|
|
117
|
-
|
|
117
|
+
exports.userNotificationSettings = {
|
|
118
|
+
[types_2.UserNotificationSettings.AttendanceConfirmed]: [
|
|
118
119
|
types_1.NotificationActions.PerformanceAssistanceConfirm,
|
|
119
120
|
types_1.NotificationActions.PracticeAssistanceConfirm,
|
|
120
121
|
],
|
|
121
|
-
|
|
122
|
+
[types_2.UserNotificationSettings.AttendanceDeclined]: [
|
|
122
123
|
types_1.NotificationActions.PerformanceAssistanceDecline,
|
|
123
124
|
types_1.NotificationActions.PracticeAssistanceDecline,
|
|
124
125
|
],
|
|
@@ -15,6 +15,9 @@ export default class GroupRepertory extends Theme<GroupRepertoryData> {
|
|
|
15
15
|
pages: number[];
|
|
16
16
|
}[];
|
|
17
17
|
get mainFilePath(): string | null;
|
|
18
|
+
get votes(): Record<string, number>;
|
|
19
|
+
voteByUserId(userId: string): number | null;
|
|
20
|
+
get rating(): number;
|
|
18
21
|
get events(): string[];
|
|
19
22
|
get eventsTL(): Record<string, import("../../Evento/types").EventTinyData>;
|
|
20
23
|
get eventsList(): EventoTiny[];
|
|
@@ -29,6 +29,19 @@ class GroupRepertory extends basic_1.default {
|
|
|
29
29
|
get mainFilePath() {
|
|
30
30
|
return this.data.mainFilePath;
|
|
31
31
|
}
|
|
32
|
+
get votes() {
|
|
33
|
+
return this.data.votes || {};
|
|
34
|
+
}
|
|
35
|
+
voteByUserId(userId) {
|
|
36
|
+
return this.votes[userId] || null;
|
|
37
|
+
}
|
|
38
|
+
get rating() {
|
|
39
|
+
const numberVotes = Object.keys(this.votes).length;
|
|
40
|
+
const totalVotes = Object.entries(this.votes).reduce((acc, [, value]) => acc + value, 0);
|
|
41
|
+
if (numberVotes === 0 || totalVotes === 0)
|
|
42
|
+
return 0;
|
|
43
|
+
return Math.round((numberVotes / totalVotes) * 100) / 100;
|
|
44
|
+
}
|
|
32
45
|
get events() {
|
|
33
46
|
return this.data.events || [];
|
|
34
47
|
}
|
|
@@ -31,6 +31,7 @@ export interface GroupRepertoryData extends ThemeBasicData {
|
|
|
31
31
|
mainFilePath: string | null;
|
|
32
32
|
scoresByInstruments: boolean;
|
|
33
33
|
instruments: GroupRepertoryInstrumentItemData[];
|
|
34
|
+
votes: Record<string, number>;
|
|
34
35
|
audios: string[];
|
|
35
36
|
thumbnailURL: string | null;
|
|
36
37
|
identifyAt: Timestamp | null;
|
package/models/User/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DocumentSnapshot } from '@google-cloud/firestore';
|
|
2
2
|
import UserBasic from './basic';
|
|
3
|
-
import { UserAppConfig, UserData, UserRole } from './types';
|
|
3
|
+
import { UserAppConfig, UserData, UserNotificationSettings, UserRole } from './types';
|
|
4
4
|
export default class User extends UserBasic<UserData> {
|
|
5
5
|
constructor(doc: DocumentSnapshot);
|
|
6
6
|
get name(): string;
|
|
@@ -25,18 +25,8 @@ export default class User extends UserBasic<UserData> {
|
|
|
25
25
|
get groupsAdmin(): string[];
|
|
26
26
|
get isAdmin(): boolean;
|
|
27
27
|
get birthDate(): FirebaseFirestore.Timestamp | null;
|
|
28
|
+
get notificationSettings(): Record<UserNotificationSettings, boolean>;
|
|
28
29
|
/** @deprecated */
|
|
29
|
-
private get devices();
|
|
30
|
-
/** @deprecated */
|
|
31
|
-
get devicesList(): (import("./types").DeviceInfo & {
|
|
32
|
-
id: string;
|
|
33
|
-
})[];
|
|
34
|
-
/** @deprecated */
|
|
35
|
-
get hasDevices(): boolean;
|
|
36
|
-
/** @deprecated */
|
|
37
|
-
get device(): (import("./types").DeviceInfo & {
|
|
38
|
-
id: string;
|
|
39
|
-
}) | null;
|
|
40
30
|
get disabledNotifications(): Record<string, boolean>;
|
|
41
31
|
get activeDisabledNotifications(): string[];
|
|
42
32
|
get isActive(): boolean;
|
|
@@ -47,6 +37,7 @@ export default class User extends UserBasic<UserData> {
|
|
|
47
37
|
default_events_filter: import("./types").UserEventsFilter;
|
|
48
38
|
};
|
|
49
39
|
getAppConfig(value: UserAppConfig): string | import("./types").UserEventsFilter | null;
|
|
40
|
+
getNotificationSetting(key: UserNotificationSettings): boolean;
|
|
50
41
|
get registerVia(): import("./types").UserRegisterVia;
|
|
51
42
|
get lastAppLoginAt(): FirebaseFirestore.Timestamp | null;
|
|
52
43
|
}
|
package/models/User/index.js
CHANGED
|
@@ -4,7 +4,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const lodash_1 = require("lodash");
|
|
7
|
-
const orderBy_1 = __importDefault(require("lodash/orderBy"));
|
|
8
7
|
const lang_1 = require("../../lang");
|
|
9
8
|
const basic_1 = __importDefault(require("./basic"));
|
|
10
9
|
const types_1 = require("./types");
|
|
@@ -78,26 +77,10 @@ class User extends basic_1.default {
|
|
|
78
77
|
get birthDate() {
|
|
79
78
|
return this.data.birthDate;
|
|
80
79
|
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
return this.data.devices || {};
|
|
84
|
-
}
|
|
85
|
-
/** @deprecated */
|
|
86
|
-
get devicesList() {
|
|
87
|
-
const list = Object.keys(this.devices).map((id) => Object.assign(this.devices[id], { id }));
|
|
88
|
-
return orderBy_1.default(list, (device) => device.last_seen_at.toDate(), ['desc']);
|
|
80
|
+
get notificationSettings() {
|
|
81
|
+
return this.data.notificationSettings || {};
|
|
89
82
|
}
|
|
90
83
|
/** @deprecated */
|
|
91
|
-
get hasDevices() {
|
|
92
|
-
return this.devicesList.length > 0;
|
|
93
|
-
}
|
|
94
|
-
/** @deprecated */
|
|
95
|
-
get device() {
|
|
96
|
-
if (this.hasDevices) {
|
|
97
|
-
return this.devicesList[0];
|
|
98
|
-
}
|
|
99
|
-
return null;
|
|
100
|
-
}
|
|
101
84
|
get disabledNotifications() {
|
|
102
85
|
return this.data.disabledNotifications || {};
|
|
103
86
|
}
|
|
@@ -119,6 +102,9 @@ class User extends basic_1.default {
|
|
|
119
102
|
getAppConfig(value) {
|
|
120
103
|
return this.data.appConfig[value];
|
|
121
104
|
}
|
|
105
|
+
getNotificationSetting(key) {
|
|
106
|
+
return this.data.notificationSettings[key] || false;
|
|
107
|
+
}
|
|
122
108
|
get registerVia() {
|
|
123
109
|
return this.data.registerVia || null;
|
|
124
110
|
}
|
package/models/User/types.d.ts
CHANGED
|
@@ -12,6 +12,10 @@ export declare enum UserAppConfig {
|
|
|
12
12
|
DefaultGroupId = "default_group_id",
|
|
13
13
|
DefaultEventsFilter = "default_events_filter"
|
|
14
14
|
}
|
|
15
|
+
export declare enum UserNotificationSettings {
|
|
16
|
+
AttendanceConfirmed = "enabled_attendance_confirmed",
|
|
17
|
+
AttendanceDeclined = "enabled_attendance_declined"
|
|
18
|
+
}
|
|
15
19
|
export declare enum UserEventsFilter {
|
|
16
20
|
Month = 1,
|
|
17
21
|
Trimonth = 3,
|
|
@@ -58,6 +62,8 @@ export interface UserData extends UserBasicData {
|
|
|
58
62
|
birthDate: Timestamp | null;
|
|
59
63
|
/** @deprecated */
|
|
60
64
|
devices: Record<string, DeviceInfo> | null;
|
|
65
|
+
notificationSettings: Record<UserNotificationSettings, boolean>;
|
|
66
|
+
/** @deprecated */
|
|
61
67
|
disabledNotifications: Record<string, boolean> | null;
|
|
62
68
|
appConfig: {
|
|
63
69
|
[UserAppConfig.DefaultGroupId]: string | null;
|
package/models/User/types.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.UserEventsFilter = exports.UserAppConfig = exports.UserRegisterVia = exports.UserRole = void 0;
|
|
3
|
+
exports.UserEventsFilter = exports.UserNotificationSettings = exports.UserAppConfig = exports.UserRegisterVia = exports.UserRole = void 0;
|
|
4
4
|
var UserRole;
|
|
5
5
|
(function (UserRole) {
|
|
6
6
|
UserRole["SuperAdmin"] = "admin";
|
|
@@ -16,6 +16,11 @@ var UserAppConfig;
|
|
|
16
16
|
UserAppConfig["DefaultGroupId"] = "default_group_id";
|
|
17
17
|
UserAppConfig["DefaultEventsFilter"] = "default_events_filter";
|
|
18
18
|
})(UserAppConfig = exports.UserAppConfig || (exports.UserAppConfig = {}));
|
|
19
|
+
var UserNotificationSettings;
|
|
20
|
+
(function (UserNotificationSettings) {
|
|
21
|
+
UserNotificationSettings["AttendanceConfirmed"] = "enabled_attendance_confirmed";
|
|
22
|
+
UserNotificationSettings["AttendanceDeclined"] = "enabled_attendance_declined";
|
|
23
|
+
})(UserNotificationSettings = exports.UserNotificationSettings || (exports.UserNotificationSettings = {}));
|
|
19
24
|
var UserEventsFilter;
|
|
20
25
|
(function (UserEventsFilter) {
|
|
21
26
|
UserEventsFilter[UserEventsFilter["Month"] = 1] = "Month";
|