@asumano/worklip-typeorm-db 1.1.27 → 1.1.29

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 (56) hide show
  1. package/dist/CustomRepository.d.ts +13 -1
  2. package/dist/CustomRepository.js +9 -0
  3. package/dist/entities/Associate.d.ts +5 -4
  4. package/dist/entities/Associate.js +13 -4
  5. package/dist/entities/BillingInvoice.d.ts +22 -0
  6. package/dist/entities/BillingInvoice.js +162 -0
  7. package/dist/entities/BillingUsageSnapshot.d.ts +13 -0
  8. package/dist/entities/BillingUsageSnapshot.js +99 -0
  9. package/dist/entities/Client.d.ts +1 -0
  10. package/dist/entities/Client.js +9 -0
  11. package/dist/entities/Company.d.ts +8 -1
  12. package/dist/entities/Company.js +28 -0
  13. package/dist/entities/CompanySubscription.d.ts +18 -0
  14. package/dist/entities/CompanySubscription.js +114 -0
  15. package/dist/entities/EmailLog.d.ts +14 -0
  16. package/dist/entities/EmailLog.js +105 -0
  17. package/dist/entities/MediaFile.d.ts +19 -0
  18. package/dist/entities/MediaFile.js +144 -0
  19. package/dist/entities/PaymentMethod.d.ts +18 -0
  20. package/dist/entities/PaymentMethod.js +123 -0
  21. package/dist/entities/PaymentTransaction.d.ts +15 -0
  22. package/dist/entities/PaymentTransaction.js +117 -0
  23. package/dist/entities/Region.d.ts +2 -0
  24. package/dist/entities/Region.js +5 -0
  25. package/dist/entities/ServiceOrder.d.ts +2 -0
  26. package/dist/entities/ServiceOrder.js +5 -0
  27. package/dist/entities/SubscriptionAddon.d.ts +13 -0
  28. package/dist/entities/SubscriptionAddon.js +103 -0
  29. package/dist/entities/SubscriptionAddonTemplate.d.ts +14 -0
  30. package/dist/entities/SubscriptionAddonTemplate.js +111 -0
  31. package/dist/entities/SubscriptionPlan.d.ts +18 -0
  32. package/dist/entities/SubscriptionPlan.js +136 -0
  33. package/dist/entities/UsageAlert.d.ts +14 -0
  34. package/dist/entities/UsageAlert.js +106 -0
  35. package/dist/entities/Vehicle.d.ts +1 -0
  36. package/dist/entities/Vehicle.js +9 -0
  37. package/dist/entities/WhatsappLog.d.ts +14 -0
  38. package/dist/entities/WhatsappLog.js +105 -0
  39. package/dist/entities/Workshop.d.ts +6 -0
  40. package/dist/entities/Workshop.js +15 -0
  41. package/dist/entities.index.d.ts +12 -0
  42. package/dist/entities.index.js +25 -1
  43. package/dist/entities.views.routes.d.ts +3 -0
  44. package/dist/entities.views.routes.js +7 -1
  45. package/dist/filters/ClientsForTheTable.d.ts +6 -0
  46. package/dist/filters/ClientsForTheTable.js +48 -0
  47. package/dist/filters/ServicesOrderForTheTable.d.ts +6 -1
  48. package/dist/filters/ServicesOrderForTheTable.js +181 -0
  49. package/dist/filters/VehiclesForTheTable.d.ts +6 -0
  50. package/dist/filters/VehiclesForTheTable.js +48 -0
  51. package/dist/types.d.ts +4 -0
  52. package/dist/views/Clients.d.ts +18 -0
  53. package/dist/views/Clients.js +83 -0
  54. package/dist/views/Vehicles.d.ts +20 -0
  55. package/dist/views/Vehicles.js +91 -0
  56. package/package.json +1 -1
@@ -1,9 +1,21 @@
1
1
  import { DataSource, EntityTarget, ObjectLiteral, Repository } from "typeorm";
2
- import { IBasicFilter } from "./types";
2
+ import { IBasicFilter, IPropsFilterTableClientOrVehicle } from "./types";
3
3
  export declare class CustomRepository<T extends ObjectLiteral> extends Repository<T> {
4
4
  constructor(target: EntityTarget<T>, dataSource: DataSource);
5
5
  getAssociatesForTheTableWrapper(params: IBasicFilter): Promise<{
6
6
  data: any[];
7
7
  totalRecords: number;
8
8
  }>;
9
+ getServicesOrderForTheTableWrapper(params: IBasicFilter): Promise<{
10
+ data: any[];
11
+ totalRecords: number;
12
+ }>;
13
+ getClientsForTheTableWrapper(params: IPropsFilterTableClientOrVehicle): Promise<{
14
+ data: any[];
15
+ totalRecords: number;
16
+ }>;
17
+ getVehiclesForTheTableWrapper(params: IPropsFilterTableClientOrVehicle): Promise<{
18
+ data: any[];
19
+ totalRecords: number;
20
+ }>;
9
21
  }
@@ -10,5 +10,14 @@ class CustomRepository extends typeorm_1.Repository {
10
10
  async getAssociatesForTheTableWrapper(params) {
11
11
  return await (0, entities_views_routes_1.getAssociatesForTheTable)(this, params);
12
12
  }
13
+ async getServicesOrderForTheTableWrapper(params) {
14
+ return await (0, entities_views_routes_1.getServicesOrderForTheTable)(this, params);
15
+ }
16
+ async getClientsForTheTableWrapper(params) {
17
+ return await (0, entities_views_routes_1.getClientsForTheTable)(this, params);
18
+ }
19
+ async getVehiclesForTheTableWrapper(params) {
20
+ return await (0, entities_views_routes_1.getVehiclesForTheTable)(this, params);
21
+ }
13
22
  }
14
23
  exports.CustomRepository = CustomRepository;
@@ -1,10 +1,10 @@
1
+ import { AssociatePasswordReset, AssociatePermission, Region } from "../entities.views.routes";
2
+ import { AssociateSession } from "./AssociateSession";
1
3
  import { City } from "./City";
2
4
  import { Company } from "./Company";
3
- import { AssociateSession } from "./AssociateSession";
4
- import { Workshop } from "./Workshop";
5
- import { ServiceOrderHistory } from "./ServiceOrderHistory";
6
5
  import { Reminder } from "./Reminder";
7
- import { AssociatePasswordReset, AssociatePermission } from "../entities.views.routes";
6
+ import { ServiceOrderHistory } from "./ServiceOrderHistory";
7
+ import { Workshop } from "./Workshop";
8
8
  export declare class Associate {
9
9
  id: number;
10
10
  code: string;
@@ -14,6 +14,7 @@ export declare class Associate {
14
14
  surname: string;
15
15
  email: string;
16
16
  phone: string;
17
+ region: Region | null;
17
18
  city: City | null;
18
19
  address: string | null;
19
20
  password: string;
@@ -11,13 +11,13 @@ var __metadata = (this && this.__metadata) || function (k, v) {
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.Associate = void 0;
13
13
  const typeorm_1 = require("typeorm");
14
+ const entities_views_routes_1 = require("../entities.views.routes");
15
+ const AssociateSession_1 = require("./AssociateSession");
14
16
  const City_1 = require("./City");
15
17
  const Company_1 = require("./Company");
16
- const AssociateSession_1 = require("./AssociateSession");
17
- const Workshop_1 = require("./Workshop");
18
- const ServiceOrderHistory_1 = require("./ServiceOrderHistory");
19
18
  const Reminder_1 = require("./Reminder");
20
- const entities_views_routes_1 = require("../entities.views.routes");
19
+ const ServiceOrderHistory_1 = require("./ServiceOrderHistory");
20
+ const Workshop_1 = require("./Workshop");
21
21
  let Associate = class Associate {
22
22
  };
23
23
  exports.Associate = Associate;
@@ -84,6 +84,15 @@ __decorate([
84
84
  }),
85
85
  __metadata("design:type", String)
86
86
  ], Associate.prototype, "phone", void 0);
87
+ __decorate([
88
+ (0, typeorm_1.ManyToOne)(() => entities_views_routes_1.Region, (region) => region.associates, {
89
+ onDelete: "RESTRICT",
90
+ onUpdate: "NO ACTION",
91
+ nullable: true,
92
+ }),
93
+ (0, typeorm_1.JoinColumn)({ name: "region" }),
94
+ __metadata("design:type", Object)
95
+ ], Associate.prototype, "region", void 0);
87
96
  __decorate([
88
97
  (0, typeorm_1.ManyToOne)(() => City_1.City, (city) => city.associates, {
89
98
  onDelete: "RESTRICT",
@@ -0,0 +1,22 @@
1
+ import { Company } from "./Company";
2
+ import { CompanySubscription } from "./CompanySubscription";
3
+ import { PaymentTransaction } from "./PaymentTransaction";
4
+ export declare class BillingInvoice {
5
+ id: number;
6
+ company: Company;
7
+ company_subscription: CompanySubscription;
8
+ payment_reference: string;
9
+ invoice_number: string;
10
+ period_year: number;
11
+ period_month: number;
12
+ subtotal: number;
13
+ tax: number;
14
+ total: number;
15
+ status: number;
16
+ due_date: Date;
17
+ paid_date: Date | null;
18
+ details: string | null;
19
+ created: Date;
20
+ updated: Date | null;
21
+ payment_transactions: PaymentTransaction[];
22
+ }
@@ -0,0 +1,162 @@
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.BillingInvoice = void 0;
13
+ const typeorm_1 = require("typeorm");
14
+ const Company_1 = require("./Company");
15
+ const CompanySubscription_1 = require("./CompanySubscription");
16
+ const PaymentTransaction_1 = require("./PaymentTransaction");
17
+ let BillingInvoice = class BillingInvoice {
18
+ };
19
+ exports.BillingInvoice = BillingInvoice;
20
+ __decorate([
21
+ (0, typeorm_1.PrimaryGeneratedColumn)({
22
+ type: "int",
23
+ comment: "ID único de cada registro.",
24
+ }),
25
+ __metadata("design:type", Number)
26
+ ], BillingInvoice.prototype, "id", void 0);
27
+ __decorate([
28
+ (0, typeorm_1.ManyToOne)(() => Company_1.Company, (company) => company.billing_invoices, {
29
+ onDelete: "CASCADE",
30
+ onUpdate: "NO ACTION",
31
+ }),
32
+ (0, typeorm_1.JoinColumn)({ name: "company" }),
33
+ __metadata("design:type", Company_1.Company)
34
+ ], BillingInvoice.prototype, "company", void 0);
35
+ __decorate([
36
+ (0, typeorm_1.ManyToOne)(() => CompanySubscription_1.CompanySubscription, (companySubscription) => companySubscription.billing_invoices, {
37
+ onDelete: "CASCADE",
38
+ onUpdate: "NO ACTION",
39
+ }),
40
+ (0, typeorm_1.JoinColumn)({ name: "company_subscription" }),
41
+ __metadata("design:type", CompanySubscription_1.CompanySubscription)
42
+ ], BillingInvoice.prototype, "company_subscription", void 0);
43
+ __decorate([
44
+ (0, typeorm_1.Column)({
45
+ length: 100,
46
+ type: "varchar",
47
+ comment: "ID de la transacción que retorna la pasarela de pago.",
48
+ }),
49
+ __metadata("design:type", String)
50
+ ], BillingInvoice.prototype, "payment_reference", void 0);
51
+ __decorate([
52
+ (0, typeorm_1.Column)({
53
+ length: 50,
54
+ type: "varchar",
55
+ comment: "Número de la factura, puede ser FAC-2026-0000042.",
56
+ }),
57
+ __metadata("design:type", String)
58
+ ], BillingInvoice.prototype, "invoice_number", void 0);
59
+ __decorate([
60
+ (0, typeorm_1.Column)({
61
+ type: "int",
62
+ comment: "Año facturado.",
63
+ }),
64
+ __metadata("design:type", Number)
65
+ ], BillingInvoice.prototype, "period_year", void 0);
66
+ __decorate([
67
+ (0, typeorm_1.Column)({
68
+ type: "int",
69
+ comment: "Mes facturado.",
70
+ }),
71
+ __metadata("design:type", Number)
72
+ ], BillingInvoice.prototype, "period_month", void 0);
73
+ __decorate([
74
+ (0, typeorm_1.Column)({
75
+ type: "decimal",
76
+ precision: 10,
77
+ scale: 2,
78
+ comment: "Valor antes de impuestos.",
79
+ }),
80
+ __metadata("design:type", Number)
81
+ ], BillingInvoice.prototype, "subtotal", void 0);
82
+ __decorate([
83
+ (0, typeorm_1.Column)({
84
+ type: "decimal",
85
+ precision: 10,
86
+ scale: 2,
87
+ default: 0,
88
+ comment: "IVA.",
89
+ }),
90
+ __metadata("design:type", Number)
91
+ ], BillingInvoice.prototype, "tax", void 0);
92
+ __decorate([
93
+ (0, typeorm_1.Column)({
94
+ type: "decimal",
95
+ precision: 10,
96
+ scale: 2,
97
+ comment: "Valor final.",
98
+ }),
99
+ __metadata("design:type", Number)
100
+ ], BillingInvoice.prototype, "total", void 0);
101
+ __decorate([
102
+ (0, typeorm_1.Column)({
103
+ default: 1,
104
+ type: "int",
105
+ width: 1,
106
+ comment: "Estado en el que se encuentra el pago:\r\n1: Pendiente.\r\n2: Pagado.\r\n3: Atrasado.\r\n4: Cancelado.",
107
+ }),
108
+ __metadata("design:type", Number)
109
+ ], BillingInvoice.prototype, "status", void 0);
110
+ __decorate([
111
+ (0, typeorm_1.Column)({
112
+ type: "datetime",
113
+ comment: "Fecha máximo de pago.",
114
+ }),
115
+ __metadata("design:type", Date)
116
+ ], BillingInvoice.prototype, "due_date", void 0);
117
+ __decorate([
118
+ (0, typeorm_1.Column)({
119
+ type: "datetime",
120
+ nullable: true,
121
+ default: null,
122
+ comment: "Fecha real del pago.",
123
+ }),
124
+ __metadata("design:type", Object)
125
+ ], BillingInvoice.prototype, "paid_date", void 0);
126
+ __decorate([
127
+ (0, typeorm_1.Column)({
128
+ type: "json",
129
+ nullable: true,
130
+ default: null,
131
+ comment: 'Campo de tipo JSON para guardar registros adicionales como {"plan":{"name":"PRO","amount":500000},"storage":{"used_gb":87,"included_gb":80,"extra_gb":7,"amount":21000},"whatsapp":{"used":350,"included":5000,"extra":0,"amount":0},"emails":{"used":120,"included":15000,"extra":0,"amount":0}}',
132
+ }),
133
+ __metadata("design:type", Object)
134
+ ], BillingInvoice.prototype, "details", void 0);
135
+ __decorate([
136
+ (0, typeorm_1.Column)({
137
+ type: "datetime",
138
+ comment: "Fecha de creación del pago del plan.",
139
+ default: () => "CURRENT_TIMESTAMP",
140
+ }),
141
+ __metadata("design:type", Date)
142
+ ], BillingInvoice.prototype, "created", void 0);
143
+ __decorate([
144
+ (0, typeorm_1.Column)({
145
+ type: "datetime",
146
+ default: null,
147
+ nullable: true,
148
+ comment: "Fecha de actualización del pago del plan.",
149
+ onUpdate: "CURRENT_TIMESTAMP",
150
+ }),
151
+ __metadata("design:type", Object)
152
+ ], BillingInvoice.prototype, "updated", void 0);
153
+ __decorate([
154
+ (0, typeorm_1.OneToMany)(() => PaymentTransaction_1.PaymentTransaction, (paymentTransaction) => paymentTransaction.billing_invoice),
155
+ __metadata("design:type", Array)
156
+ ], BillingInvoice.prototype, "payment_transactions", void 0);
157
+ exports.BillingInvoice = BillingInvoice = __decorate([
158
+ (0, typeorm_1.Entity)({
159
+ comment: "Facturas de cobro del plan que tenga la empresa.",
160
+ name: "billing_invoice",
161
+ })
162
+ ], BillingInvoice);
@@ -0,0 +1,13 @@
1
+ import { Company } from "./Company";
2
+ export declare class BillingUsageSnapshot {
3
+ id: number;
4
+ company: Company;
5
+ year: number;
6
+ month: number;
7
+ storage_bytes: number;
8
+ whatsapp_messages: number;
9
+ emails_sent: number;
10
+ active_users: number;
11
+ active_workshops: number;
12
+ created: Date;
13
+ }
@@ -0,0 +1,99 @@
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.BillingUsageSnapshot = void 0;
13
+ const typeorm_1 = require("typeorm");
14
+ const Company_1 = require("./Company");
15
+ let BillingUsageSnapshot = class BillingUsageSnapshot {
16
+ };
17
+ exports.BillingUsageSnapshot = BillingUsageSnapshot;
18
+ __decorate([
19
+ (0, typeorm_1.PrimaryGeneratedColumn)({
20
+ type: "int",
21
+ comment: "ID único de cada registro.",
22
+ }),
23
+ __metadata("design:type", Number)
24
+ ], BillingUsageSnapshot.prototype, "id", void 0);
25
+ __decorate([
26
+ (0, typeorm_1.ManyToOne)(() => Company_1.Company, (company) => company.billing_usage_snapshots, {
27
+ onDelete: "CASCADE",
28
+ onUpdate: "NO ACTION",
29
+ }),
30
+ (0, typeorm_1.JoinColumn)({ name: "company" }),
31
+ __metadata("design:type", Company_1.Company)
32
+ ], BillingUsageSnapshot.prototype, "company", void 0);
33
+ __decorate([
34
+ (0, typeorm_1.Column)({
35
+ type: "int",
36
+ comment: "Año en el que se crea el registro.",
37
+ }),
38
+ __metadata("design:type", Number)
39
+ ], BillingUsageSnapshot.prototype, "year", void 0);
40
+ __decorate([
41
+ (0, typeorm_1.Column)({
42
+ type: "int",
43
+ comment: "Mes en el que se crea el registro.",
44
+ }),
45
+ __metadata("design:type", Number)
46
+ ], BillingUsageSnapshot.prototype, "month", void 0);
47
+ __decorate([
48
+ (0, typeorm_1.Column)({
49
+ type: "bigint",
50
+ comment: "Cuánto fue el consumo de almacenamiento (media_file) de la empresa para el mes y año.",
51
+ }),
52
+ __metadata("design:type", Number)
53
+ ], BillingUsageSnapshot.prototype, "storage_bytes", void 0);
54
+ __decorate([
55
+ (0, typeorm_1.Column)({
56
+ type: "int",
57
+ default: 0,
58
+ comment: "Cuánto fue el consumo de mensajes por whatsapp (whatsapp_log) de la empresa para el mes y año.",
59
+ }),
60
+ __metadata("design:type", Number)
61
+ ], BillingUsageSnapshot.prototype, "whatsapp_messages", void 0);
62
+ __decorate([
63
+ (0, typeorm_1.Column)({
64
+ type: "int",
65
+ default: 0,
66
+ comment: "Cuánto fue el consumo de envíos de correo (email_log) de la empresa para el mes y año.",
67
+ }),
68
+ __metadata("design:type", Number)
69
+ ], BillingUsageSnapshot.prototype, "emails_sent", void 0);
70
+ __decorate([
71
+ (0, typeorm_1.Column)({
72
+ type: "int",
73
+ default: 0,
74
+ comment: "Cuántos usuarios activos hay (associate) de la empresa para el mes y año.",
75
+ }),
76
+ __metadata("design:type", Number)
77
+ ], BillingUsageSnapshot.prototype, "active_users", void 0);
78
+ __decorate([
79
+ (0, typeorm_1.Column)({
80
+ type: "int",
81
+ default: 0,
82
+ comment: "Cuántos talleres/concesionarios activos hay (workshop) de la empresa para el mes y año.",
83
+ }),
84
+ __metadata("design:type", Number)
85
+ ], BillingUsageSnapshot.prototype, "active_workshops", void 0);
86
+ __decorate([
87
+ (0, typeorm_1.Column)({
88
+ type: "datetime",
89
+ comment: "Fecha de creación del registro.",
90
+ default: () => "CURRENT_TIMESTAMP",
91
+ }),
92
+ __metadata("design:type", Date)
93
+ ], BillingUsageSnapshot.prototype, "created", void 0);
94
+ exports.BillingUsageSnapshot = BillingUsageSnapshot = __decorate([
95
+ (0, typeorm_1.Entity)({
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
+ name: "billing_usage_snapshot",
98
+ })
99
+ ], BillingUsageSnapshot);
@@ -12,6 +12,7 @@ export declare class Client {
12
12
  phone: string;
13
13
  city: City;
14
14
  details: any | null;
15
+ status: number;
15
16
  service_orders: ServiceOrder[];
16
17
  reminders: Reminder[];
17
18
  }
@@ -86,6 +86,15 @@ __decorate([
86
86
  }),
87
87
  __metadata("design:type", Object)
88
88
  ], Client.prototype, "details", void 0);
89
+ __decorate([
90
+ (0, typeorm_1.Column)({
91
+ default: 1,
92
+ type: "int",
93
+ width: 1,
94
+ comment: "Estado en el que se encuentra el cliente, estos clientes no se pueden eliminar ya que la mayoría tienen relación con la tabla service_order.\r\n1: Activo: Visible en la plataforma.\r\n0: Inactivo: No estará visible en la plataforma para crear o enviar información ya sea por correo electrónico o al celular.",
95
+ }),
96
+ __metadata("design:type", Number)
97
+ ], Client.prototype, "status", void 0);
89
98
  __decorate([
90
99
  (0, typeorm_1.OneToMany)(() => ServiceOrder_1.ServiceOrder, (serviceOrder) => serviceOrder.client),
91
100
  __metadata("design:type", Array)
@@ -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 { CompanyBrand, Country } from "..";
5
+ import { BillingInvoice, BillingUsageSnapshot, CompanyBrand, Country, EmailLog, MediaFile, PaymentMethod, UsageAlert, WhatsappLog } from "..";
6
6
  export declare class Company {
7
7
  id: number;
8
8
  country: Country;
@@ -15,4 +15,11 @@ export declare class Company {
15
15
  associates: Associate[];
16
16
  workshops: Workshop[];
17
17
  companyBrands: CompanyBrand[];
18
+ payment_methods: PaymentMethod[];
19
+ billing_usage_snapshots: BillingUsageSnapshot[];
20
+ media_files: MediaFile[];
21
+ whatsapp_logs: WhatsappLog[];
22
+ email_logs: EmailLog[];
23
+ billing_invoices: BillingInvoice[];
24
+ usage_alerts: UsageAlert[];
18
25
  }
@@ -85,6 +85,34 @@ __decorate([
85
85
  (0, typeorm_1.OneToMany)(() => __1.CompanyBrand, (companyBrand) => companyBrand.company),
86
86
  __metadata("design:type", Array)
87
87
  ], Company.prototype, "companyBrands", void 0);
88
+ __decorate([
89
+ (0, typeorm_1.OneToMany)(() => __1.PaymentMethod, (paymentMethod) => paymentMethod.company),
90
+ __metadata("design:type", Array)
91
+ ], Company.prototype, "payment_methods", void 0);
92
+ __decorate([
93
+ (0, typeorm_1.OneToMany)(() => __1.BillingUsageSnapshot, (billingUsageSnapshot) => billingUsageSnapshot.company),
94
+ __metadata("design:type", Array)
95
+ ], Company.prototype, "billing_usage_snapshots", void 0);
96
+ __decorate([
97
+ (0, typeorm_1.OneToMany)(() => __1.MediaFile, (mediaFile) => mediaFile.company),
98
+ __metadata("design:type", Array)
99
+ ], Company.prototype, "media_files", void 0);
100
+ __decorate([
101
+ (0, typeorm_1.OneToMany)(() => __1.WhatsappLog, (whatsappLog) => whatsappLog.company),
102
+ __metadata("design:type", Array)
103
+ ], Company.prototype, "whatsapp_logs", void 0);
104
+ __decorate([
105
+ (0, typeorm_1.OneToMany)(() => __1.EmailLog, (emailLog) => emailLog.company),
106
+ __metadata("design:type", Array)
107
+ ], Company.prototype, "email_logs", void 0);
108
+ __decorate([
109
+ (0, typeorm_1.OneToMany)(() => __1.BillingInvoice, (billingInvoice) => billingInvoice.company),
110
+ __metadata("design:type", Array)
111
+ ], Company.prototype, "billing_invoices", void 0);
112
+ __decorate([
113
+ (0, typeorm_1.OneToMany)(() => __1.UsageAlert, (usageAlert) => usageAlert.company),
114
+ __metadata("design:type", Array)
115
+ ], Company.prototype, "usage_alerts", void 0);
88
116
  exports.Company = Company = __decorate([
89
117
  (0, typeorm_1.Entity)({ comment: "Empresas registradas en la plataforma." })
90
118
  ], Company);
@@ -0,0 +1,18 @@
1
+ import { Company } from "./Company";
2
+ import { SubscriptionPlan } from "./SubscriptionPlan";
3
+ import { SubscriptionAddon } from "./SubscriptionAddon";
4
+ import { BillingInvoice } from "./BillingInvoice";
5
+ export declare class CompanySubscription {
6
+ id: number;
7
+ company: Company;
8
+ subscription_plan: SubscriptionPlan;
9
+ start_date: string;
10
+ end_date: string | null;
11
+ billing_day: number;
12
+ price_monthly: number;
13
+ status: number;
14
+ created: Date;
15
+ updated: Date | null;
16
+ subscription_addons: SubscriptionAddon[];
17
+ billing_invoices: BillingInvoice[];
18
+ }
@@ -0,0 +1,114 @@
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.CompanySubscription = void 0;
13
+ const typeorm_1 = require("typeorm");
14
+ const Company_1 = require("./Company");
15
+ const SubscriptionPlan_1 = require("./SubscriptionPlan");
16
+ const SubscriptionAddon_1 = require("./SubscriptionAddon");
17
+ const BillingInvoice_1 = require("./BillingInvoice");
18
+ let CompanySubscription = class CompanySubscription {
19
+ };
20
+ exports.CompanySubscription = CompanySubscription;
21
+ __decorate([
22
+ (0, typeorm_1.PrimaryGeneratedColumn)({
23
+ type: "int",
24
+ comment: "ID único de cada registro.",
25
+ }),
26
+ __metadata("design:type", Number)
27
+ ], CompanySubscription.prototype, "id", void 0);
28
+ __decorate([
29
+ (0, typeorm_1.ManyToOne)(() => Company_1.Company, (company) => company.associates, {
30
+ onDelete: "CASCADE",
31
+ onUpdate: "NO ACTION",
32
+ }),
33
+ (0, typeorm_1.JoinColumn)({ name: "company" }),
34
+ __metadata("design:type", Company_1.Company)
35
+ ], CompanySubscription.prototype, "company", void 0);
36
+ __decorate([
37
+ (0, typeorm_1.ManyToOne)(() => SubscriptionPlan_1.SubscriptionPlan, (subscriptionPlan) => subscriptionPlan.companySubscriptions, {
38
+ onDelete: "RESTRICT",
39
+ onUpdate: "NO ACTION",
40
+ }),
41
+ (0, typeorm_1.JoinColumn)({ name: "subscription_plan" }),
42
+ __metadata("design:type", SubscriptionPlan_1.SubscriptionPlan)
43
+ ], CompanySubscription.prototype, "subscription_plan", void 0);
44
+ __decorate([
45
+ (0, typeorm_1.Column)({
46
+ type: "date",
47
+ comment: "Fecha de inicio de la suscripción del plan.",
48
+ }),
49
+ __metadata("design:type", String)
50
+ ], CompanySubscription.prototype, "start_date", void 0);
51
+ __decorate([
52
+ (0, typeorm_1.Column)({
53
+ type: "date",
54
+ nullable: true,
55
+ default: null,
56
+ comment: "Fecha de finalización de la suscripción del plan.",
57
+ }),
58
+ __metadata("design:type", Object)
59
+ ], CompanySubscription.prototype, "end_date", void 0);
60
+ __decorate([
61
+ (0, typeorm_1.Column)({
62
+ default: 1,
63
+ type: "int",
64
+ comment: "Día de facturación para cobrar el plan.",
65
+ }),
66
+ __metadata("design:type", Number)
67
+ ], CompanySubscription.prototype, "billing_day", void 0);
68
+ __decorate([
69
+ (0, typeorm_1.Column)({
70
+ type: "decimal",
71
+ precision: 10,
72
+ scale: 2,
73
+ comment: "Precio del plan.",
74
+ }),
75
+ __metadata("design:type", Number)
76
+ ], CompanySubscription.prototype, "price_monthly", void 0);
77
+ __decorate([
78
+ (0, typeorm_1.Column)({
79
+ default: 1,
80
+ type: "int",
81
+ width: 1,
82
+ comment: "Estado del plan de la empresa:\r\n1: Activo.\r\n2: Suspendido.\r\n3: Cancelado.\r\n4: Expirado.\r\n5: Trial ().",
83
+ }),
84
+ __metadata("design:type", Number)
85
+ ], CompanySubscription.prototype, "status", void 0);
86
+ __decorate([
87
+ (0, typeorm_1.Column)({
88
+ type: "datetime",
89
+ comment: "Fecha de creación de la suscripción del plan.",
90
+ default: () => "CURRENT_TIMESTAMP",
91
+ }),
92
+ __metadata("design:type", Date)
93
+ ], CompanySubscription.prototype, "created", void 0);
94
+ __decorate([
95
+ (0, typeorm_1.Column)({
96
+ type: "datetime",
97
+ default: null,
98
+ nullable: true,
99
+ comment: "Fecha de actualización de la suscripción del plan.",
100
+ onUpdate: "CURRENT_TIMESTAMP",
101
+ }),
102
+ __metadata("design:type", Object)
103
+ ], CompanySubscription.prototype, "updated", void 0);
104
+ __decorate([
105
+ (0, typeorm_1.OneToMany)(() => SubscriptionAddon_1.SubscriptionAddon, (subscriptionAddon) => subscriptionAddon.company_subscription),
106
+ __metadata("design:type", Array)
107
+ ], CompanySubscription.prototype, "subscription_addons", void 0);
108
+ __decorate([
109
+ (0, typeorm_1.OneToMany)(() => BillingInvoice_1.BillingInvoice, (billingInvoice) => billingInvoice.company_subscription),
110
+ __metadata("design:type", Array)
111
+ ], CompanySubscription.prototype, "billing_invoices", void 0);
112
+ exports.CompanySubscription = CompanySubscription = __decorate([
113
+ (0, typeorm_1.Entity)({ comment: "Plan de la empresa.", name: "company_subscription" })
114
+ ], CompanySubscription);
@@ -0,0 +1,14 @@
1
+ import { Company } from "./Company";
2
+ import { Workshop } from "./Workshop";
3
+ export declare class EmailLog {
4
+ id: number;
5
+ company: Company;
6
+ workshop: Workshop | null;
7
+ recipient_email: string;
8
+ subject: string;
9
+ email_type: number;
10
+ provider_message_id: string;
11
+ status: number;
12
+ error_message: string | null;
13
+ created: Date;
14
+ }