@asumano/worklip-typeorm-db 1.1.47 → 1.1.49
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/BillingInvoice.js +4 -0
- package/dist/entities/BillingUsageSnapshot.d.ts +1 -1
- package/dist/entities/BillingUsageSnapshot.js +5 -2
- package/dist/entities/Company.d.ts +2 -1
- package/dist/entities/Company.js +4 -0
- package/dist/entities/CompanySubscription.js +6 -2
- package/dist/entities/PaymentTransaction.d.ts +1 -0
- package/dist/entities/PaymentTransaction.js +10 -0
- package/dist/entities/SubscriptionAddonTemplate.d.ts +1 -1
- package/dist/entities/SubscriptionAddonTemplate.js +1 -1
- package/dist/entities/SubscriptionPlan.d.ts +1 -0
- package/dist/entities/SubscriptionPlan.js +10 -0
- package/dist/entities/UsageAlert.d.ts +3 -1
- package/dist/entities/UsageAlert.js +20 -1
- package/package.json +1 -1
|
@@ -184,4 +184,8 @@ exports.BillingInvoice = BillingInvoice = __decorate([
|
|
|
184
184
|
}),
|
|
185
185
|
(0, typeorm_1.Index)("UQ_billing_invoice_number", ["invoice_number"], { unique: true }),
|
|
186
186
|
(0, typeorm_1.Index)("UQ_billing_invoice_period", ["company_subscription", "period_year", "period_month"], { unique: true })
|
|
187
|
+
// DOC: El webhook de Wompi concilia la factura por payment_reference; indexarlo
|
|
188
|
+
// evita full scan en cada evento.
|
|
189
|
+
,
|
|
190
|
+
(0, typeorm_1.Index)("IDX_billing_invoice_payment_reference", ["payment_reference"])
|
|
187
191
|
], BillingInvoice);
|
|
@@ -48,8 +48,11 @@ __decorate([
|
|
|
48
48
|
(0, typeorm_1.Column)({
|
|
49
49
|
type: "bigint",
|
|
50
50
|
comment: "Cuánto fue el consumo de almacenamiento (media_file) de la empresa para el mes y año.",
|
|
51
|
-
})
|
|
52
|
-
|
|
51
|
+
})
|
|
52
|
+
// DOC: MySQL/mysql2 devuelve BIGINT como string (evita pérdida de precisión con
|
|
53
|
+
// números > 2^53). Se tipa string; usar Number()/bytesToGb al consumirlo.
|
|
54
|
+
,
|
|
55
|
+
__metadata("design:type", String)
|
|
53
56
|
], BillingUsageSnapshot.prototype, "storage_bytes", void 0);
|
|
54
57
|
__decorate([
|
|
55
58
|
(0, typeorm_1.Column)({
|
|
@@ -2,7 +2,7 @@ import { Vehicle } from "./Vehicle";
|
|
|
2
2
|
import { Client } from "./Client";
|
|
3
3
|
import { Associate } from "./Associate";
|
|
4
4
|
import { Workshop } from "./Workshop";
|
|
5
|
-
import { BillingInvoice, BillingUsageSnapshot, CompanyBrand, Country, EmailLog, MediaFile, PaymentMethod, UsageAlert, WhatsappLog } from "..";
|
|
5
|
+
import { BillingInvoice, BillingUsageSnapshot, CompanyBrand, CompanySubscription, Country, EmailLog, MediaFile, PaymentMethod, UsageAlert, WhatsappLog } from "..";
|
|
6
6
|
export declare class Company {
|
|
7
7
|
id: number;
|
|
8
8
|
country: Country;
|
|
@@ -22,4 +22,5 @@ export declare class Company {
|
|
|
22
22
|
email_logs: EmailLog[];
|
|
23
23
|
billing_invoices: BillingInvoice[];
|
|
24
24
|
usage_alerts: UsageAlert[];
|
|
25
|
+
company_subscriptions: CompanySubscription[];
|
|
25
26
|
}
|
package/dist/entities/Company.js
CHANGED
|
@@ -113,6 +113,10 @@ __decorate([
|
|
|
113
113
|
(0, typeorm_1.OneToMany)(() => __1.UsageAlert, (usageAlert) => usageAlert.company),
|
|
114
114
|
__metadata("design:type", Array)
|
|
115
115
|
], Company.prototype, "usage_alerts", void 0);
|
|
116
|
+
__decorate([
|
|
117
|
+
(0, typeorm_1.OneToMany)(() => __1.CompanySubscription, (companySubscription) => companySubscription.company),
|
|
118
|
+
__metadata("design:type", Array)
|
|
119
|
+
], Company.prototype, "company_subscriptions", void 0);
|
|
116
120
|
exports.Company = Company = __decorate([
|
|
117
121
|
(0, typeorm_1.Entity)({ comment: "Empresas registradas en la plataforma." })
|
|
118
122
|
], Company);
|
|
@@ -26,7 +26,7 @@ __decorate([
|
|
|
26
26
|
__metadata("design:type", Number)
|
|
27
27
|
], CompanySubscription.prototype, "id", void 0);
|
|
28
28
|
__decorate([
|
|
29
|
-
(0, typeorm_1.ManyToOne)(() => Company_1.Company, (company) => company.
|
|
29
|
+
(0, typeorm_1.ManyToOne)(() => Company_1.Company, (company) => company.company_subscriptions, {
|
|
30
30
|
onDelete: "CASCADE",
|
|
31
31
|
onUpdate: "NO ACTION",
|
|
32
32
|
}),
|
|
@@ -99,7 +99,7 @@ __decorate([
|
|
|
99
99
|
default: 1,
|
|
100
100
|
type: "int",
|
|
101
101
|
width: 1,
|
|
102
|
-
comment: "Estado del plan de la empresa:\r\n1: Activo.\r\n2: Suspendido.\r\n3: Cancelado.\r\n4: Expirado.\r\n5: Trial ().\r\n6: Pendiente de pago (elegido pero aún sin pagar la primera factura).",
|
|
102
|
+
comment: "Estado del plan de la empresa:\r\n1: Activo.\r\n2: Suspendido.\r\n3: Cancelado.\r\n4: Expirado.\r\n5: Trial (período de prueba).\r\n6: Pendiente de pago (elegido pero aún sin pagar la primera factura).",
|
|
103
103
|
}),
|
|
104
104
|
__metadata("design:type", Number)
|
|
105
105
|
], CompanySubscription.prototype, "status", void 0);
|
|
@@ -132,4 +132,8 @@ __decorate([
|
|
|
132
132
|
exports.CompanySubscription = CompanySubscription = __decorate([
|
|
133
133
|
(0, typeorm_1.Entity)({ comment: "Plan de la empresa.", name: "company_subscription" }),
|
|
134
134
|
(0, typeorm_1.Index)("IDX_company_subscription_company", ["company"])
|
|
135
|
+
// DOC: El job mensual busca las suscripciones a cobrar por billing_day + status;
|
|
136
|
+
// indexarlo evita recorrer toda la tabla cada día.
|
|
137
|
+
,
|
|
138
|
+
(0, typeorm_1.Index)("IDX_company_subscription_billing", ["billing_day", "status"])
|
|
135
139
|
], CompanySubscription);
|
|
@@ -110,6 +110,16 @@ __decorate([
|
|
|
110
110
|
}),
|
|
111
111
|
__metadata("design:type", Date)
|
|
112
112
|
], PaymentTransaction.prototype, "created", void 0);
|
|
113
|
+
__decorate([
|
|
114
|
+
(0, typeorm_1.Column)({
|
|
115
|
+
type: "datetime",
|
|
116
|
+
default: null,
|
|
117
|
+
nullable: true,
|
|
118
|
+
comment: "Fecha de la última actualización del registro.",
|
|
119
|
+
onUpdate: "CURRENT_TIMESTAMP",
|
|
120
|
+
}),
|
|
121
|
+
__metadata("design:type", Object)
|
|
122
|
+
], PaymentTransaction.prototype, "updated", void 0);
|
|
113
123
|
exports.PaymentTransaction = PaymentTransaction = __decorate([
|
|
114
124
|
(0, typeorm_1.Entity)({
|
|
115
125
|
comment: "Registro histórico de todos los intentos de cobro realizados.",
|
|
@@ -45,7 +45,7 @@ __decorate([
|
|
|
45
45
|
type: "text",
|
|
46
46
|
comment: "Descripción del paquete.",
|
|
47
47
|
}),
|
|
48
|
-
__metadata("design:type",
|
|
48
|
+
__metadata("design:type", String)
|
|
49
49
|
], SubscriptionAddonTemplate.prototype, "description", void 0);
|
|
50
50
|
__decorate([
|
|
51
51
|
(0, typeorm_1.Column)({
|
|
@@ -127,6 +127,16 @@ __decorate([
|
|
|
127
127
|
}),
|
|
128
128
|
__metadata("design:type", Date)
|
|
129
129
|
], SubscriptionPlan.prototype, "created", void 0);
|
|
130
|
+
__decorate([
|
|
131
|
+
(0, typeorm_1.Column)({
|
|
132
|
+
type: "datetime",
|
|
133
|
+
default: null,
|
|
134
|
+
nullable: true,
|
|
135
|
+
comment: "Fecha de la última actualización del registro.",
|
|
136
|
+
onUpdate: "CURRENT_TIMESTAMP",
|
|
137
|
+
}),
|
|
138
|
+
__metadata("design:type", Object)
|
|
139
|
+
], SubscriptionPlan.prototype, "updated", void 0);
|
|
130
140
|
__decorate([
|
|
131
141
|
(0, typeorm_1.OneToMany)(() => CompanySubscription_1.CompanySubscription, (companySubscription) => companySubscription.subscription_plan),
|
|
132
142
|
__metadata("design:type", Array)
|
|
@@ -6,8 +6,10 @@ export declare class UsageAlert {
|
|
|
6
6
|
resource_type: number;
|
|
7
7
|
threshold_percent: number;
|
|
8
8
|
action_type: number;
|
|
9
|
-
subscription_addon_template: SubscriptionAddonTemplate;
|
|
9
|
+
subscription_addon_template: SubscriptionAddonTemplate | null;
|
|
10
10
|
notification_email: string | null;
|
|
11
|
+
last_triggered_at: Date | null;
|
|
12
|
+
max_autopurchases: number | null;
|
|
11
13
|
status: number;
|
|
12
14
|
created: Date;
|
|
13
15
|
updated: Date | null;
|
|
@@ -56,9 +56,10 @@ __decorate([
|
|
|
56
56
|
(0, typeorm_1.ManyToOne)(() => SubscriptionAddonTemplate_1.SubscriptionAddonTemplate, (subscriptionAddonTemplate) => subscriptionAddonTemplate.usage_alerts, {
|
|
57
57
|
onDelete: "SET NULL",
|
|
58
58
|
onUpdate: "NO ACTION",
|
|
59
|
+
nullable: true,
|
|
59
60
|
}),
|
|
60
61
|
(0, typeorm_1.JoinColumn)({ name: "subscription_addon_template" }),
|
|
61
|
-
__metadata("design:type",
|
|
62
|
+
__metadata("design:type", Object)
|
|
62
63
|
], UsageAlert.prototype, "subscription_addon_template", void 0);
|
|
63
64
|
__decorate([
|
|
64
65
|
(0, typeorm_1.Column)({
|
|
@@ -70,6 +71,24 @@ __decorate([
|
|
|
70
71
|
}),
|
|
71
72
|
__metadata("design:type", Object)
|
|
72
73
|
], UsageAlert.prototype, "notification_email", void 0);
|
|
74
|
+
__decorate([
|
|
75
|
+
(0, typeorm_1.Column)({
|
|
76
|
+
type: "datetime",
|
|
77
|
+
nullable: true,
|
|
78
|
+
default: null,
|
|
79
|
+
comment: "Última vez que se disparó la alerta (anti-repetición). Se fija al cruzar el umbral y se limpia (NULL = armada) cuando el uso baja del umbral.",
|
|
80
|
+
}),
|
|
81
|
+
__metadata("design:type", Object)
|
|
82
|
+
], UsageAlert.prototype, "last_triggered_at", void 0);
|
|
83
|
+
__decorate([
|
|
84
|
+
(0, typeorm_1.Column)({
|
|
85
|
+
type: "int",
|
|
86
|
+
nullable: true,
|
|
87
|
+
default: null,
|
|
88
|
+
comment: "Tope de compras automáticas por ciclo de facturación para esta alerta. NULL = sin límite.",
|
|
89
|
+
}),
|
|
90
|
+
__metadata("design:type", Object)
|
|
91
|
+
], UsageAlert.prototype, "max_autopurchases", void 0);
|
|
73
92
|
__decorate([
|
|
74
93
|
(0, typeorm_1.Column)({
|
|
75
94
|
default: 1,
|