@glissandoo/lib 1.94.1 → 1.95.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.
@@ -1,4 +1,4 @@
1
- import { BasicAddressData } from '../models/Partnership/Partner/types';
1
+ import { BasicAddressData } from '../helpers/types';
2
2
  export declare namespace FederationPartnershipFbFunctionsTypes {
3
3
  interface AddParams {
4
4
  partnershipId: string;
@@ -1,4 +1,5 @@
1
- import { BasicAddressData, PartnerData } from '../models/Partnership/Partner/types';
1
+ import { PartnershipPartnerData } from '../models/Partnership/Partner/types';
2
+ import { BasicAddressData } from '../helpers/types';
2
3
  import PartnerSubscription from '../models/Partnership/Subscription';
3
4
  import { PartnershipData } from '../models/Partnership/types';
4
5
  export declare namespace PartnerFbFunctionsTypes {
@@ -37,7 +38,7 @@ export declare namespace PartnerFbFunctionsTypes {
37
38
  token: string;
38
39
  }
39
40
  interface GetByTokenResult {
40
- partner: Pick<PartnerData, 'name' | 'lastname' | 'email' | 'phone' | 'address'> & {
41
+ partner: Pick<PartnershipPartnerData, 'name' | 'lastname' | 'email' | 'phone' | 'address'> & {
41
42
  id: string;
42
43
  birthdate: number | null;
43
44
  };
@@ -1,4 +1,4 @@
1
- import { BasicAddressData } from '../models/Partnership/Partner/types';
1
+ import { BasicAddressData } from '../helpers/types';
2
2
  export declare namespace PartnershipFbFunctionsTypes {
3
3
  interface PublishParams {
4
4
  groupId: string;
@@ -1,5 +1,5 @@
1
1
  import { CreatedOn } from '../helpers/types';
2
- import { BasicAddressData } from '../models/Partnership/Partner/types';
2
+ import { BasicAddressData } from '../helpers/types';
3
3
  export declare namespace PartnershipPartnerFbFunctionsTypes {
4
4
  interface CreateParams {
5
5
  partnershipId: string;
@@ -10,26 +10,14 @@ export declare namespace PartnershipPartnerFbFunctionsTypes {
10
10
  phone: string | null;
11
11
  birthdate: number | null;
12
12
  address: BasicAddressData | null;
13
- identificator: string;
14
13
  createdOn: CreatedOn;
15
14
  }
16
15
  type CreateResult = void;
17
- interface EditParams {
18
- partnershipId: string;
19
- }
16
+ type EditParams = Omit<CreateParams, 'createdOn'>;
20
17
  type EditResult = void;
21
18
  interface RemoveParams {
22
19
  partnershipId: string;
20
+ partnerId: string;
23
21
  }
24
22
  type RemoveResult = void;
25
- interface AddConfirmedAdminParams {
26
- partnershipId: string;
27
- userId: string;
28
- }
29
- type AddConfirmedAdminResult = void;
30
- interface RemoveAdminParams {
31
- partnershipId: string;
32
- email: string;
33
- }
34
- type RemoveAdminResult = void;
35
23
  }
@@ -21,11 +21,11 @@ export declare enum CollectionNames {
21
21
  GroupStageTemplates = "stageTemplates",
22
22
  Metrics = "metrics",
23
23
  Partnership = "partnership",
24
- PartnershipPartners = "partners",
25
- PartnershipGroups = "groups",
26
- PartnershipSubscriptions = "subscriptions",
27
- PartnershipPayments = "payments",
28
- PartnershipPlans = "plans",
24
+ PartnershipPartners = "partnershipPartner",
25
+ PartnershipGroups = "partnershipGroup",
26
+ PartnershipSubscriptions = "partnershipSubscription",
27
+ PartnershipPayments = "partnershipPayment",
28
+ PartnershipPlans = "partnershipPlan",
29
29
  Federation = "federation",
30
30
  FederationPartnerships = "partnerships",
31
31
  Offer = "offer",
@@ -25,11 +25,11 @@ var CollectionNames;
25
25
  CollectionNames["GroupStageTemplates"] = "stageTemplates";
26
26
  CollectionNames["Metrics"] = "metrics";
27
27
  CollectionNames["Partnership"] = "partnership";
28
- CollectionNames["PartnershipPartners"] = "partners";
29
- CollectionNames["PartnershipGroups"] = "groups";
30
- CollectionNames["PartnershipSubscriptions"] = "subscriptions";
31
- CollectionNames["PartnershipPayments"] = "payments";
32
- CollectionNames["PartnershipPlans"] = "plans";
28
+ CollectionNames["PartnershipPartners"] = "partnershipPartner";
29
+ CollectionNames["PartnershipGroups"] = "partnershipGroup";
30
+ CollectionNames["PartnershipSubscriptions"] = "partnershipSubscription";
31
+ CollectionNames["PartnershipPayments"] = "partnershipPayment";
32
+ CollectionNames["PartnershipPlans"] = "partnershipPlan";
33
33
  CollectionNames["Federation"] = "federation";
34
34
  CollectionNames["FederationPartnerships"] = "partnerships";
35
35
  CollectionNames["Offer"] = "offer";
@@ -15,3 +15,10 @@ export declare enum CreatedOn {
15
15
  App = "app",
16
16
  Dashboard = "dashboard"
17
17
  }
18
+ export interface BasicAddressData {
19
+ street?: string;
20
+ city?: string;
21
+ postalCode?: string;
22
+ province?: string;
23
+ country?: string;
24
+ }
@@ -5,7 +5,7 @@ export default class CustomerBasic<D> extends Model<D & CustomerBasicData> {
5
5
  get basicInfo(): CustomerBasicData;
6
6
  get displayName(): string;
7
7
  get email(): string;
8
- get address(): import("../Partnership/Partner/types").BasicAddressData;
8
+ get address(): import("../../helpers/types").BasicAddressData;
9
9
  get displayAddress(): string;
10
10
  get phone(): string | null;
11
11
  get groupIds(): string[];
@@ -1,6 +1,6 @@
1
1
  import { DocumentReference, Timestamp } from '@google-cloud/firestore';
2
2
  import { AdminItem } from '../../helpers/types';
3
- import { BasicAddressData } from '../Partnership/Partner/types';
3
+ import { BasicAddressData } from '../../helpers/types';
4
4
  export declare enum CustomerRoles {
5
5
  Admin = "admin"
6
6
  }
@@ -13,7 +13,7 @@ export default class Federation extends Model<FederationData> {
13
13
  get photoURL(): string;
14
14
  get phone(): string | null;
15
15
  get web(): string | null;
16
- get address(): import("../Partnership/Partner/types").BasicAddressData | null;
16
+ get address(): import("../../helpers/types").BasicAddressData | null;
17
17
  get displayAddress(): string;
18
18
  get partnershipConnectedIds(): string[];
19
19
  get createdAt(): FirebaseFirestore.Timestamp;
@@ -1,6 +1,6 @@
1
1
  import { DocumentReference, Timestamp } from '@google-cloud/firestore';
2
2
  import { AdminItem } from '../../helpers/types';
3
- import { BasicAddressData } from '../Partnership/Partner/types';
3
+ import { BasicAddressData } from '../../helpers/types';
4
4
  export interface FederationData {
5
5
  displayName: string;
6
6
  photoURL: string;
@@ -1,11 +1,11 @@
1
1
  import { DocumentModel } from '../../Model';
2
- import PartnerTiny from './tiny';
3
- import { PartnerBasicData } from './types';
4
- export default class PartnerBasic<D> extends PartnerTiny<D & PartnerBasicData> {
2
+ import PartnershipPartnerTiny from './tiny';
3
+ import { PartnershipPartnerBasicData } from './types';
4
+ export default class PartnershipPartnerBasic<D> extends PartnershipPartnerTiny<D & PartnershipPartnerBasicData> {
5
5
  constructor(doc: DocumentModel);
6
- get basicInfo(): PartnerBasicData;
6
+ get basicInfo(): PartnershipPartnerBasicData;
7
7
  get createdAt(): FirebaseFirestore.Timestamp;
8
- get createdBy(): string;
8
+ get createdBy(): import("../../../types/firestore").DocumentReference<import("../../../types/firestore").DocumentData>;
9
9
  get deletedAt(): FirebaseFirestore.Timestamp | null;
10
10
  get deletedBy(): string | null;
11
11
  get isDeleted(): boolean;
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const tiny_1 = __importDefault(require("./tiny"));
7
- class PartnerBasic extends tiny_1.default {
7
+ class PartnershipPartnerBasic extends tiny_1.default {
8
8
  constructor(doc) {
9
9
  super(doc);
10
10
  }
@@ -36,4 +36,4 @@ class PartnerBasic extends tiny_1.default {
36
36
  return this.exists && !this.isDeleted;
37
37
  }
38
38
  }
39
- exports.default = PartnerBasic;
39
+ exports.default = PartnershipPartnerBasic;
@@ -1,15 +1,19 @@
1
- import { DocumentModel } from '../../Model';
2
- import PartnerBasic from './basic';
3
- import { PartnerData } from './types';
4
- export default class Partner extends PartnerBasic<PartnerData> {
5
- constructor(doc: DocumentModel);
6
- get identificator(): string;
1
+ import PartnershipPartnerBasic from './basic';
2
+ import { PartnershipPartnerData } from './types';
3
+ export default class PartnershipPartner extends PartnershipPartnerBasic<PartnershipPartnerData> {
7
4
  get name(): string;
8
5
  get lastname(): string;
9
6
  get email(): string;
10
7
  get phone(): string | null;
11
8
  get birthdate(): FirebaseFirestore.Timestamp | null;
12
9
  get partnershipId(): string;
13
- get address(): import("./types").BasicAddressData | null;
10
+ get address(): import("../../../helpers/types").BasicAddressData | null;
11
+ get iban(): string | null;
14
12
  get displayAddress(): string | null;
13
+ get createdAt(): FirebaseFirestore.Timestamp;
14
+ get createdBy(): import("../../../types/firestore").DocumentReference<import("../../../types/firestore").DocumentData>;
15
+ get deletedAt(): FirebaseFirestore.Timestamp | null;
16
+ get deletedBy(): string | null;
17
+ get isDeleted(): boolean;
18
+ get isActive(): boolean;
15
19
  }
@@ -4,14 +4,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const isString_1 = __importDefault(require("lodash/isString"));
7
+ const utils_1 = require("../../../helpers/utils");
7
8
  const basic_1 = __importDefault(require("./basic"));
8
- class Partner extends basic_1.default {
9
- constructor(doc) {
10
- super(doc);
11
- }
12
- get identificator() {
13
- return this.data.identificator;
14
- }
9
+ class PartnershipPartner extends basic_1.default {
15
10
  get name() {
16
11
  return this.data.name;
17
12
  }
@@ -28,11 +23,14 @@ class Partner extends basic_1.default {
28
23
  return this.data.birthdate;
29
24
  }
30
25
  get partnershipId() {
31
- return this.data.partnershipId;
26
+ return (0, utils_1.at)(this.ref.path.split('/'), 1) || '';
32
27
  }
33
28
  get address() {
34
29
  return this.data.address;
35
30
  }
31
+ get iban() {
32
+ return this.data.iban;
33
+ }
36
34
  get displayAddress() {
37
35
  if (!this.address)
38
36
  return null;
@@ -40,5 +38,23 @@ class Partner extends basic_1.default {
40
38
  const fields = [street, postalCode, city, province, country];
41
39
  return fields.filter((field) => (0, isString_1.default)(field)).join(', ');
42
40
  }
41
+ get createdAt() {
42
+ return this.data.createdAt;
43
+ }
44
+ get createdBy() {
45
+ return this.data.createdBy;
46
+ }
47
+ get deletedAt() {
48
+ return this.data.deletedAt || null;
49
+ }
50
+ get deletedBy() {
51
+ return this.data.deletedBy || null;
52
+ }
53
+ get isDeleted() {
54
+ return this.deletedAt !== null;
55
+ }
56
+ get isActive() {
57
+ return this.exists && !this.isDeleted;
58
+ }
43
59
  }
44
- exports.default = Partner;
60
+ exports.default = PartnershipPartner;
@@ -1,8 +1,7 @@
1
- import Model, { DocumentModel } from '../../Model';
2
- import { PartnerTinyData } from './types';
3
- export default class PartnerTiny<D> extends Model<D & PartnerTinyData> {
4
- constructor(doc: DocumentModel);
5
- get tinyInfo(): PartnerTinyData;
1
+ import Model from '../../Model';
2
+ import { PartnershipPartnerTinyData } from './types';
3
+ export default class PartnershipPartnerTiny<D> extends Model<D & PartnershipPartnerTinyData> {
4
+ get tinyInfo(): PartnershipPartnerTinyData;
6
5
  get photoURL(): string | null;
7
6
  get displayName(): string;
8
7
  }
@@ -4,10 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const Model_1 = __importDefault(require("../../Model"));
7
- class PartnerTiny extends Model_1.default {
8
- constructor(doc) {
9
- super(doc);
10
- }
7
+ class PartnershipPartnerTiny extends Model_1.default {
11
8
  get tinyInfo() {
12
9
  return {
13
10
  displayName: this.displayName,
@@ -21,4 +18,4 @@ class PartnerTiny extends Model_1.default {
21
18
  return this.data.displayName;
22
19
  }
23
20
  }
24
- exports.default = PartnerTiny;
21
+ exports.default = PartnershipPartnerTiny;
@@ -1,29 +1,23 @@
1
1
  import { Timestamp } from '@google-cloud/firestore';
2
- export interface BasicAddressData {
3
- street?: string;
4
- city?: string;
5
- postalCode?: string;
6
- province?: string;
7
- country?: string;
8
- }
9
- export interface PartnerTinyData {
2
+ import { BasicAddressData } from '../../../helpers/types';
3
+ import { DocumentReference } from '../../../types/firestore';
4
+ export interface PartnershipPartnerTinyData {
10
5
  photoURL: string | null;
11
6
  displayName: string;
12
7
  }
13
- export interface PartnerBasicData extends PartnerTinyData {
8
+ export interface PartnershipPartnerBasicData extends PartnershipPartnerTinyData {
14
9
  readonly createdAt: Timestamp;
15
- readonly createdBy: string;
10
+ readonly createdBy: DocumentReference;
16
11
  deletedAt: Timestamp | null;
17
12
  deletedBy: string | null;
18
13
  }
19
- export interface PartnerData extends PartnerBasicData {
20
- identificator: string;
14
+ export interface PartnershipPartnerData extends PartnershipPartnerBasicData {
21
15
  name: string;
22
16
  lastname: string;
23
17
  email: string;
24
18
  address: BasicAddressData | null;
25
19
  phone: string | null;
26
20
  birthdate: Timestamp | null;
21
+ iban: string | null;
27
22
  groupIds: string[];
28
- readonly partnershipId: string;
29
23
  }
@@ -3,7 +3,7 @@ import PartnershipPlanBasic from '../Plan/basic';
3
3
  import { SubscriptionData, SubscriptionStatus } from './types';
4
4
  export default class PartnerSubscription extends PartnershipPlanBasic<SubscriptionData> {
5
5
  constructor(doc: DocumentModel);
6
- get planRef(): FirebaseFirestore.DocumentReference<FirebaseFirestore.DocumentData, FirebaseFirestore.DocumentData>;
6
+ get planId(): string;
7
7
  get partnerId(): string;
8
8
  get partnershipId(): string;
9
9
  get status(): SubscriptionStatus;
@@ -11,8 +11,8 @@ class PartnerSubscription extends basic_1.default {
11
11
  constructor(doc) {
12
12
  super(doc);
13
13
  }
14
- get planRef() {
15
- return this.data.planRef;
14
+ get planId() {
15
+ return this.data.planId;
16
16
  }
17
17
  get partnerId() {
18
18
  return (0, utils_1.at)(this.ref.path.split('/'), 3) || '';
@@ -15,7 +15,7 @@ export interface SubscriptionData extends PartnershipPlanBasicData {
15
15
  paymentDate: Timestamp;
16
16
  status: SubscriptionStatus;
17
17
  lastPayment: LastPaymentType | null;
18
- readonly planRef: DocumentReference;
19
- readonly createdBy: DocumentReference;
20
- readonly createdAt: Timestamp;
18
+ planId: string;
19
+ createdBy: DocumentReference;
20
+ createdAt: Timestamp;
21
21
  }
@@ -2,11 +2,11 @@ import Model, { DocumentModel } from '../Model';
2
2
  import { PartnershipBasicData } from './types';
3
3
  export default class PartnershipBasic<D> extends Model<D & PartnershipBasicData> {
4
4
  constructor(doc: DocumentModel);
5
- get basicInfo(): PartnershipBasicData;
6
5
  get displayName(): string;
7
6
  get photoURL(): string;
8
7
  get email(): string;
9
- get address(): import("./Partner/types").BasicAddressData;
8
+ get website(): string | null;
9
+ get address(): import("../../helpers/types").BasicAddressData;
10
10
  get displayAddress(): string;
11
11
  get phone(): string | null;
12
12
  get groupIds(): string[];
@@ -9,19 +9,6 @@ class PartnershipBasic extends Model_1.default {
9
9
  constructor(doc) {
10
10
  super(doc);
11
11
  }
12
- get basicInfo() {
13
- return {
14
- displayName: this.displayName,
15
- photoURL: this.photoURL,
16
- email: this.email,
17
- phone: this.phone,
18
- address: this.address,
19
- CIF: this.CIF,
20
- groupIds: this.groupIds,
21
- partnerCount: this.partnerCount,
22
- memberCount: this.memberCount,
23
- };
24
- }
25
12
  get displayName() {
26
13
  return this.data.displayName;
27
14
  }
@@ -31,6 +18,9 @@ class PartnershipBasic extends Model_1.default {
31
18
  get email() {
32
19
  return this.data.email;
33
20
  }
21
+ get website() {
22
+ return this.data.website || null;
23
+ }
34
24
  get address() {
35
25
  return this.data.address || {};
36
26
  }
@@ -1,6 +1,6 @@
1
1
  import { DocumentReference, Timestamp } from '@google-cloud/firestore';
2
2
  import { AdminItem } from '../../helpers/types';
3
- import { BasicAddressData } from './Partner/types';
3
+ import { BasicAddressData } from '../../helpers/types';
4
4
  export declare enum PartnershipRoles {
5
5
  Admin = "admin"
6
6
  }
@@ -12,6 +12,7 @@ export interface PartnershipBasicData {
12
12
  photoURL: string;
13
13
  email: string;
14
14
  phone: string | null;
15
+ website: string | null;
15
16
  address: BasicAddressData;
16
17
  CIF: string | null;
17
18
  groupIds: string[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glissandoo/lib",
3
- "version": "1.94.1",
3
+ "version": "1.95.0",
4
4
  "description": "Glissandoo library js",
5
5
  "main": "./index.js",
6
6
  "types": "./index.d.ts",