@asumano/worklip-typeorm-db 1.1.44 → 1.1.46

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.
@@ -5,7 +5,7 @@ export declare class BillingInvoice {
5
5
  id: number;
6
6
  company: Company;
7
7
  company_subscription: CompanySubscription;
8
- payment_reference: string;
8
+ payment_reference: string | null;
9
9
  invoice_number: string;
10
10
  period_year: number;
11
11
  period_month: number;
@@ -15,7 +15,9 @@ export declare class BillingInvoice {
15
15
  status: number;
16
16
  due_date: Date;
17
17
  paid_date: Date | null;
18
- details: string | null;
18
+ retry_count: number;
19
+ next_retry_at: Date | null;
20
+ details: Record<string, any> | null;
19
21
  created: Date;
20
22
  updated: Date | null;
21
23
  payment_transactions: PaymentTransaction[];
@@ -44,9 +44,11 @@ __decorate([
44
44
  (0, typeorm_1.Column)({
45
45
  length: 100,
46
46
  type: "varchar",
47
- comment: "ID de la transacción que retorna la pasarela de pago.",
47
+ nullable: true,
48
+ default: null,
49
+ comment: "Referencia que se envía a la pasarela (Wompi) para conciliar el pago. Es NULL hasta que se genera el intento de cobro.",
48
50
  }),
49
- __metadata("design:type", String)
51
+ __metadata("design:type", Object)
50
52
  ], BillingInvoice.prototype, "payment_reference", void 0);
51
53
  __decorate([
52
54
  (0, typeorm_1.Column)({
@@ -73,7 +75,7 @@ __decorate([
73
75
  __decorate([
74
76
  (0, typeorm_1.Column)({
75
77
  type: "decimal",
76
- precision: 10,
78
+ precision: 14,
77
79
  scale: 2,
78
80
  comment: "Valor antes de impuestos.",
79
81
  }),
@@ -82,7 +84,7 @@ __decorate([
82
84
  __decorate([
83
85
  (0, typeorm_1.Column)({
84
86
  type: "decimal",
85
- precision: 10,
87
+ precision: 14,
86
88
  scale: 2,
87
89
  default: 0,
88
90
  comment: "IVA.",
@@ -92,7 +94,7 @@ __decorate([
92
94
  __decorate([
93
95
  (0, typeorm_1.Column)({
94
96
  type: "decimal",
95
- precision: 10,
97
+ precision: 14,
96
98
  scale: 2,
97
99
  comment: "Valor final.",
98
100
  }),
@@ -123,6 +125,23 @@ __decorate([
123
125
  }),
124
126
  __metadata("design:type", Object)
125
127
  ], BillingInvoice.prototype, "paid_date", void 0);
128
+ __decorate([
129
+ (0, typeorm_1.Column)({
130
+ type: "int",
131
+ default: 0,
132
+ comment: "Reintentos de cobro automático (dunning) ya realizados sobre la factura.",
133
+ }),
134
+ __metadata("design:type", Number)
135
+ ], BillingInvoice.prototype, "retry_count", void 0);
136
+ __decorate([
137
+ (0, typeorm_1.Column)({
138
+ type: "datetime",
139
+ nullable: true,
140
+ default: null,
141
+ comment: "Próxima fecha de reintento de cobro automático (dunning). NULL = sin reintento programado.",
142
+ }),
143
+ __metadata("design:type", Object)
144
+ ], BillingInvoice.prototype, "next_retry_at", void 0);
126
145
  __decorate([
127
146
  (0, typeorm_1.Column)({
128
147
  type: "json",
@@ -158,5 +177,7 @@ exports.BillingInvoice = BillingInvoice = __decorate([
158
177
  (0, typeorm_1.Entity)({
159
178
  comment: "Facturas de cobro del plan que tenga la empresa.",
160
179
  name: "billing_invoice",
161
- })
180
+ }),
181
+ (0, typeorm_1.Index)("UQ_billing_invoice_number", ["invoice_number"], { unique: true }),
182
+ (0, typeorm_1.Index)("UQ_billing_invoice_period", ["company_subscription", "period_year", "period_month"], { unique: true })
162
183
  ], BillingInvoice);
@@ -95,5 +95,8 @@ exports.BillingUsageSnapshot = BillingUsageSnapshot = __decorate([
95
95
  (0, typeorm_1.Entity)({
96
96
  comment: "Se hace un resumen para facturación de consumo por cada empresa para un año y mes específico mediante un job, supongamos que todos los finales de mes se corre un job para que lo calcule.",
97
97
  name: "billing_usage_snapshot",
98
+ }),
99
+ (0, typeorm_1.Index)("UQ_billing_usage_snapshot_period", ["company", "year", "month"], {
100
+ unique: true,
98
101
  })
99
102
  ], BillingUsageSnapshot);
@@ -68,7 +68,7 @@ __decorate([
68
68
  __decorate([
69
69
  (0, typeorm_1.Column)({
70
70
  type: "decimal",
71
- precision: 10,
71
+ precision: 14,
72
72
  scale: 2,
73
73
  comment: "Precio del plan.",
74
74
  }),
@@ -110,5 +110,6 @@ __decorate([
110
110
  __metadata("design:type", Array)
111
111
  ], CompanySubscription.prototype, "billing_invoices", void 0);
112
112
  exports.CompanySubscription = CompanySubscription = __decorate([
113
- (0, typeorm_1.Entity)({ comment: "Plan de la empresa.", name: "company_subscription" })
113
+ (0, typeorm_1.Entity)({ comment: "Plan de la empresa.", name: "company_subscription" }),
114
+ (0, typeorm_1.Index)("IDX_company_subscription_company", ["company"])
114
115
  ], CompanySubscription);
@@ -101,5 +101,6 @@ exports.EmailLog = EmailLog = __decorate([
101
101
  (0, typeorm_1.Entity)({
102
102
  comment: "Logs de los correos electrónicos que se envían por cada concesionario/taller.",
103
103
  name: "email_log",
104
- })
104
+ }),
105
+ (0, typeorm_1.Index)("IDX_email_log_company_created", ["company", "created"])
105
106
  ], EmailLog);
@@ -140,5 +140,6 @@ exports.MediaFile = MediaFile = __decorate([
140
140
  (0, typeorm_1.Entity)({
141
141
  comment: "Logs de los archivos multimedia que se han generado por cada concesionario/taller.",
142
142
  name: "media_file",
143
- })
143
+ }),
144
+ (0, typeorm_1.Index)("IDX_media_file_company_created", ["company", "created"])
144
145
  ], MediaFile);
@@ -1,5 +1,4 @@
1
1
  import { Company } from "./Company";
2
- import { SubscriptionAddon } from "./SubscriptionAddon";
3
2
  import { PaymentTransaction } from "./PaymentTransaction";
4
3
  export declare class PaymentMethod {
5
4
  id: number;
@@ -13,6 +12,5 @@ export declare class PaymentMethod {
13
12
  status: number;
14
13
  created: Date;
15
14
  updated: Date | null;
16
- subscription_addons: SubscriptionAddon[];
17
15
  payment_transactions: PaymentTransaction[];
18
16
  }
@@ -12,7 +12,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.PaymentMethod = void 0;
13
13
  const typeorm_1 = require("typeorm");
14
14
  const Company_1 = require("./Company");
15
- const SubscriptionAddon_1 = require("./SubscriptionAddon");
16
15
  const PaymentTransaction_1 = require("./PaymentTransaction");
17
16
  let PaymentMethod = class PaymentMethod {
18
17
  };
@@ -85,7 +84,7 @@ __decorate([
85
84
  default: 1,
86
85
  type: "int",
87
86
  width: 1,
88
- comment: "Estado del plan de la empresa:\r\n1: Activo.\r\n2: Suspendido.\r\n3: Cancelado.\r\n4: Expirado.\r\n5: Trial ().",
87
+ comment: "Estado del método de pago:\r\n1: Activo.\r\n2: Expirado.\r\n0: Inactivo.",
89
88
  }),
90
89
  __metadata("design:type", Number)
91
90
  ], PaymentMethod.prototype, "status", void 0);
@@ -107,10 +106,6 @@ __decorate([
107
106
  }),
108
107
  __metadata("design:type", Object)
109
108
  ], PaymentMethod.prototype, "updated", void 0);
110
- __decorate([
111
- (0, typeorm_1.OneToMany)(() => SubscriptionAddon_1.SubscriptionAddon, (subscriptionAddon) => subscriptionAddon.company_subscription),
112
- __metadata("design:type", Array)
113
- ], PaymentMethod.prototype, "subscription_addons", void 0);
114
109
  __decorate([
115
110
  (0, typeorm_1.OneToMany)(() => PaymentTransaction_1.PaymentTransaction, (paymentTransaction) => paymentTransaction.payment_method),
116
111
  __metadata("design:type", Array)
@@ -55,13 +55,14 @@ __decorate([
55
55
  comment: "ID retornado por el proveedor.",
56
56
  nullable: true,
57
57
  default: null,
58
+ unique: true,
58
59
  }),
59
60
  __metadata("design:type", Object)
60
61
  ], PaymentTransaction.prototype, "provider_transaction_id", void 0);
61
62
  __decorate([
62
63
  (0, typeorm_1.Column)({
63
64
  type: "decimal",
64
- precision: 12,
65
+ precision: 14,
65
66
  scale: 2,
66
67
  comment: "Valor cobrado.",
67
68
  }),
@@ -1,7 +1,9 @@
1
1
  import { CompanySubscription } from "./CompanySubscription";
2
+ import { SubscriptionAddonTemplate } from "./SubscriptionAddonTemplate";
2
3
  export declare class SubscriptionAddon {
3
4
  id: number;
4
5
  company_subscription: CompanySubscription;
6
+ subscription_addon_template: SubscriptionAddonTemplate | null;
5
7
  addon_type: number;
6
8
  quantity: number;
7
9
  monthly_price: number;
@@ -12,6 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.SubscriptionAddon = void 0;
13
13
  const typeorm_1 = require("typeorm");
14
14
  const CompanySubscription_1 = require("./CompanySubscription");
15
+ const SubscriptionAddonTemplate_1 = require("./SubscriptionAddonTemplate");
15
16
  let SubscriptionAddon = class SubscriptionAddon {
16
17
  };
17
18
  exports.SubscriptionAddon = SubscriptionAddon;
@@ -30,6 +31,15 @@ __decorate([
30
31
  (0, typeorm_1.JoinColumn)({ name: "company_subscription" }),
31
32
  __metadata("design:type", CompanySubscription_1.CompanySubscription)
32
33
  ], SubscriptionAddon.prototype, "company_subscription", void 0);
34
+ __decorate([
35
+ (0, typeorm_1.ManyToOne)(() => SubscriptionAddonTemplate_1.SubscriptionAddonTemplate, (subscriptionAddonTemplate) => subscriptionAddonTemplate.subscription_addons, {
36
+ onDelete: "SET NULL",
37
+ onUpdate: "NO ACTION",
38
+ nullable: true,
39
+ }),
40
+ (0, typeorm_1.JoinColumn)({ name: "subscription_addon_template" }),
41
+ __metadata("design:type", Object)
42
+ ], SubscriptionAddon.prototype, "subscription_addon_template", void 0);
33
43
  __decorate([
34
44
  (0, typeorm_1.Column)({
35
45
  type: "int",
@@ -39,17 +49,15 @@ __decorate([
39
49
  ], SubscriptionAddon.prototype, "addon_type", void 0);
40
50
  __decorate([
41
51
  (0, typeorm_1.Column)({
42
- type: "decimal",
43
- precision: 12,
44
- scale: 2,
45
- comment: "Cantidad adicional adquirida. Ejemplo: 20 GB, 2000 mensajes, 500 correos.",
52
+ type: "int",
53
+ comment: "Cantidad adicional adquirida. Ejemplo: 20 (GB), 2000 (mensajes), 500 (correos).",
46
54
  }),
47
55
  __metadata("design:type", Number)
48
56
  ], SubscriptionAddon.prototype, "quantity", void 0);
49
57
  __decorate([
50
58
  (0, typeorm_1.Column)({
51
59
  type: "decimal",
52
- precision: 12,
60
+ precision: 14,
53
61
  scale: 2,
54
62
  comment: "Valor mensual que se cobra por este addon.",
55
63
  }),
@@ -99,5 +107,8 @@ __decorate([
99
107
  __metadata("design:type", Object)
100
108
  ], SubscriptionAddon.prototype, "updated", void 0);
101
109
  exports.SubscriptionAddon = SubscriptionAddon = __decorate([
102
- (0, typeorm_1.Entity)({ comment: "Plan de la empresa.", name: "subscription_addon" })
110
+ (0, typeorm_1.Entity)({
111
+ comment: "Complementos (addons) adquiridos por la empresa sobre su plan.",
112
+ name: "subscription_addon",
113
+ })
103
114
  ], SubscriptionAddon);
@@ -1,14 +1,16 @@
1
1
  import { UsageAlert } from "./UsageAlert";
2
+ import { SubscriptionAddon } from "./SubscriptionAddon";
2
3
  export declare class SubscriptionAddonTemplate {
3
4
  id: number;
4
5
  code: string;
5
6
  name: string;
6
7
  description: any | null;
7
- addon_type: string;
8
+ addon_type: number;
8
9
  quantity: number;
9
10
  monthly_price: number;
10
11
  status: number;
11
12
  created: Date;
12
13
  updated: Date | null;
13
14
  usage_alerts: UsageAlert[];
15
+ subscription_addons: SubscriptionAddon[];
14
16
  }
@@ -12,6 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.SubscriptionAddonTemplate = void 0;
13
13
  const typeorm_1 = require("typeorm");
14
14
  const UsageAlert_1 = require("./UsageAlert");
15
+ const SubscriptionAddon_1 = require("./SubscriptionAddon");
15
16
  let SubscriptionAddonTemplate = class SubscriptionAddonTemplate {
16
17
  };
17
18
  exports.SubscriptionAddonTemplate = SubscriptionAddonTemplate;
@@ -48,17 +49,14 @@ __decorate([
48
49
  ], SubscriptionAddonTemplate.prototype, "description", void 0);
49
50
  __decorate([
50
51
  (0, typeorm_1.Column)({
51
- length: 50,
52
- type: "varchar",
52
+ type: "int",
53
53
  comment: "Tipo de recurso:\r\n1. STORAGE_GB.\r\n2. WHATSAPP_MESSAGES.\r\n3. EMAIL_MESSAGES.\r\n4. USERS.\r\n5. WORKSHOPS.",
54
54
  }),
55
- __metadata("design:type", String)
55
+ __metadata("design:type", Number)
56
56
  ], SubscriptionAddonTemplate.prototype, "addon_type", void 0);
57
57
  __decorate([
58
58
  (0, typeorm_1.Column)({
59
- type: "decimal",
60
- precision: 12,
61
- scale: 2,
59
+ type: "int",
62
60
  comment: "Cantidad que agrega al plan.",
63
61
  }),
64
62
  __metadata("design:type", Number)
@@ -66,7 +64,7 @@ __decorate([
66
64
  __decorate([
67
65
  (0, typeorm_1.Column)({
68
66
  type: "decimal",
69
- precision: 12,
67
+ precision: 14,
70
68
  scale: 2,
71
69
  comment: "Valor mensual del paquete.",
72
70
  }),
@@ -103,6 +101,10 @@ __decorate([
103
101
  (0, typeorm_1.OneToMany)(() => UsageAlert_1.UsageAlert, (usageAlert) => usageAlert.subscription_addon_template),
104
102
  __metadata("design:type", Array)
105
103
  ], SubscriptionAddonTemplate.prototype, "usage_alerts", void 0);
104
+ __decorate([
105
+ (0, typeorm_1.OneToMany)(() => SubscriptionAddon_1.SubscriptionAddon, (subscriptionAddon) => subscriptionAddon.subscription_addon_template),
106
+ __metadata("design:type", Array)
107
+ ], SubscriptionAddonTemplate.prototype, "subscription_addons", void 0);
106
108
  exports.SubscriptionAddonTemplate = SubscriptionAddonTemplate = __decorate([
107
109
  (0, typeorm_1.Entity)({
108
110
  comment: "Catálogo de paquetes adicionales que pueden ser adquiridos por las empresas.",
@@ -47,7 +47,7 @@ __decorate([
47
47
  __decorate([
48
48
  (0, typeorm_1.Column)({
49
49
  type: "decimal",
50
- precision: 10,
50
+ precision: 14,
51
51
  scale: 2,
52
52
  comment: "Precio del plan.",
53
53
  }),
@@ -3,7 +3,7 @@ import { SubscriptionAddonTemplate } from "./SubscriptionAddonTemplate";
3
3
  export declare class UsageAlert {
4
4
  id: number;
5
5
  company: Company;
6
- resource_type: string;
6
+ resource_type: number;
7
7
  threshold_percent: number;
8
8
  action_type: number;
9
9
  subscription_addon_template: SubscriptionAddonTemplate;
@@ -33,11 +33,10 @@ __decorate([
33
33
  ], UsageAlert.prototype, "company", void 0);
34
34
  __decorate([
35
35
  (0, typeorm_1.Column)({
36
- length: 50,
37
- type: "varchar",
36
+ type: "int",
38
37
  comment: "Tipo de recurso:\r\n1. STORAGE_GB.\r\n2. WHATSAPP_MESSAGES.\r\n3. EMAIL_MESSAGES.\r\n4. USERS.\r\n5. WORKSHOPS.",
39
38
  }),
40
- __metadata("design:type", String)
39
+ __metadata("design:type", Number)
41
40
  ], UsageAlert.prototype, "resource_type", void 0);
42
41
  __decorate([
43
42
  (0, typeorm_1.Column)({
@@ -101,5 +101,6 @@ exports.WhatsappLog = WhatsappLog = __decorate([
101
101
  (0, typeorm_1.Entity)({
102
102
  comment: "Logs de mensajes vía whatsapp que se envían por cada concesionario/taller.",
103
103
  name: "whatsapp_log",
104
- })
104
+ }),
105
+ (0, typeorm_1.Index)("IDX_whatsapp_log_company_created", ["company", "created"])
105
106
  ], WhatsappLog);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@asumano/worklip-typeorm-db",
3
- "version": "1.1.44",
3
+ "version": "1.1.46",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },