@glissandoo/lib 1.98.0 → 1.100.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/functions/partnershipPlan.d.ts +10 -8
- package/functions/partnershipSubscription.d.ts +23 -0
- package/functions/partnershipSubscription.js +2 -0
- package/helpers/errors.d.ts +1 -0
- package/helpers/errors.js +1 -0
- package/models/Partnership/Plan/index.d.ts +3 -1
- package/models/Partnership/Plan/index.js +9 -3
- package/models/Partnership/Plan/types.d.ts +1 -0
- package/models/Partnership/Subscription/index.d.ts +4 -3
- package/models/Partnership/Subscription/index.js +7 -4
- package/models/Partnership/Subscription/types.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1,18 +1,20 @@
|
|
|
1
|
-
import { PlanScheduleType } from '../models/Partnership/Plan/types';
|
|
1
|
+
import { PaymentMethod, PlanScheduleType } from '../models/Partnership/Plan/types';
|
|
2
2
|
export declare namespace PartnershipPlanFbFunctionsTypes {
|
|
3
|
-
interface
|
|
4
|
-
partnershipId: string;
|
|
3
|
+
interface CreateData {
|
|
5
4
|
name: string;
|
|
6
|
-
price: number;
|
|
7
5
|
description: string;
|
|
6
|
+
price: number;
|
|
8
7
|
schedule: PlanScheduleType;
|
|
8
|
+
paymentMethod: PaymentMethod;
|
|
9
9
|
}
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
interface CreateParams extends CreateData {
|
|
11
|
+
partnershipId: string;
|
|
12
|
+
planId: string;
|
|
13
|
+
}
|
|
14
|
+
type CreateResult = void;
|
|
15
|
+
interface EditParams extends Partial<CreateData> {
|
|
12
16
|
partnershipId: string;
|
|
13
17
|
planId: string;
|
|
14
|
-
name: string;
|
|
15
|
-
description: string;
|
|
16
18
|
}
|
|
17
19
|
type EditResult = void;
|
|
18
20
|
type RemoveParams = {
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export declare namespace PartnershipSubscriptionFbFunctionsTypes {
|
|
2
|
+
interface CreateData {
|
|
3
|
+
planId: string;
|
|
4
|
+
partnerId: string;
|
|
5
|
+
endDate: number | null;
|
|
6
|
+
}
|
|
7
|
+
interface CreateParams extends CreateData {
|
|
8
|
+
partnershipId: string;
|
|
9
|
+
subscriptionId: string;
|
|
10
|
+
}
|
|
11
|
+
type CreateResult = void;
|
|
12
|
+
interface EditParams {
|
|
13
|
+
partnershipId: string;
|
|
14
|
+
subscriptionId: string;
|
|
15
|
+
endDate: number | null;
|
|
16
|
+
}
|
|
17
|
+
type EditResult = void;
|
|
18
|
+
type RemoveParams = {
|
|
19
|
+
partnershipId: string;
|
|
20
|
+
subscriptionId: string;
|
|
21
|
+
};
|
|
22
|
+
type RemoveResult = void;
|
|
23
|
+
}
|
package/helpers/errors.d.ts
CHANGED
|
@@ -24,6 +24,7 @@ export declare enum HttpsErrorMessages {
|
|
|
24
24
|
InvalidOffer = "error.offer.noValid",
|
|
25
25
|
InvalidPartnership = "error.partnership.noValid",
|
|
26
26
|
InvalidPartnershipPartner = "error.partner.noValid",
|
|
27
|
+
PartnershipPartnerNotSelf = "error.partner.notSelf",
|
|
27
28
|
InvalidPartnershipPlan = "error.partnershipPlan.noValid",
|
|
28
29
|
PartnershipPlanWithSubscriptions = "error.partnershipPlan.withSubscriptions",
|
|
29
30
|
InvalidPartnershipSubscription = "error.partnershipSubscription.noValid",
|
package/helpers/errors.js
CHANGED
|
@@ -25,6 +25,7 @@ var HttpsErrorMessages;
|
|
|
25
25
|
HttpsErrorMessages["InvalidOffer"] = "error.offer.noValid";
|
|
26
26
|
HttpsErrorMessages["InvalidPartnership"] = "error.partnership.noValid";
|
|
27
27
|
HttpsErrorMessages["InvalidPartnershipPartner"] = "error.partner.noValid";
|
|
28
|
+
HttpsErrorMessages["PartnershipPartnerNotSelf"] = "error.partner.notSelf";
|
|
28
29
|
HttpsErrorMessages["InvalidPartnershipPlan"] = "error.partnershipPlan.noValid";
|
|
29
30
|
HttpsErrorMessages["PartnershipPlanWithSubscriptions"] = "error.partnershipPlan.withSubscriptions";
|
|
30
31
|
HttpsErrorMessages["InvalidPartnershipSubscription"] = "error.partnershipSubscription.noValid";
|
|
@@ -12,9 +12,11 @@ export default class PartnershipPlan extends ModelWithLang<PartnershipPlanData>
|
|
|
12
12
|
get price(): number;
|
|
13
13
|
get displayPrice(): string;
|
|
14
14
|
get schedule(): import("./types").PlanScheduleType;
|
|
15
|
-
get paymentMethod(): import("./types").PaymentMethod;
|
|
16
15
|
get isAnnuallySchedule(): boolean;
|
|
17
16
|
get isPaymentDayEndOfMonth(): boolean;
|
|
17
|
+
get paymentMethod(): import("./types").PaymentMethod;
|
|
18
|
+
get subscriptionsCount(): number;
|
|
19
|
+
get hasSubscriptions(): boolean;
|
|
18
20
|
get createdAt(): FirebaseFirestore.Timestamp;
|
|
19
21
|
get createdBy(): string;
|
|
20
22
|
get editedAt(): FirebaseFirestore.Timestamp | null;
|
|
@@ -47,15 +47,21 @@ class PartnershipPlan extends lang_1.default {
|
|
|
47
47
|
get schedule() {
|
|
48
48
|
return this.data.schedule;
|
|
49
49
|
}
|
|
50
|
-
get paymentMethod() {
|
|
51
|
-
return this.data.paymentMethod;
|
|
52
|
-
}
|
|
53
50
|
get isAnnuallySchedule() {
|
|
54
51
|
return this.schedule.periodInMonths === 12;
|
|
55
52
|
}
|
|
56
53
|
get isPaymentDayEndOfMonth() {
|
|
57
54
|
return this.schedule.paymentDay === -1;
|
|
58
55
|
}
|
|
56
|
+
get paymentMethod() {
|
|
57
|
+
return this.data.paymentMethod;
|
|
58
|
+
}
|
|
59
|
+
get subscriptionsCount() {
|
|
60
|
+
return this.data.subscriptionsCount || 0;
|
|
61
|
+
}
|
|
62
|
+
get hasSubscriptions() {
|
|
63
|
+
return this.subscriptionsCount > 0;
|
|
64
|
+
}
|
|
59
65
|
get createdAt() {
|
|
60
66
|
return this.data.createdAt;
|
|
61
67
|
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import Model from '../../Model';
|
|
2
|
-
import {
|
|
3
|
-
export default class
|
|
2
|
+
import { PartnershipSubscriptionData } from './types';
|
|
3
|
+
export default class PartnershipSubscription extends Model<PartnershipSubscriptionData> {
|
|
4
|
+
get partnershipId(): string;
|
|
4
5
|
get planId(): string;
|
|
5
6
|
get partnerId(): string;
|
|
6
|
-
get
|
|
7
|
+
get endDate(): FirebaseFirestore.Timestamp | null;
|
|
7
8
|
get createdAt(): FirebaseFirestore.Timestamp;
|
|
8
9
|
get createdBy(): string;
|
|
9
10
|
get editedAt(): FirebaseFirestore.Timestamp | null;
|
|
@@ -5,15 +5,18 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const utils_1 = require("../../../helpers/utils");
|
|
7
7
|
const Model_1 = __importDefault(require("../../Model"));
|
|
8
|
-
class
|
|
8
|
+
class PartnershipSubscription extends Model_1.default {
|
|
9
|
+
get partnershipId() {
|
|
10
|
+
return (0, utils_1.at)(this.ref.path.split('/'), 1) || '';
|
|
11
|
+
}
|
|
9
12
|
get planId() {
|
|
10
13
|
return this.data.planId;
|
|
11
14
|
}
|
|
12
15
|
get partnerId() {
|
|
13
16
|
return this.data.partnerId;
|
|
14
17
|
}
|
|
15
|
-
get
|
|
16
|
-
return
|
|
18
|
+
get endDate() {
|
|
19
|
+
return this.data.endDate || null;
|
|
17
20
|
}
|
|
18
21
|
get createdAt() {
|
|
19
22
|
return this.data.createdAt;
|
|
@@ -40,4 +43,4 @@ class PartnerSubscription extends Model_1.default {
|
|
|
40
43
|
return this.exists && !this.data.deletedAt;
|
|
41
44
|
}
|
|
42
45
|
}
|
|
43
|
-
exports.default =
|
|
46
|
+
exports.default = PartnershipSubscription;
|