@asumano/worklip-typeorm-db 1.1.26 → 1.1.28
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/Associate.d.ts +5 -4
- package/dist/entities/Associate.js +13 -4
- package/dist/entities/BillingInvoice.d.ts +22 -0
- package/dist/entities/BillingInvoice.js +162 -0
- package/dist/entities/BillingUsageSnapshot.d.ts +13 -0
- package/dist/entities/BillingUsageSnapshot.js +99 -0
- package/dist/entities/City.js +1 -1
- package/dist/entities/Company.d.ts +8 -1
- package/dist/entities/Company.js +28 -0
- package/dist/entities/CompanySubscription.d.ts +18 -0
- package/dist/entities/CompanySubscription.js +114 -0
- package/dist/entities/EmailLog.d.ts +14 -0
- package/dist/entities/EmailLog.js +105 -0
- package/dist/entities/MediaFile.d.ts +19 -0
- package/dist/entities/MediaFile.js +144 -0
- package/dist/entities/PaymentMethod.d.ts +18 -0
- package/dist/entities/PaymentMethod.js +123 -0
- package/dist/entities/PaymentTransaction.d.ts +15 -0
- package/dist/entities/PaymentTransaction.js +117 -0
- package/dist/entities/Region.d.ts +4 -0
- package/dist/entities/Region.js +10 -0
- package/dist/entities/ServiceOrder.d.ts +2 -0
- package/dist/entities/ServiceOrder.js +5 -0
- package/dist/entities/SubscriptionAddon.d.ts +13 -0
- package/dist/entities/SubscriptionAddon.js +103 -0
- package/dist/entities/SubscriptionAddonTemplate.d.ts +14 -0
- package/dist/entities/SubscriptionAddonTemplate.js +111 -0
- package/dist/entities/SubscriptionPlan.d.ts +18 -0
- package/dist/entities/SubscriptionPlan.js +136 -0
- package/dist/entities/UsageAlert.d.ts +14 -0
- package/dist/entities/UsageAlert.js +106 -0
- package/dist/entities/WhatsappLog.d.ts +14 -0
- package/dist/entities/WhatsappLog.js +105 -0
- package/dist/entities/Workshop.d.ts +8 -0
- package/dist/entities/Workshop.js +24 -0
- package/dist/entities.index.d.ts +12 -0
- package/dist/entities.index.js +25 -1
- package/package.json +1 -1
|
@@ -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 {
|
|
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
|
|
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);
|
package/dist/entities/City.js
CHANGED
|
@@ -29,7 +29,7 @@ __decorate([
|
|
|
29
29
|
__decorate([
|
|
30
30
|
(0, typeorm_1.ManyToOne)(() => Region_1.Region, (region) => region.cities, {
|
|
31
31
|
onDelete: "RESTRICT",
|
|
32
|
-
onUpdate: "
|
|
32
|
+
onUpdate: "NO ACTION",
|
|
33
33
|
}),
|
|
34
34
|
(0, typeorm_1.JoinColumn)({ name: "region" }),
|
|
35
35
|
__metadata("design:type", Region_1.Region)
|
|
@@ -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
|
}
|
package/dist/entities/Company.js
CHANGED
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
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.EmailLog = void 0;
|
|
13
|
+
const typeorm_1 = require("typeorm");
|
|
14
|
+
const Company_1 = require("./Company");
|
|
15
|
+
const Workshop_1 = require("./Workshop");
|
|
16
|
+
let EmailLog = class EmailLog {
|
|
17
|
+
};
|
|
18
|
+
exports.EmailLog = EmailLog;
|
|
19
|
+
__decorate([
|
|
20
|
+
(0, typeorm_1.PrimaryGeneratedColumn)({
|
|
21
|
+
type: "int",
|
|
22
|
+
comment: "ID único de cada registro.",
|
|
23
|
+
}),
|
|
24
|
+
__metadata("design:type", Number)
|
|
25
|
+
], EmailLog.prototype, "id", void 0);
|
|
26
|
+
__decorate([
|
|
27
|
+
(0, typeorm_1.ManyToOne)(() => Company_1.Company, (company) => company.email_logs, {
|
|
28
|
+
onDelete: "CASCADE",
|
|
29
|
+
onUpdate: "NO ACTION",
|
|
30
|
+
}),
|
|
31
|
+
(0, typeorm_1.JoinColumn)({ name: "company" }),
|
|
32
|
+
__metadata("design:type", Company_1.Company)
|
|
33
|
+
], EmailLog.prototype, "company", void 0);
|
|
34
|
+
__decorate([
|
|
35
|
+
(0, typeorm_1.ManyToOne)(() => Workshop_1.Workshop, (workshop) => workshop.email_logs, {
|
|
36
|
+
onDelete: "SET NULL",
|
|
37
|
+
onUpdate: "NO ACTION",
|
|
38
|
+
nullable: true,
|
|
39
|
+
}),
|
|
40
|
+
(0, typeorm_1.JoinColumn)({ name: "workshop" }),
|
|
41
|
+
__metadata("design:type", Object)
|
|
42
|
+
], EmailLog.prototype, "workshop", void 0);
|
|
43
|
+
__decorate([
|
|
44
|
+
(0, typeorm_1.Column)({
|
|
45
|
+
length: 255,
|
|
46
|
+
type: "varchar",
|
|
47
|
+
comment: "Correo destino.",
|
|
48
|
+
}),
|
|
49
|
+
__metadata("design:type", String)
|
|
50
|
+
], EmailLog.prototype, "recipient_email", void 0);
|
|
51
|
+
__decorate([
|
|
52
|
+
(0, typeorm_1.Column)({
|
|
53
|
+
length: 255,
|
|
54
|
+
type: "varchar",
|
|
55
|
+
comment: "Asunto.",
|
|
56
|
+
}),
|
|
57
|
+
__metadata("design:type", String)
|
|
58
|
+
], EmailLog.prototype, "subject", void 0);
|
|
59
|
+
__decorate([
|
|
60
|
+
(0, typeorm_1.Column)({
|
|
61
|
+
type: "int",
|
|
62
|
+
comment: "Tipo de correo que se le envía al cliente:\r\n1: Visita/Entrada/Servicio.\r\n2: Recordatorio.",
|
|
63
|
+
}),
|
|
64
|
+
__metadata("design:type", Number)
|
|
65
|
+
], EmailLog.prototype, "email_type", void 0);
|
|
66
|
+
__decorate([
|
|
67
|
+
(0, typeorm_1.Column)({
|
|
68
|
+
length: 255,
|
|
69
|
+
type: "varchar",
|
|
70
|
+
comment: "ID retornado por el proveedor.",
|
|
71
|
+
}),
|
|
72
|
+
__metadata("design:type", String)
|
|
73
|
+
], EmailLog.prototype, "provider_message_id", void 0);
|
|
74
|
+
__decorate([
|
|
75
|
+
(0, typeorm_1.Column)({
|
|
76
|
+
default: 1,
|
|
77
|
+
type: "int",
|
|
78
|
+
width: 1,
|
|
79
|
+
comment: "Estado en el que se queda el log:\r\n1: Enviado.\r\n2: Entregado.\r\n3: Abierto.\r\n4: Error.",
|
|
80
|
+
}),
|
|
81
|
+
__metadata("design:type", Number)
|
|
82
|
+
], EmailLog.prototype, "status", void 0);
|
|
83
|
+
__decorate([
|
|
84
|
+
(0, typeorm_1.Column)({
|
|
85
|
+
type: "text",
|
|
86
|
+
nullable: true,
|
|
87
|
+
default: null,
|
|
88
|
+
comment: "Error retornado por el proveedor.",
|
|
89
|
+
}),
|
|
90
|
+
__metadata("design:type", Object)
|
|
91
|
+
], EmailLog.prototype, "error_message", void 0);
|
|
92
|
+
__decorate([
|
|
93
|
+
(0, typeorm_1.Column)({
|
|
94
|
+
type: "datetime",
|
|
95
|
+
comment: "Fecha de creación del registro.",
|
|
96
|
+
default: () => "CURRENT_TIMESTAMP",
|
|
97
|
+
}),
|
|
98
|
+
__metadata("design:type", Date)
|
|
99
|
+
], EmailLog.prototype, "created", void 0);
|
|
100
|
+
exports.EmailLog = EmailLog = __decorate([
|
|
101
|
+
(0, typeorm_1.Entity)({
|
|
102
|
+
comment: "Logs de los correos electrónicos que se envían por cada concesionario/taller.",
|
|
103
|
+
name: "email_log",
|
|
104
|
+
})
|
|
105
|
+
], EmailLog);
|