@glissandoo/lib 1.118.0 → 1.119.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.
Files changed (51) hide show
  1. package/functions/index.d.ts +2 -0
  2. package/functions/index.js +2 -0
  3. package/functions/partnershipPartner.d.ts +15 -1
  4. package/functions/partnershipSepaPaymentGroup.d.ts +4 -1
  5. package/functions/regions.js +2 -0
  6. package/helpers/errors.d.ts +3 -0
  7. package/helpers/errors.js +3 -0
  8. package/helpers/notifications/index.js +2 -0
  9. package/helpers/types.d.ts +1 -0
  10. package/helpers/types.js +13 -1
  11. package/models/Partnership/Communication/index.d.ts +13 -5
  12. package/models/Partnership/Communication/index.js +27 -20
  13. package/models/Partnership/Communication/supabase.d.ts +7 -0
  14. package/models/Partnership/Communication/supabase.js +24 -0
  15. package/models/Partnership/Communication/types.d.ts +5 -4
  16. package/models/Partnership/Group/index.d.ts +25 -7
  17. package/models/Partnership/Group/index.js +51 -13
  18. package/models/Partnership/Group/supabase.d.ts +13 -0
  19. package/models/Partnership/Group/supabase.js +25 -0
  20. package/models/Partnership/Group/types.d.ts +9 -3
  21. package/models/Partnership/Partner/index.d.ts +18 -7
  22. package/models/Partnership/Partner/index.js +47 -33
  23. package/models/Partnership/Partner/supabase.d.ts +7 -0
  24. package/models/Partnership/Partner/supabase.js +38 -0
  25. package/models/Partnership/Partner/types.d.ts +9 -8
  26. package/models/Partnership/Payment/index.d.ts +22 -5
  27. package/models/Partnership/Payment/index.js +44 -22
  28. package/models/Partnership/Payment/supabase.d.ts +15 -0
  29. package/models/Partnership/Payment/supabase.js +40 -0
  30. package/models/Partnership/Payment/types.d.ts +14 -6
  31. package/models/Partnership/Payment/types.js +1 -0
  32. package/models/Partnership/Plan/index.d.ts +14 -5
  33. package/models/Partnership/Plan/index.js +26 -18
  34. package/models/Partnership/Plan/supabase.d.ts +7 -0
  35. package/models/Partnership/Plan/supabase.js +22 -0
  36. package/models/Partnership/Plan/types.d.ts +5 -4
  37. package/models/Partnership/SepaPaymentGroup/index.d.ts +12 -4
  38. package/models/Partnership/SepaPaymentGroup/index.js +21 -14
  39. package/models/Partnership/SepaPaymentGroup/supabase.d.ts +7 -0
  40. package/models/Partnership/SepaPaymentGroup/supabase.js +18 -0
  41. package/models/Partnership/SepaPaymentGroup/types.d.ts +4 -3
  42. package/models/Partnership/Subscription/index.d.ts +15 -7
  43. package/models/Partnership/Subscription/index.js +27 -20
  44. package/models/Partnership/Subscription/supabase.d.ts +7 -0
  45. package/models/Partnership/Subscription/supabase.js +23 -0
  46. package/models/Partnership/Subscription/types.d.ts +7 -6
  47. package/models/Partnership/types.d.ts +5 -0
  48. package/package.json +1 -1
  49. package/types/supabase/generated.d.ts +487 -0
  50. package/types/supabase/generated.js +4 -0
  51. package/types/supabase/generated.ts +497 -0
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.rowToPartnershipPlanData = exports.PARTNERSHIP_PLAN_TABLE = void 0;
4
+ exports.PARTNERSHIP_PLAN_TABLE = 'partnership_plan';
5
+ function rowToPartnershipPlanData(row) {
6
+ return {
7
+ id: row.id,
8
+ partnershipId: row.partnershipId,
9
+ name: row.name,
10
+ description: row.description,
11
+ price: Number(row.price),
12
+ schedule: row.schedule,
13
+ subscriptionsCount: row.subscriptionsCount,
14
+ createdAt: row.createdAt,
15
+ createdBy: row.createdBy,
16
+ editedAt: row.editedBy ? row.updatedAt : null,
17
+ editedBy: row.editedBy,
18
+ deletedAt: row.deletedAt,
19
+ deletedBy: row.deletedBy,
20
+ };
21
+ }
22
+ exports.rowToPartnershipPlanData = rowToPartnershipPlanData;
@@ -1,4 +1,3 @@
1
- import { Timestamp } from '@google-cloud/firestore';
2
1
  export interface PlanScheduleType {
3
2
  periodInMonths: number;
4
3
  paymentDay: number;
@@ -10,12 +9,14 @@ export interface PartnershipPlanBasicData {
10
9
  schedule: PlanScheduleType;
11
10
  }
12
11
  export interface PartnershipPlanData extends PartnershipPlanBasicData {
12
+ id: string;
13
+ partnershipId: string;
13
14
  description: string;
14
15
  subscriptionsCount: number;
15
- createdAt: Timestamp;
16
+ createdAt: string;
16
17
  createdBy: string;
17
- editedAt: Timestamp | null;
18
+ editedAt: string | null;
18
19
  editedBy: string | null;
19
- deletedAt: Timestamp | null;
20
+ deletedAt: string | null;
20
21
  deletedBy: string | null;
21
22
  }
@@ -1,13 +1,21 @@
1
- import ModelWithLang from '../../Model/lang';
2
1
  import { PartnershipSepaPaymentGroupData } from './types';
3
- export default class PartnershipSepaPaymentGroup extends ModelWithLang<PartnershipSepaPaymentGroupData> {
2
+ /**
3
+ * Modelo plain-object para una fila de `partnership_sepa_payment_group`.
4
+ * Las fechas son ISO (string).
5
+ */
6
+ export default class PartnershipSepaPaymentGroup {
7
+ id: string;
8
+ exists: boolean;
9
+ private _data;
10
+ constructor(data: PartnershipSepaPaymentGroupData);
11
+ get data(): PartnershipSepaPaymentGroupData;
4
12
  get partnershipId(): string;
5
13
  get creditorInfo(): import("../types").PartnershipSepaCreditorInfo;
6
14
  get paymentsIds(): string[];
7
15
  get filePath(): string | null;
8
- get createdAt(): import("../../../types/firestore").Timestamp;
16
+ get createdAt(): string;
9
17
  get createdBy(): string;
10
- get editedAt(): import("../../../types/firestore").Timestamp | null;
18
+ get editedAt(): string | null;
11
19
  get editedBy(): string | null;
12
20
  get isActive(): boolean;
13
21
  }
@@ -1,34 +1,41 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
- const utils_1 = require("../../../helpers/utils");
7
- const lang_1 = __importDefault(require("../../Model/lang"));
8
- class PartnershipSepaPaymentGroup extends lang_1.default {
3
+ /**
4
+ * Modelo plain-object para una fila de `partnership_sepa_payment_group`.
5
+ * Las fechas son ISO (string).
6
+ */
7
+ class PartnershipSepaPaymentGroup {
8
+ constructor(data) {
9
+ this.id = data.id;
10
+ this._data = data;
11
+ this.exists = true;
12
+ }
13
+ get data() {
14
+ return this._data;
15
+ }
9
16
  get partnershipId() {
10
- return (0, utils_1.at)(this.ref.path.split('/'), 1) || '';
17
+ return this._data.partnershipId;
11
18
  }
12
19
  get creditorInfo() {
13
- return this.data.creditorInfo;
20
+ return this._data.creditorInfo;
14
21
  }
15
22
  get paymentsIds() {
16
- return this.data.paymentsIds || [];
23
+ return this._data.paymentsIds || [];
17
24
  }
18
25
  get filePath() {
19
- return this.data.filePath || null;
26
+ return this._data.filePath || null;
20
27
  }
21
28
  get createdAt() {
22
- return this.data.createdAt;
29
+ return this._data.createdAt;
23
30
  }
24
31
  get createdBy() {
25
- return this.data.createdBy;
32
+ return this._data.createdBy;
26
33
  }
27
34
  get editedAt() {
28
- return this.data.editedAt || null;
35
+ return this._data.editedAt || null;
29
36
  }
30
37
  get editedBy() {
31
- return this.data.editedBy || null;
38
+ return this._data.editedBy || null;
32
39
  }
33
40
  get isActive() {
34
41
  return this.exists;
@@ -0,0 +1,7 @@
1
+ import { Database } from '../../../types/supabase';
2
+ import { PartnershipSepaPaymentGroupData } from './types';
3
+ export type PartnershipSepaPaymentGroupRow = Database['public']['Tables']['partnership_sepa_payment_group']['Row'];
4
+ export type PartnershipSepaPaymentGroupInsert = Database['public']['Tables']['partnership_sepa_payment_group']['Insert'];
5
+ export type PartnershipSepaPaymentGroupUpdate = Database['public']['Tables']['partnership_sepa_payment_group']['Update'];
6
+ export declare const PARTNERSHIP_SEPA_PAYMENT_GROUP_TABLE: "partnership_sepa_payment_group";
7
+ export declare function rowToPartnershipSepaPaymentGroupData(row: PartnershipSepaPaymentGroupRow): PartnershipSepaPaymentGroupData;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.rowToPartnershipSepaPaymentGroupData = exports.PARTNERSHIP_SEPA_PAYMENT_GROUP_TABLE = void 0;
4
+ exports.PARTNERSHIP_SEPA_PAYMENT_GROUP_TABLE = 'partnership_sepa_payment_group';
5
+ function rowToPartnershipSepaPaymentGroupData(row) {
6
+ return {
7
+ id: row.id,
8
+ partnershipId: row.partnershipId,
9
+ creditorInfo: row.creditorInfo,
10
+ paymentsIds: row.paymentsIds ?? [],
11
+ filePath: row.filePath,
12
+ createdAt: row.createdAt,
13
+ createdBy: row.createdBy,
14
+ editedAt: row.editedBy ? row.updatedAt : null,
15
+ editedBy: row.editedBy,
16
+ };
17
+ }
18
+ exports.rowToPartnershipSepaPaymentGroupData = rowToPartnershipSepaPaymentGroupData;
@@ -1,11 +1,12 @@
1
- import { Timestamp } from '../../../types/firestore';
2
1
  import { PartnershipSepaCreditorInfo } from '../types';
3
2
  export interface PartnershipSepaPaymentGroupData {
3
+ id: string;
4
+ partnershipId: string;
4
5
  creditorInfo: PartnershipSepaCreditorInfo;
5
6
  paymentsIds: string[];
6
7
  filePath: string | null;
7
- createdAt: Timestamp;
8
+ createdAt: string;
8
9
  createdBy: string;
9
- editedAt: Timestamp | null;
10
+ editedAt: string | null;
10
11
  editedBy: string | null;
11
12
  }
@@ -1,19 +1,27 @@
1
- import Model from '../../Model';
2
1
  import { PartnershipSubscriptionData } from './types';
3
- export default class PartnershipSubscription extends Model<PartnershipSubscriptionData> {
2
+ /**
3
+ * Modelo plain-object para una fila de `partnership_subscription`. Las fechas
4
+ * son ISO (string); `isEnded` las parsea a `Date`.
5
+ */
6
+ export default class PartnershipSubscription {
7
+ id: string;
8
+ exists: boolean;
9
+ private _data;
10
+ constructor(data: PartnershipSubscriptionData);
11
+ get data(): PartnershipSubscriptionData;
4
12
  get partnershipId(): string;
5
13
  get planId(): string;
6
14
  get planInfo(): import("../Plan/types").PartnershipPlanBasicData;
7
15
  get partnerId(): string;
8
16
  get partnerInfo(): import("../../User/types").UserTinyData;
9
- get nextPaymentDate(): FirebaseFirestore.Timestamp | null;
10
- get endDate(): FirebaseFirestore.Timestamp | null;
17
+ get nextPaymentDate(): string | null;
18
+ get endDate(): string | null;
11
19
  get isEnded(): boolean;
12
- get createdAt(): FirebaseFirestore.Timestamp;
20
+ get createdAt(): string;
13
21
  get createdBy(): string;
14
- get editedAt(): FirebaseFirestore.Timestamp | null;
22
+ get editedAt(): string | null;
15
23
  get editedBy(): string | null;
16
- get deletedAt(): FirebaseFirestore.Timestamp | null;
24
+ get deletedAt(): string | null;
17
25
  get deletedBy(): string | null;
18
26
  get isDeleted(): boolean;
19
27
  get isActive(): boolean;
@@ -1,53 +1,60 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  const date_fns_1 = require("date-fns");
7
- const utils_1 = require("../../../helpers/utils");
8
- const Model_1 = __importDefault(require("../../Model"));
9
- class PartnershipSubscription extends Model_1.default {
4
+ /**
5
+ * Modelo plain-object para una fila de `partnership_subscription`. Las fechas
6
+ * son ISO (string); `isEnded` las parsea a `Date`.
7
+ */
8
+ class PartnershipSubscription {
9
+ constructor(data) {
10
+ this.id = data.id;
11
+ this._data = data;
12
+ this.exists = true;
13
+ }
14
+ get data() {
15
+ return this._data;
16
+ }
10
17
  get partnershipId() {
11
- return (0, utils_1.at)(this.ref.path.split('/'), 1) || '';
18
+ return this._data.partnershipId;
12
19
  }
13
20
  get planId() {
14
- return this.data.planId;
21
+ return this._data.planId;
15
22
  }
16
23
  get planInfo() {
17
- return this.data.planInfo;
24
+ return this._data.planInfo;
18
25
  }
19
26
  get partnerId() {
20
- return this.data.partnerId;
27
+ return this._data.partnerId;
21
28
  }
22
29
  get partnerInfo() {
23
- return this.data.partnerInfo;
30
+ return this._data.partnerInfo;
24
31
  }
25
32
  get nextPaymentDate() {
26
- return this.data.nextPaymentDate || null;
33
+ return this._data.nextPaymentDate || null;
27
34
  }
28
35
  get endDate() {
29
- return this.data.endDate || null;
36
+ return this._data.endDate || null;
30
37
  }
31
38
  get isEnded() {
32
- return this.endDate ? (0, date_fns_1.isPast)(this.endDate.toDate()) : false;
39
+ return this.endDate ? (0, date_fns_1.isPast)(new Date(this.endDate)) : false;
33
40
  }
34
41
  get createdAt() {
35
- return this.data.createdAt;
42
+ return this._data.createdAt;
36
43
  }
37
44
  get createdBy() {
38
- return this.data.createdBy;
45
+ return this._data.createdBy;
39
46
  }
40
47
  get editedAt() {
41
- return this.data.editedAt || null;
48
+ return this._data.editedAt || null;
42
49
  }
43
50
  get editedBy() {
44
- return this.data.editedBy || null;
51
+ return this._data.editedBy || null;
45
52
  }
46
53
  get deletedAt() {
47
- return this.data.deletedAt || null;
54
+ return this._data.deletedAt || null;
48
55
  }
49
56
  get deletedBy() {
50
- return this.data.deletedBy || null;
57
+ return this._data.deletedBy || null;
51
58
  }
52
59
  get isDeleted() {
53
60
  return this.deletedAt !== null;
@@ -0,0 +1,7 @@
1
+ import { Database } from '../../../types/supabase';
2
+ import { PartnershipSubscriptionData } from './types';
3
+ export type PartnershipSubscriptionRow = Database['public']['Tables']['partnership_subscription']['Row'];
4
+ export type PartnershipSubscriptionInsert = Database['public']['Tables']['partnership_subscription']['Insert'];
5
+ export type PartnershipSubscriptionUpdate = Database['public']['Tables']['partnership_subscription']['Update'];
6
+ export declare const PARTNERSHIP_SUBSCRIPTION_TABLE: "partnership_subscription";
7
+ export declare function rowToPartnershipSubscriptionData(row: PartnershipSubscriptionRow): PartnershipSubscriptionData;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.rowToPartnershipSubscriptionData = exports.PARTNERSHIP_SUBSCRIPTION_TABLE = void 0;
4
+ exports.PARTNERSHIP_SUBSCRIPTION_TABLE = 'partnership_subscription';
5
+ function rowToPartnershipSubscriptionData(row) {
6
+ return {
7
+ id: row.id,
8
+ partnershipId: row.partnershipId,
9
+ planId: row.planId,
10
+ partnerId: row.partnerId,
11
+ partnerInfo: row.partnerInfo,
12
+ planInfo: row.planInfo,
13
+ nextPaymentDate: row.nextPaymentDate,
14
+ endDate: row.endDate,
15
+ createdAt: row.createdAt,
16
+ createdBy: row.createdBy,
17
+ editedAt: row.editedBy ? row.updatedAt : null,
18
+ editedBy: row.editedBy,
19
+ deletedAt: row.deletedAt,
20
+ deletedBy: row.deletedBy,
21
+ };
22
+ }
23
+ exports.rowToPartnershipSubscriptionData = rowToPartnershipSubscriptionData;
@@ -1,17 +1,18 @@
1
- import { Timestamp } from '@google-cloud/firestore';
2
1
  import { UserTinyData } from '../../User/types';
3
2
  import { PartnershipPlanBasicData } from '../Plan/types';
4
3
  export interface PartnershipSubscriptionData {
4
+ id: string;
5
+ partnershipId: string;
5
6
  planId: string;
6
7
  partnerId: string;
7
8
  partnerInfo: UserTinyData;
8
9
  planInfo: PartnershipPlanBasicData;
9
- nextPaymentDate: Timestamp | null;
10
- endDate: Timestamp | null;
11
- createdAt: Timestamp;
10
+ nextPaymentDate: string | null;
11
+ endDate: string | null;
12
+ createdAt: string;
12
13
  createdBy: string;
13
- editedAt: Timestamp | null;
14
+ editedAt: string | null;
14
15
  editedBy: string | null;
15
- deletedAt: Timestamp | null;
16
+ deletedAt: string | null;
16
17
  deletedBy: string | null;
17
18
  }
@@ -31,10 +31,15 @@ export interface PartnershipTransferInfo {
31
31
  iban: string;
32
32
  holderName: string;
33
33
  }
34
+ export interface PartnershipBizumInfo {
35
+ phone: string;
36
+ instructions: string | null;
37
+ }
34
38
  export interface PartnershipPaymentMethodsConfig {
35
39
  sepa: boolean;
36
40
  transfer: PartnershipTransferInfo | null;
37
41
  cash: string | null;
42
+ bizum: PartnershipBizumInfo | null;
38
43
  }
39
44
  export interface PartnershipBasicData {
40
45
  displayName: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glissandoo/lib",
3
- "version": "1.118.0",
3
+ "version": "1.119.1",
4
4
  "description": "Glissandoo library js",
5
5
  "main": "./index.js",
6
6
  "types": "./index.d.ts",