@glissandoo/lib 1.10.0 → 1.10.2

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.
@@ -52,5 +52,11 @@ export declare namespace GroupRepertoryFbFunctionsTypes {
52
52
  score?: number;
53
53
  }
54
54
  export type IdentifyInstrumentsResult = IdentifyInstrumentItem[];
55
+ export interface RateParams {
56
+ groupId: string;
57
+ themeId: string;
58
+ value: number;
59
+ }
60
+ export type RateResult = void;
55
61
  export {};
56
62
  }
@@ -57,6 +57,7 @@ export declare enum FbFunctionName {
57
57
  GroupRepertoryOnUpdate = "groupRepertory-onUpdate",
58
58
  GroupRepertoryPublish = "groupRepertory-publish",
59
59
  GroupRepertoryRemove = "groupRepertory-remove",
60
+ GroupRepertoryRate = "groupRepertory-rate",
60
61
  GroupSendInvitationEmail = "group-sendInvitationEmail",
61
62
  JWTGenerate = "jwt-generate",
62
63
  MetricsDaily = "metrics-daily",
@@ -61,6 +61,7 @@ var FbFunctionName;
61
61
  FbFunctionName["GroupRepertoryOnUpdate"] = "groupRepertory-onUpdate";
62
62
  FbFunctionName["GroupRepertoryPublish"] = "groupRepertory-publish";
63
63
  FbFunctionName["GroupRepertoryRemove"] = "groupRepertory-remove";
64
+ FbFunctionName["GroupRepertoryRate"] = "groupRepertory-rate";
64
65
  FbFunctionName["GroupSendInvitationEmail"] = "group-sendInvitationEmail";
65
66
  FbFunctionName["JWTGenerate"] = "jwt-generate";
66
67
  FbFunctionName["MetricsDaily"] = "metrics-daily";
@@ -35,6 +35,7 @@ const regionByFunctions = {
35
35
  [index_1.FbFunctionName.GroupRepertoryPublish]: GCloudRegions.UsCentral1,
36
36
  [index_1.FbFunctionName.GroupRepertoryEdit]: GCloudRegions.UsCentral1,
37
37
  [index_1.FbFunctionName.GroupRepertoryRemove]: GCloudRegions.UsCentral1,
38
+ [index_1.FbFunctionName.GroupRepertoryRate]: GCloudRegions.EuropeWest6,
38
39
  [index_1.FbFunctionName.GroupRepertoryDownloadThemeFiles]: GCloudRegions.UsCentral1,
39
40
  [index_1.FbFunctionName.GroupRepertoryIdentifyInstruments]: GCloudRegions.UsCentral1,
40
41
  [index_1.FbFunctionName.GroupRepertoryClaimMusicSheet]: GCloudRegions.UsCentral1,
@@ -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",
@@ -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";
@@ -15,6 +15,10 @@ 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
+ get votesCount(): number;
20
+ voteByUserId(userId: string): number | null;
21
+ get rating(): number;
18
22
  get events(): string[];
19
23
  get eventsTL(): Record<string, import("../../Evento/types").EventTinyData>;
20
24
  get eventsList(): EventoTiny[];
@@ -29,6 +29,21 @@ 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
+ get votesCount() {
36
+ return Object.keys(this.votes).length;
37
+ }
38
+ voteByUserId(userId) {
39
+ return this.votes[userId] || null;
40
+ }
41
+ get rating() {
42
+ const totalVotes = Object.entries(this.votes).reduce((acc, [, value]) => acc + value, 0);
43
+ if (this.votesCount === 0 || totalVotes === 0)
44
+ return 0;
45
+ return Math.round((totalVotes / this.votesCount) * 100) / 100;
46
+ }
32
47
  get events() {
33
48
  return this.data.events || [];
34
49
  }
@@ -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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glissandoo/lib",
3
- "version": "1.10.0",
3
+ "version": "1.10.2",
4
4
  "description": "Glissandoo library js",
5
5
  "main": "./index.js",
6
6
  "types": "./index.d.ts",