@glissandoo/lib 1.29.1 → 1.30.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/lang/en.json CHANGED
@@ -237,7 +237,7 @@
237
237
  "theme.claim.new.title": "A music sheet review has been submitted by a musician",
238
238
  "theme.claim.update.text": "{instrument:extra.instrumentId} sheet for \"{string:extra.title}\" has been added.",
239
239
  "theme.claim.update.title": "New {instrument:extra.instrumentId} sheet has been added",
240
- "emails.common.footer.contact": "If you have any doubts, please don't hesitate to contact us. Our email is hola@glissandoo.com.",
240
+ "emails.common.footer.contact": "If you have any doubts, please don't hesitate to contact us.\nOur email is hello@glissandoo.com.",
241
241
  "emails.common.footer.rights": "© 2023 Glissandoo.com, All rights reserved.",
242
242
  "emails.biweeklyEventReminder.subject": "Don't miss these events!",
243
243
  "emails.biweeklyEventReminder.title": "Events Summary",
@@ -1,9 +1,8 @@
1
1
  import { DocumentReference, DocumentSnapshot } from '@google-cloud/firestore';
2
2
  import { LanguagesTypes } from '../../lang';
3
- import Model from '../Model';
3
+ import ModelWithLang from '../Model/lang';
4
4
  import { CommunicationData, CommunicationType } from './types';
5
- export default class Communication extends Model<CommunicationData> {
6
- protected lang: LanguagesTypes;
5
+ export default class Communication extends ModelWithLang<CommunicationData> {
7
6
  constructor(doc: DocumentSnapshot, lang?: LanguagesTypes);
8
7
  get title(): string;
9
8
  get message(): import("../../helpers/slate").Descendant[];
@@ -6,15 +6,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const lodash_1 = require("lodash");
7
7
  const utils_1 = require("../../helpers/utils");
8
8
  const lang_1 = require("../../lang");
9
- const Model_1 = __importDefault(require("../Model"));
9
+ const lang_2 = __importDefault(require("../Model/lang"));
10
10
  const types_1 = require("./types");
11
- class Communication extends Model_1.default {
11
+ class Communication extends lang_2.default {
12
12
  constructor(doc, lang = lang_1.defaultLocale) {
13
- super(doc);
13
+ super(doc, lang);
14
14
  this.getRecipient = (userId) => {
15
15
  return userId in this.recipientsInfo ? this.recipientsInfo[userId] : null;
16
16
  };
17
- this.lang = lang;
18
17
  }
19
18
  get title() {
20
19
  return this.data.title;
@@ -1,10 +1,9 @@
1
1
  import { DocumentSnapshot } from '@google-cloud/firestore';
2
2
  import { LanguagesTypes } from '../../lang';
3
- import Model from '../Model';
3
+ import ModelWithLang from '../Model/lang';
4
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);
5
+ export default class EventoBasic<D> extends ModelWithLang<EventBasicData & D> {
6
+ constructor(doc: DocumentSnapshot, lang?: LanguagesTypes);
8
7
  get tinyInfo(): EventTinyData;
9
8
  get basicInfo(): EventBasicData;
10
9
  get displayName(): string | null;
@@ -5,12 +5,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const date_fns_1 = require("date-fns");
7
7
  const lang_1 = require("../../lang");
8
- const Model_1 = __importDefault(require("../Model"));
8
+ const lang_2 = __importDefault(require("../Model/lang"));
9
9
  const types_1 = require("./types");
10
- class EventoBasic extends Model_1.default {
11
- constructor(doc, lang) {
12
- super(doc);
13
- this.lang = lang;
10
+ class EventoBasic extends lang_2.default {
11
+ constructor(doc, lang = lang_1.defaultLocale) {
12
+ super(doc, lang);
14
13
  }
15
14
  get tinyInfo() {
16
15
  return {
@@ -21,8 +21,8 @@ export default class Evento extends EventoPromoter<EventData> {
21
21
  get repertoryIds(): string[];
22
22
  get repertoryCount(): number;
23
23
  get activeInvitationLink(): boolean;
24
- get invitationLink(): string | null;
25
- get shortDynamicLink(): string | null;
24
+ get invitationLink(): string;
25
+ get shortDynamicLink(): string;
26
26
  get deletedAt(): FirebaseFirestore.Timestamp | null;
27
27
  get createdAt(): FirebaseFirestore.Timestamp;
28
28
  get createdOn(): import("./types").EventCreatedOn;
@@ -72,10 +72,11 @@ class Evento extends promoter_1.default {
72
72
  return this.data.activeInvitationLink || false;
73
73
  }
74
74
  get invitationLink() {
75
- return this.data.invitationLink;
75
+ return this.data.invitationLink || `https://glissandoo.com/joinevent/${this.id}`;
76
76
  }
77
77
  get shortDynamicLink() {
78
- return this.data.shortDynamicLink;
78
+ return (this.data.shortDynamicLink ||
79
+ `https://app.glissandoo.com/group/${this.promoterInfo.username}/events/${this.id}`);
79
80
  }
80
81
  get deletedAt() {
81
82
  return this.data.deletedAt;
@@ -1,10 +1,9 @@
1
1
  import { DocumentSnapshot } from '@google-cloud/firestore';
2
2
  import { LanguagesTypes } from '../../lang';
3
- import Model from '../Model';
3
+ import ModelWithLang from '../Model/lang';
4
4
  import { GroupBasicData, GroupTinyData } from './types';
5
- export default class GroupBasic<D> extends Model<D & GroupBasicData> {
6
- protected lang: LanguagesTypes;
7
- constructor(doc: DocumentSnapshot, lang: LanguagesTypes);
5
+ export default class GroupBasic<D> extends ModelWithLang<D & GroupBasicData> {
6
+ constructor(doc: DocumentSnapshot, lang?: LanguagesTypes);
8
7
  get tinyInfo(): GroupTinyData;
9
8
  get basicInfo(): GroupBasicData;
10
9
  get displayName(): string;
@@ -4,11 +4,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const lang_1 = require("../../lang");
7
- const Model_1 = __importDefault(require("../Model"));
8
- class GroupBasic extends Model_1.default {
9
- constructor(doc, lang) {
10
- super(doc);
11
- this.lang = lang;
7
+ const lang_2 = __importDefault(require("../Model/lang"));
8
+ class GroupBasic extends lang_2.default {
9
+ constructor(doc, lang = lang_1.defaultLocale) {
10
+ super(doc, lang);
12
11
  }
13
12
  get tinyInfo() {
14
13
  return {
@@ -13,9 +13,9 @@ export default class Group extends GroupBasic<GroupData> {
13
13
  get addresses(): import("./types").GroupAddressData[];
14
14
  get addressDefault(): import("./types").GroupAddressData | undefined;
15
15
  get activeInvitationLink(): boolean;
16
- get invitationLink(): string | null;
16
+ get invitationLink(): string;
17
17
  get invitationEmails(): string[];
18
- get shortDynamicLink(): string | null;
18
+ get shortDynamicLink(): string;
19
19
  get admins(): string[];
20
20
  get createdAt(): FirebaseFirestore.Timestamp;
21
21
  get deletedAt(): FirebaseFirestore.Timestamp | null;
@@ -6,8 +6,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const date_fns_1 = require("date-fns");
7
7
  const lodash_1 = require("lodash");
8
8
  const orders_1 = require("../../helpers/musicStyles/orders");
9
- const plans_1 = require("../../helpers/plans");
10
9
  const objects_1 = require("../../helpers/objects");
10
+ const plans_1 = require("../../helpers/plans");
11
11
  const lang_1 = require("../../lang");
12
12
  const basic_1 = __importDefault(require("./basic"));
13
13
  const types_1 = require("./types");
@@ -49,13 +49,13 @@ class Group extends basic_1.default {
49
49
  return this.data.activeInvitationLink || false;
50
50
  }
51
51
  get invitationLink() {
52
- return this.data.invitationLink;
52
+ return this.data.invitationLink || `https://glissandoo.com/joingroup/${this.id}`;
53
53
  }
54
54
  get invitationEmails() {
55
55
  return this.data.invitationEmails || [];
56
56
  }
57
57
  get shortDynamicLink() {
58
- return this.data.shortDynamicLink;
58
+ return this.data.shortDynamicLink || `https://app.glissandoo.com/group/${this.username}`;
59
59
  }
60
60
  get admins() {
61
61
  return this.data.administrators || [];
@@ -0,0 +1,10 @@
1
+ import * as firestore from '@google-cloud/firestore';
2
+ export default class Model<D> {
3
+ id: string;
4
+ ref: firestore.DocumentReference;
5
+ exists: boolean;
6
+ private _data;
7
+ constructor(doc: firestore.DocumentSnapshot);
8
+ get data(): D;
9
+ protected get(name: string): any;
10
+ }
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ class Model {
4
+ constructor(doc) {
5
+ this.id = doc.id;
6
+ this._data = doc.data();
7
+ this.ref = doc.ref;
8
+ this.exists = doc.exists;
9
+ }
10
+ get data() {
11
+ return this._data;
12
+ }
13
+ get(name) {
14
+ if (!this._data || !this._data[name]) {
15
+ return null;
16
+ }
17
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-return
18
+ return this._data[name];
19
+ }
20
+ }
21
+ exports.default = Model;
@@ -0,0 +1,8 @@
1
+ import { DocumentSnapshot } from '@google-cloud/firestore';
2
+ import { LanguagesTypes } from '../../lang';
3
+ import Model from '../Model';
4
+ export default class ModelWithLang<D> extends Model<D> {
5
+ protected lang: LanguagesTypes;
6
+ constructor(doc: DocumentSnapshot, lang?: LanguagesTypes);
7
+ set language(lang: LanguagesTypes);
8
+ }
@@ -0,0 +1,17 @@
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 lang_1 = require("../../lang");
7
+ const Model_1 = __importDefault(require("../Model"));
8
+ class ModelWithLang extends Model_1.default {
9
+ constructor(doc, lang = lang_1.defaultLocale) {
10
+ super(doc);
11
+ this.lang = lang;
12
+ }
13
+ set language(lang) {
14
+ this.lang = lang;
15
+ }
16
+ }
17
+ exports.default = ModelWithLang;
@@ -1,10 +1,9 @@
1
- import * as firestore from '@google-cloud/firestore';
1
+ import { DocumentSnapshot } from '@google-cloud/firestore';
2
2
  import { LanguagesTypes } from '../../lang';
3
- import Model from '../Model';
3
+ import ModelWithLang from '../Model/lang';
4
4
  import { UserBasicData, UserTinyData } from './types';
5
- export default class UserBasic<D> extends Model<D & UserBasicData> {
6
- protected lang: LanguagesTypes;
7
- constructor(doc: firestore.DocumentSnapshot, lang: LanguagesTypes);
5
+ export default class UserBasic<D> extends ModelWithLang<D & UserBasicData> {
6
+ constructor(doc: DocumentSnapshot, lang?: LanguagesTypes);
8
7
  get tinyInfo(): UserTinyData;
9
8
  get basicInfo(): UserBasicData;
10
9
  get displayName(): string;
@@ -3,11 +3,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- const Model_1 = __importDefault(require("../Model"));
7
- class UserBasic extends Model_1.default {
8
- constructor(doc, lang) {
9
- super(doc);
10
- this.lang = lang;
6
+ const lang_1 = require("../../lang");
7
+ const lang_2 = __importDefault(require("../Model/lang"));
8
+ class UserBasic extends lang_2.default {
9
+ constructor(doc, lang = lang_1.defaultLocale) {
10
+ super(doc, lang);
11
11
  }
12
12
  get tinyInfo() {
13
13
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glissandoo/lib",
3
- "version": "1.29.1",
3
+ "version": "1.30.0",
4
4
  "description": "Glissandoo library js",
5
5
  "main": "./index.js",
6
6
  "types": "./index.d.ts",