easywork-common-lib 1.0.954 → 1.0.956
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/dist/entities/company.entity.d.ts +14 -0
- package/dist/entities/company.entity.js +118 -0
- package/dist/entities/company.entity.js.map +1 -0
- package/dist/entities/group.entity.d.ts +11 -5
- package/dist/entities/group.entity.js +22 -4
- package/dist/entities/group.entity.js.map +1 -1
- package/dist/entities/index.d.ts +40 -37
- package/dist/entities/index.js +3 -0
- package/dist/entities/index.js.map +1 -1
- package/dist/entities/subscriptions/payment-history.entity.d.ts +24 -0
- package/dist/entities/subscriptions/payment-history.entity.js +124 -0
- package/dist/entities/subscriptions/payment-history.entity.js.map +1 -0
- package/dist/entities/subscriptions/plan.entity.d.ts +19 -0
- package/dist/entities/subscriptions/plan.entity.js +104 -0
- package/dist/entities/subscriptions/plan.entity.js.map +1 -0
- package/dist/entities/subscriptions/subscription.entity.d.ts +27 -0
- package/dist/entities/subscriptions/subscription.entity.js +134 -0
- package/dist/entities/subscriptions/subscription.entity.js.map +1 -0
- package/package.json +1 -1
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.Subscription = exports.SubscriptionStatus = void 0;
|
|
13
|
+
const typeorm_1 = require("typeorm");
|
|
14
|
+
const swagger_1 = require("@nestjs/swagger");
|
|
15
|
+
const plan_entity_1 = require("./plan.entity");
|
|
16
|
+
const base_entity_1 = require("../../common/database/base.entity");
|
|
17
|
+
const group_entity_1 = require("../group.entity");
|
|
18
|
+
const payment_history_entity_1 = require("./payment-history.entity");
|
|
19
|
+
var SubscriptionStatus;
|
|
20
|
+
(function (SubscriptionStatus) {
|
|
21
|
+
SubscriptionStatus["ACTIVE"] = "active";
|
|
22
|
+
SubscriptionStatus["TRIALING"] = "trialing";
|
|
23
|
+
SubscriptionStatus["PAST_DUE"] = "past_due";
|
|
24
|
+
SubscriptionStatus["CANCELED"] = "canceled";
|
|
25
|
+
SubscriptionStatus["ENDED"] = "ended";
|
|
26
|
+
SubscriptionStatus["FREE"] = "free";
|
|
27
|
+
SubscriptionStatus["PENDING_PAYMENT"] = "pending_payment";
|
|
28
|
+
})(SubscriptionStatus || (exports.SubscriptionStatus = SubscriptionStatus = {}));
|
|
29
|
+
let Subscription = class Subscription extends base_entity_1.BaseEntityOnlyEssential {
|
|
30
|
+
groupId;
|
|
31
|
+
group;
|
|
32
|
+
planId;
|
|
33
|
+
plan;
|
|
34
|
+
subscriptionStatus;
|
|
35
|
+
currentPeriodStartsAt;
|
|
36
|
+
currentPeriodEndsAt;
|
|
37
|
+
trialEndsAt;
|
|
38
|
+
canceledAt;
|
|
39
|
+
accessEndsAt;
|
|
40
|
+
paymentGatewaySubscriptionId;
|
|
41
|
+
paymentHistory;
|
|
42
|
+
};
|
|
43
|
+
exports.Subscription = Subscription;
|
|
44
|
+
__decorate([
|
|
45
|
+
(0, typeorm_1.Column)({ type: 'int', nullable: false }),
|
|
46
|
+
(0, swagger_1.ApiProperty)({ description: 'ID del espacio de trabajo asociado', example: 101 }),
|
|
47
|
+
__metadata("design:type", Number)
|
|
48
|
+
], Subscription.prototype, "groupId", void 0);
|
|
49
|
+
__decorate([
|
|
50
|
+
(0, typeorm_1.ManyToOne)(() => group_entity_1.Group, group => group.subscription, { onDelete: 'CASCADE' }),
|
|
51
|
+
(0, typeorm_1.JoinColumn)({ name: 'group_id' }),
|
|
52
|
+
__metadata("design:type", group_entity_1.Group)
|
|
53
|
+
], Subscription.prototype, "group", void 0);
|
|
54
|
+
__decorate([
|
|
55
|
+
(0, typeorm_1.Column)({ type: 'int', nullable: false }),
|
|
56
|
+
(0, swagger_1.ApiProperty)({ description: 'ID del plan de suscripción asociado', example: 1 }),
|
|
57
|
+
__metadata("design:type", Number)
|
|
58
|
+
], Subscription.prototype, "planId", void 0);
|
|
59
|
+
__decorate([
|
|
60
|
+
(0, typeorm_1.ManyToOne)(() => plan_entity_1.Plan, plan => plan.subscription, { onDelete: 'RESTRICT' }),
|
|
61
|
+
(0, typeorm_1.JoinColumn)({ name: 'plan_id' }),
|
|
62
|
+
__metadata("design:type", plan_entity_1.Plan)
|
|
63
|
+
], Subscription.prototype, "plan", void 0);
|
|
64
|
+
__decorate([
|
|
65
|
+
(0, typeorm_1.Column)({ type: 'enum', enum: SubscriptionStatus, nullable: false }),
|
|
66
|
+
(0, swagger_1.ApiProperty)({
|
|
67
|
+
description: 'Estado actual de la suscripción',
|
|
68
|
+
enum: SubscriptionStatus,
|
|
69
|
+
example: SubscriptionStatus.ACTIVE,
|
|
70
|
+
}),
|
|
71
|
+
__metadata("design:type", String)
|
|
72
|
+
], Subscription.prototype, "subscriptionStatus", void 0);
|
|
73
|
+
__decorate([
|
|
74
|
+
(0, typeorm_1.Column)({ type: 'timestamptz', nullable: true }),
|
|
75
|
+
(0, swagger_1.ApiProperty)({
|
|
76
|
+
description: 'Fecha y hora de inicio del período de facturación actual',
|
|
77
|
+
example: '2024-06-01T00:00:00Z',
|
|
78
|
+
nullable: true,
|
|
79
|
+
}),
|
|
80
|
+
__metadata("design:type", Date)
|
|
81
|
+
], Subscription.prototype, "currentPeriodStartsAt", void 0);
|
|
82
|
+
__decorate([
|
|
83
|
+
(0, typeorm_1.Column)({ type: 'timestamptz', nullable: true }),
|
|
84
|
+
(0, swagger_1.ApiProperty)({
|
|
85
|
+
description: 'Fecha y hora de finalización del período de facturación actual',
|
|
86
|
+
example: '2024-06-30T23:59:59Z',
|
|
87
|
+
nullable: true,
|
|
88
|
+
}),
|
|
89
|
+
__metadata("design:type", Date)
|
|
90
|
+
], Subscription.prototype, "currentPeriodEndsAt", void 0);
|
|
91
|
+
__decorate([
|
|
92
|
+
(0, typeorm_1.Column)({ type: 'timestamptz', nullable: true }),
|
|
93
|
+
(0, swagger_1.ApiProperty)({
|
|
94
|
+
description: 'Fecha y hora de finalización del período de prueba (si aplica)',
|
|
95
|
+
example: '2024-06-15T00:00:00Z',
|
|
96
|
+
nullable: true,
|
|
97
|
+
}),
|
|
98
|
+
__metadata("design:type", Date)
|
|
99
|
+
], Subscription.prototype, "trialEndsAt", void 0);
|
|
100
|
+
__decorate([
|
|
101
|
+
(0, typeorm_1.Column)({ type: 'timestamptz', nullable: true }),
|
|
102
|
+
(0, swagger_1.ApiProperty)({
|
|
103
|
+
description: 'Fecha y hora en que se solicitó la cancelación',
|
|
104
|
+
example: '2024-06-20T14:00:00Z',
|
|
105
|
+
nullable: true,
|
|
106
|
+
}),
|
|
107
|
+
__metadata("design:type", Date)
|
|
108
|
+
], Subscription.prototype, "canceledAt", void 0);
|
|
109
|
+
__decorate([
|
|
110
|
+
(0, typeorm_1.Column)({ type: 'timestamptz', nullable: true }),
|
|
111
|
+
(0, swagger_1.ApiProperty)({
|
|
112
|
+
description: 'Fecha y hora en que el acceso terminará realmente',
|
|
113
|
+
example: '2024-06-30T23:59:59Z',
|
|
114
|
+
nullable: true,
|
|
115
|
+
}),
|
|
116
|
+
__metadata("design:type", Date)
|
|
117
|
+
], Subscription.prototype, "accessEndsAt", void 0);
|
|
118
|
+
__decorate([
|
|
119
|
+
(0, typeorm_1.Column)({ type: 'varchar', length: 255, nullable: true }),
|
|
120
|
+
(0, swagger_1.ApiProperty)({
|
|
121
|
+
description: 'ID de la suscripción en la pasarela de pago (ej. Stripe, PayPal)',
|
|
122
|
+
example: 'sub_xyz123abc',
|
|
123
|
+
nullable: true,
|
|
124
|
+
}),
|
|
125
|
+
__metadata("design:type", String)
|
|
126
|
+
], Subscription.prototype, "paymentGatewaySubscriptionId", void 0);
|
|
127
|
+
__decorate([
|
|
128
|
+
(0, typeorm_1.OneToMany)(() => payment_history_entity_1.PaymentHistory, paymentHistory => paymentHistory.subscription),
|
|
129
|
+
__metadata("design:type", payment_history_entity_1.PaymentHistory)
|
|
130
|
+
], Subscription.prototype, "paymentHistory", void 0);
|
|
131
|
+
exports.Subscription = Subscription = __decorate([
|
|
132
|
+
(0, typeorm_1.Entity)('subscriptions')
|
|
133
|
+
], Subscription);
|
|
134
|
+
//# sourceMappingURL=subscription.entity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subscription.entity.js","sourceRoot":"","sources":["../../../src/entities/subscriptions/subscription.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAA2E;AAC3E,6CAA8C;AAC9C,+CAAqC;AACrC,mEAA4E;AAC5E,kDAAwC;AACxC,qEAA0D;AAE1D,IAAY,kBAQX;AARD,WAAY,kBAAkB;IAC5B,uCAAiB,CAAA;IACjB,2CAAqB,CAAA;IACrB,2CAAqB,CAAA;IACrB,2CAAqB,CAAA;IACrB,qCAAe,CAAA;IACf,mCAAa,CAAA;IACb,yDAAmC,CAAA;AACrC,CAAC,EARW,kBAAkB,kCAAlB,kBAAkB,QAQ7B;AAGM,IAAM,YAAY,GAAlB,MAAM,YAAa,SAAQ,qCAAuB;IAGvD,OAAO,CAAS;IAIhB,KAAK,CAAQ;IAIb,MAAM,CAAS;IAIf,IAAI,CAAO;IAQX,kBAAkB,CAAqB;IAQvC,qBAAqB,CAAc;IAQnC,mBAA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