@asumano/worklip-typeorm-db 1.1.98 → 1.1.100
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/company.type.rules.d.ts +10 -0
- package/dist/company.type.rules.js +39 -0
- package/dist/entities/AssociatePermission.d.ts +2 -1
- package/dist/entities/AssociatePermission.js +9 -0
- package/dist/entities/AssociateSection.d.ts +2 -1
- package/dist/entities/AssociateSection.js +9 -0
- package/dist/entities/Company.d.ts +2 -1
- package/dist/entities/Company.js +4 -0
- package/dist/entities/CompanyCompanyType.d.ts +11 -0
- package/dist/entities/CompanyCompanyType.js +67 -0
- package/dist/entities/CompanyType.d.ts +11 -0
- package/dist/entities/CompanyType.js +93 -0
- package/dist/entities/DocumentType.d.ts +12 -0
- package/dist/entities/DocumentType.js +104 -0
- package/dist/entities/Insurer.d.ts +10 -0
- package/dist/entities/Insurer.js +85 -0
- package/dist/entities/OfferedService.d.ts +10 -0
- package/dist/entities/OfferedService.js +85 -0
- package/dist/entities/PlanCompanyType.d.ts +8 -0
- package/dist/entities/PlanCompanyType.js +49 -0
- package/dist/entities/ReminderType.d.ts +3 -0
- package/dist/entities/ReminderType.js +17 -1
- package/dist/entities/ReminderTypeCompanyType.d.ts +8 -0
- package/dist/entities/ReminderTypeCompanyType.js +49 -0
- package/dist/entities/ServiceOrder.d.ts +6 -0
- package/dist/entities/ServiceOrder.js +39 -0
- package/dist/entities/ServiceOrderObservation.d.ts +18 -0
- package/dist/entities/ServiceOrderObservation.js +131 -0
- package/dist/entities/ServiceOrderPart.d.ts +21 -0
- package/dist/entities/ServiceOrderPart.js +178 -0
- package/dist/entities/SubscriptionPlan.d.ts +2 -0
- package/dist/entities/SubscriptionPlan.js +5 -0
- package/dist/entities/Template.d.ts +1 -0
- package/dist/entities/Template.js +9 -0
- package/dist/entities/VisitResult.d.ts +26 -0
- package/dist/entities/VisitResult.js +205 -0
- package/dist/entities/Workshop.d.ts +2 -0
- package/dist/entities/Workshop.js +5 -0
- package/dist/entities/WorkshopCompanyType.d.ts +11 -0
- package/dist/entities/WorkshopCompanyType.js +67 -0
- package/dist/entities/WorkshopDisplay.d.ts +14 -0
- package/dist/entities/WorkshopDisplay.js +110 -0
- package/dist/entities/WorkshopInsurer.d.ts +11 -0
- package/dist/entities/WorkshopInsurer.js +66 -0
- package/dist/entities/WorkshopOfferedService.d.ts +11 -0
- package/dist/entities/WorkshopOfferedService.js +66 -0
- package/dist/entities.index.d.ts +14 -0
- package/dist/entities.index.js +32 -2
- package/dist/index.d.ts +4 -0
- package/dist/index.js +9 -0
- package/dist/inspection.rules.d.ts +68 -0
- package/dist/inspection.rules.js +159 -0
- package/dist/offered.service.rules.d.ts +20 -0
- package/dist/offered.service.rules.js +27 -0
- package/dist/parts.rules.d.ts +37 -0
- package/dist/parts.rules.js +60 -0
- package/dist/template.settings.d.ts +3 -0
- package/dist/template.settings.js +14 -1
- package/dist/views/ServicesOrder.d.ts +10 -0
- package/dist/views/ServicesOrder.js +40 -0
- package/dist/views/Templates.d.ts +1 -0
- package/dist/views/Templates.js +4 -0
- package/dist/visit.summary.d.ts +3 -0
- package/dist/workboard.rules.d.ts +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const COMPANY_TYPE_CODE: {
|
|
2
|
+
readonly WORKSHOP: "TALLER";
|
|
3
|
+
readonly CDA: "CDA";
|
|
4
|
+
};
|
|
5
|
+
export type TCompanyTypeCode = (typeof COMPANY_TYPE_CODE)[keyof typeof COMPANY_TYPE_CODE];
|
|
6
|
+
export declare const COMPANY_TYPE_CODE_PATTERN: RegExp;
|
|
7
|
+
export declare const normalizeCompanyTypeCode: (value: unknown) => string | null;
|
|
8
|
+
export declare const planCoversCompanyTypes: (planTypeIds: readonly number[], companyTypeIds: readonly number[]) => boolean;
|
|
9
|
+
export type TWorkshopTypesError = "EMPTY" | "NOT_IN_COMPANY";
|
|
10
|
+
export declare const validateWorkshopTypes: (workshopTypeIds: readonly number[], companyTypeIds: readonly number[]) => TWorkshopTypesError | null;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// DOC: Tipos de empresa (Taller, CDA): los códigos de sistema y las reglas de qué plan se le
|
|
3
|
+
// asigna a una empresa y qué tipos atiende una sede. Las usan el panel y el API.
|
|
4
|
+
//
|
|
5
|
+
// Módulo PURO: sin TypeORM, para que los fronts lo importen por ruta profunda.
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.validateWorkshopTypes = exports.planCoversCompanyTypes = exports.normalizeCompanyTypeCode = exports.COMPANY_TYPE_CODE_PATTERN = exports.COMPANY_TYPE_CODE = void 0;
|
|
8
|
+
exports.COMPANY_TYPE_CODE = {
|
|
9
|
+
WORKSHOP: "TALLER",
|
|
10
|
+
CDA: "CDA",
|
|
11
|
+
};
|
|
12
|
+
// DOC: Tiene que poder vivir en una constante del código, como los de `feature`.
|
|
13
|
+
exports.COMPANY_TYPE_CODE_PATTERN = /^[A-Z0-9_]{2,20}$/;
|
|
14
|
+
// DOC: " cda " -> "CDA"; null si no cumple el patrón.
|
|
15
|
+
const normalizeCompanyTypeCode = (value) => {
|
|
16
|
+
const code = String(value ?? "").trim().toUpperCase();
|
|
17
|
+
return exports.COMPANY_TYPE_CODE_PATTERN.test(code) ? code : null;
|
|
18
|
+
};
|
|
19
|
+
exports.normalizeCompanyTypeCode = normalizeCompanyTypeCode;
|
|
20
|
+
const uniqueIds = (ids) => [...new Set(ids.map(Number))];
|
|
21
|
+
// DOC: Un plan sirve si cubre TODOS los tipos de la empresa: la suscripción es una sola, así
|
|
22
|
+
// que una empresa Taller + CDA necesita un plan que traiga los dos.
|
|
23
|
+
const planCoversCompanyTypes = (planTypeIds, companyTypeIds) => {
|
|
24
|
+
const company = uniqueIds(companyTypeIds);
|
|
25
|
+
if (company.length === 0)
|
|
26
|
+
return false;
|
|
27
|
+
const plan = new Set(uniqueIds(planTypeIds));
|
|
28
|
+
return company.every((id) => plan.has(id));
|
|
29
|
+
};
|
|
30
|
+
exports.planCoversCompanyTypes = planCoversCompanyTypes;
|
|
31
|
+
// DOC: La sede atiende al menos un tipo, y solo de los de su empresa.
|
|
32
|
+
const validateWorkshopTypes = (workshopTypeIds, companyTypeIds) => {
|
|
33
|
+
const workshop = uniqueIds(workshopTypeIds);
|
|
34
|
+
if (workshop.length === 0)
|
|
35
|
+
return "EMPTY";
|
|
36
|
+
const company = new Set(uniqueIds(companyTypeIds));
|
|
37
|
+
return workshop.every((id) => company.has(id)) ? null : "NOT_IN_COMPANY";
|
|
38
|
+
};
|
|
39
|
+
exports.validateWorkshopTypes = validateWorkshopTypes;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Associate, AssociateRole, AssociateSection, Feature } from "../entities.views.routes";
|
|
1
|
+
import { Associate, AssociateRole, AssociateSection, CompanyType, Feature } from "../entities.views.routes";
|
|
2
2
|
export declare class AssociatePermission {
|
|
3
3
|
id: number;
|
|
4
4
|
section: AssociateSection;
|
|
@@ -9,5 +9,6 @@ export declare class AssociatePermission {
|
|
|
9
9
|
status: number;
|
|
10
10
|
roles: AssociateRole[];
|
|
11
11
|
feature: Feature | null;
|
|
12
|
+
company_type: CompanyType | null;
|
|
12
13
|
associates: Associate[];
|
|
13
14
|
}
|
|
@@ -94,6 +94,15 @@ __decorate([
|
|
|
94
94
|
(0, typeorm_1.JoinColumn)({ name: "feature" }),
|
|
95
95
|
__metadata("design:type", Object)
|
|
96
96
|
], AssociatePermission.prototype, "feature", void 0);
|
|
97
|
+
__decorate([
|
|
98
|
+
(0, typeorm_1.ManyToOne)(() => entities_views_routes_1.CompanyType, {
|
|
99
|
+
onDelete: "SET NULL",
|
|
100
|
+
onUpdate: "NO ACTION",
|
|
101
|
+
nullable: true,
|
|
102
|
+
}),
|
|
103
|
+
(0, typeorm_1.JoinColumn)({ name: "company_type" }),
|
|
104
|
+
__metadata("design:type", Object)
|
|
105
|
+
], AssociatePermission.prototype, "company_type", void 0);
|
|
97
106
|
__decorate([
|
|
98
107
|
(0, typeorm_1.ManyToMany)(() => entities_views_routes_1.Associate, (associate) => associate.permissions),
|
|
99
108
|
__metadata("design:type", Array)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AssociatePermission, AssociatePlatform, Feature } from "../entities.views.routes";
|
|
1
|
+
import { AssociatePermission, AssociatePlatform, CompanyType, Feature } from "../entities.views.routes";
|
|
2
2
|
export declare class AssociateSection {
|
|
3
3
|
id: number;
|
|
4
4
|
name: string;
|
|
@@ -7,5 +7,6 @@ export declare class AssociateSection {
|
|
|
7
7
|
status: number;
|
|
8
8
|
platforms: AssociatePlatform[];
|
|
9
9
|
feature: Feature | null;
|
|
10
|
+
company_type: CompanyType | null;
|
|
10
11
|
permissions: AssociatePermission[];
|
|
11
12
|
}
|
|
@@ -67,6 +67,15 @@ __decorate([
|
|
|
67
67
|
(0, typeorm_1.JoinColumn)({ name: "feature" }),
|
|
68
68
|
__metadata("design:type", Object)
|
|
69
69
|
], AssociateSection.prototype, "feature", void 0);
|
|
70
|
+
__decorate([
|
|
71
|
+
(0, typeorm_1.ManyToOne)(() => entities_views_routes_1.CompanyType, {
|
|
72
|
+
onDelete: "SET NULL",
|
|
73
|
+
onUpdate: "NO ACTION",
|
|
74
|
+
nullable: true,
|
|
75
|
+
}),
|
|
76
|
+
(0, typeorm_1.JoinColumn)({ name: "company_type" }),
|
|
77
|
+
__metadata("design:type", Object)
|
|
78
|
+
], AssociateSection.prototype, "company_type", void 0);
|
|
70
79
|
__decorate([
|
|
71
80
|
(0, typeorm_1.OneToMany)(() => entities_views_routes_1.AssociatePermission, (permission) => permission.section),
|
|
72
81
|
__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 { BillingInvoice, BillingUsageSnapshot, CompanyBrand, CompanySubscription, CompanyVehicleType, Country, EmailLog, MediaFile, PaymentMethod, ServiceOrderApproval, UsageAlert, WhatsappLog } from "..";
|
|
5
|
+
import { BillingInvoice, BillingUsageSnapshot, CompanyBrand, CompanyCompanyType, CompanySubscription, CompanyVehicleType, Country, EmailLog, MediaFile, PaymentMethod, ServiceOrderApproval, UsageAlert, WhatsappLog } from "..";
|
|
6
6
|
export declare class Company {
|
|
7
7
|
id: number;
|
|
8
8
|
country: Country;
|
|
@@ -29,4 +29,5 @@ export declare class Company {
|
|
|
29
29
|
billing_invoices: BillingInvoice[];
|
|
30
30
|
usage_alerts: UsageAlert[];
|
|
31
31
|
company_subscriptions: CompanySubscription[];
|
|
32
|
+
company_types: CompanyCompanyType[];
|
|
32
33
|
}
|
package/dist/entities/Company.js
CHANGED
|
@@ -166,6 +166,10 @@ __decorate([
|
|
|
166
166
|
(0, typeorm_1.OneToMany)(() => __1.CompanySubscription, (companySubscription) => companySubscription.company),
|
|
167
167
|
__metadata("design:type", Array)
|
|
168
168
|
], Company.prototype, "company_subscriptions", void 0);
|
|
169
|
+
__decorate([
|
|
170
|
+
(0, typeorm_1.OneToMany)(() => __1.CompanyCompanyType, (row) => row.company),
|
|
171
|
+
__metadata("design:type", Array)
|
|
172
|
+
], Company.prototype, "company_types", void 0);
|
|
169
173
|
exports.Company = Company = __decorate([
|
|
170
174
|
(0, typeorm_1.Entity)({ comment: "Empresas registradas en la plataforma." })
|
|
171
175
|
// DOC: Dos empresas no pueden compartir documento fiscal. UNIQUE en MySQL admite varios
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Company } from "./Company";
|
|
2
|
+
import { CompanyType } from "./CompanyType";
|
|
3
|
+
import { Master } from "./Master";
|
|
4
|
+
export declare class CompanyCompanyType {
|
|
5
|
+
company_id: number;
|
|
6
|
+
company_type_id: number;
|
|
7
|
+
company: Company;
|
|
8
|
+
company_type: CompanyType;
|
|
9
|
+
created: Date;
|
|
10
|
+
created_by: Master | null;
|
|
11
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
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.CompanyCompanyType = void 0;
|
|
13
|
+
const typeorm_1 = require("typeorm");
|
|
14
|
+
const Company_1 = require("./Company");
|
|
15
|
+
const CompanyType_1 = require("./CompanyType");
|
|
16
|
+
const Master_1 = require("./Master");
|
|
17
|
+
// DOC: Los tipos de la empresa. Solo los asigna el PANEL; las sedes escogen entre estos
|
|
18
|
+
// (`workshop_company_type`).
|
|
19
|
+
let CompanyCompanyType = class CompanyCompanyType {
|
|
20
|
+
};
|
|
21
|
+
exports.CompanyCompanyType = CompanyCompanyType;
|
|
22
|
+
__decorate([
|
|
23
|
+
(0, typeorm_1.PrimaryColumn)({ type: "int", name: "company" }),
|
|
24
|
+
__metadata("design:type", Number)
|
|
25
|
+
], CompanyCompanyType.prototype, "company_id", void 0);
|
|
26
|
+
__decorate([
|
|
27
|
+
(0, typeorm_1.PrimaryColumn)({ type: "int", name: "company_type" }),
|
|
28
|
+
__metadata("design:type", Number)
|
|
29
|
+
], CompanyCompanyType.prototype, "company_type_id", void 0);
|
|
30
|
+
__decorate([
|
|
31
|
+
(0, typeorm_1.ManyToOne)(() => Company_1.Company, (company) => company.company_types, {
|
|
32
|
+
onDelete: "CASCADE",
|
|
33
|
+
onUpdate: "NO ACTION",
|
|
34
|
+
}),
|
|
35
|
+
(0, typeorm_1.JoinColumn)({ name: "company" }),
|
|
36
|
+
__metadata("design:type", Company_1.Company)
|
|
37
|
+
], CompanyCompanyType.prototype, "company", void 0);
|
|
38
|
+
__decorate([
|
|
39
|
+
(0, typeorm_1.ManyToOne)(() => CompanyType_1.CompanyType, {
|
|
40
|
+
onDelete: "RESTRICT",
|
|
41
|
+
onUpdate: "NO ACTION",
|
|
42
|
+
}),
|
|
43
|
+
(0, typeorm_1.JoinColumn)({ name: "company_type" }),
|
|
44
|
+
__metadata("design:type", CompanyType_1.CompanyType)
|
|
45
|
+
], CompanyCompanyType.prototype, "company_type", void 0);
|
|
46
|
+
__decorate([
|
|
47
|
+
(0, typeorm_1.Column)({
|
|
48
|
+
type: "datetime",
|
|
49
|
+
comment: "Fecha en que se le asignó el tipo.",
|
|
50
|
+
default: () => "CURRENT_TIMESTAMP",
|
|
51
|
+
}),
|
|
52
|
+
__metadata("design:type", Date)
|
|
53
|
+
], CompanyCompanyType.prototype, "created", void 0);
|
|
54
|
+
__decorate([
|
|
55
|
+
(0, typeorm_1.ManyToOne)(() => Master_1.Master, {
|
|
56
|
+
onDelete: "RESTRICT",
|
|
57
|
+
onUpdate: "NO ACTION",
|
|
58
|
+
nullable: true,
|
|
59
|
+
}),
|
|
60
|
+
(0, typeorm_1.JoinColumn)({ name: "created_by" }),
|
|
61
|
+
__metadata("design:type", Object)
|
|
62
|
+
], CompanyCompanyType.prototype, "created_by", void 0);
|
|
63
|
+
exports.CompanyCompanyType = CompanyCompanyType = __decorate([
|
|
64
|
+
(0, typeorm_1.Entity)("company_company_type", {
|
|
65
|
+
comment: "Tipos que tiene cada empresa. Solo los asigna el panel.",
|
|
66
|
+
})
|
|
67
|
+
], CompanyCompanyType);
|
|
@@ -0,0 +1,93 @@
|
|
|
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.CompanyType = void 0;
|
|
13
|
+
const typeorm_1 = require("typeorm");
|
|
14
|
+
const Master_1 = require("./Master");
|
|
15
|
+
// DOC: Qué es la empresa (Taller, CDA...). Decide el COMPORTAMIENTO y el menú; lo que se paga
|
|
16
|
+
// aparte sigue siendo `feature`. Ver `company.type.rules.ts`.
|
|
17
|
+
let CompanyType = class CompanyType {
|
|
18
|
+
};
|
|
19
|
+
exports.CompanyType = CompanyType;
|
|
20
|
+
__decorate([
|
|
21
|
+
(0, typeorm_1.PrimaryGeneratedColumn)({
|
|
22
|
+
type: "int",
|
|
23
|
+
comment: "Número de identificación (ID) único de cada registro.",
|
|
24
|
+
}),
|
|
25
|
+
__metadata("design:type", Number)
|
|
26
|
+
], CompanyType.prototype, "id", void 0);
|
|
27
|
+
__decorate([
|
|
28
|
+
(0, typeorm_1.Column)({
|
|
29
|
+
type: "varchar",
|
|
30
|
+
length: 20,
|
|
31
|
+
unique: true,
|
|
32
|
+
comment: "Código único en MAYÚSCULAS (TALLER, CDA). Es la llave que usa el código.",
|
|
33
|
+
}),
|
|
34
|
+
__metadata("design:type", String)
|
|
35
|
+
], CompanyType.prototype, "code", void 0);
|
|
36
|
+
__decorate([
|
|
37
|
+
(0, typeorm_1.Column)({
|
|
38
|
+
type: "varchar",
|
|
39
|
+
length: 60,
|
|
40
|
+
comment: "Nombre que se muestra: Centro de diagnóstico automotor.",
|
|
41
|
+
}),
|
|
42
|
+
__metadata("design:type", String)
|
|
43
|
+
], CompanyType.prototype, "name", void 0);
|
|
44
|
+
__decorate([
|
|
45
|
+
(0, typeorm_1.Column)({
|
|
46
|
+
type: "json",
|
|
47
|
+
nullable: true,
|
|
48
|
+
default: null,
|
|
49
|
+
comment: "Campo de tipo JSON para guardar la información que se necesite.",
|
|
50
|
+
}),
|
|
51
|
+
__metadata("design:type", Object)
|
|
52
|
+
], CompanyType.prototype, "details", void 0);
|
|
53
|
+
__decorate([
|
|
54
|
+
(0, typeorm_1.Column)({
|
|
55
|
+
default: 1,
|
|
56
|
+
type: "int",
|
|
57
|
+
width: 1,
|
|
58
|
+
comment: "Estado:\r\n1. Activo: se puede asignar.\r\n0. Inactivo: ya no se asigna (las empresas que lo tienen lo conservan).",
|
|
59
|
+
}),
|
|
60
|
+
__metadata("design:type", Number)
|
|
61
|
+
], CompanyType.prototype, "status", void 0);
|
|
62
|
+
__decorate([
|
|
63
|
+
(0, typeorm_1.Column)({
|
|
64
|
+
type: "datetime",
|
|
65
|
+
comment: "Fecha de creación del registro.",
|
|
66
|
+
default: () => "CURRENT_TIMESTAMP",
|
|
67
|
+
}),
|
|
68
|
+
__metadata("design:type", Date)
|
|
69
|
+
], CompanyType.prototype, "created", void 0);
|
|
70
|
+
__decorate([
|
|
71
|
+
(0, typeorm_1.ManyToOne)(() => Master_1.Master, {
|
|
72
|
+
onDelete: "RESTRICT",
|
|
73
|
+
onUpdate: "NO ACTION",
|
|
74
|
+
nullable: true,
|
|
75
|
+
}),
|
|
76
|
+
(0, typeorm_1.JoinColumn)({ name: "created_by" }),
|
|
77
|
+
__metadata("design:type", Object)
|
|
78
|
+
], CompanyType.prototype, "created_by", void 0);
|
|
79
|
+
__decorate([
|
|
80
|
+
(0, typeorm_1.Column)({
|
|
81
|
+
type: "datetime",
|
|
82
|
+
nullable: true,
|
|
83
|
+
default: null,
|
|
84
|
+
comment: "Fecha de actualización del registro.",
|
|
85
|
+
onUpdate: "CURRENT_TIMESTAMP",
|
|
86
|
+
}),
|
|
87
|
+
__metadata("design:type", Object)
|
|
88
|
+
], CompanyType.prototype, "updated", void 0);
|
|
89
|
+
exports.CompanyType = CompanyType = __decorate([
|
|
90
|
+
(0, typeorm_1.Entity)("company_type", {
|
|
91
|
+
comment: "Tipos de empresa: taller, CDA... Una empresa puede tener varios.",
|
|
92
|
+
})
|
|
93
|
+
], CompanyType);
|
|
@@ -0,0 +1,104 @@
|
|
|
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.DocumentType = void 0;
|
|
13
|
+
const typeorm_1 = require("typeorm");
|
|
14
|
+
const Country_1 = require("./Country");
|
|
15
|
+
// DOC: Los tipos de documento de las PERSONAS (clientes) por país: cédula, pasaporte, NIT...
|
|
16
|
+
// De acá sacan la lista partners, la agenda pública y la app del cliente, y el API valida
|
|
17
|
+
// contra ella. `code` es lo que se guarda en `client.document_type`.
|
|
18
|
+
// No confundir con `country.details.legal_profile.document_types`: esos son los de la
|
|
19
|
+
// EMPRESA para sus datos legales y usan otros códigos.
|
|
20
|
+
let DocumentType = class DocumentType {
|
|
21
|
+
};
|
|
22
|
+
exports.DocumentType = DocumentType;
|
|
23
|
+
__decorate([
|
|
24
|
+
(0, typeorm_1.PrimaryGeneratedColumn)({
|
|
25
|
+
type: "int",
|
|
26
|
+
comment: "Número de identificación (ID) único de cada registro.",
|
|
27
|
+
}),
|
|
28
|
+
__metadata("design:type", Number)
|
|
29
|
+
], DocumentType.prototype, "id", void 0);
|
|
30
|
+
__decorate([
|
|
31
|
+
(0, typeorm_1.ManyToOne)(() => Country_1.Country, {
|
|
32
|
+
onDelete: "RESTRICT",
|
|
33
|
+
onUpdate: "NO ACTION",
|
|
34
|
+
}),
|
|
35
|
+
(0, typeorm_1.JoinColumn)({ name: "country" }),
|
|
36
|
+
__metadata("design:type", Country_1.Country)
|
|
37
|
+
], DocumentType.prototype, "country", void 0);
|
|
38
|
+
__decorate([
|
|
39
|
+
(0, typeorm_1.Column)({
|
|
40
|
+
type: "varchar",
|
|
41
|
+
length: 10,
|
|
42
|
+
comment: "Código que se guarda en client.document_type (C.C, NIT, PASAPORTE...).",
|
|
43
|
+
}),
|
|
44
|
+
__metadata("design:type", String)
|
|
45
|
+
], DocumentType.prototype, "code", void 0);
|
|
46
|
+
__decorate([
|
|
47
|
+
(0, typeorm_1.Column)({
|
|
48
|
+
type: "varchar",
|
|
49
|
+
length: 60,
|
|
50
|
+
comment: "Nombre que se muestra: Cédula de ciudadanía.",
|
|
51
|
+
}),
|
|
52
|
+
__metadata("design:type", String)
|
|
53
|
+
], DocumentType.prototype, "name", void 0);
|
|
54
|
+
__decorate([
|
|
55
|
+
(0, typeorm_1.Column)({
|
|
56
|
+
type: "varchar",
|
|
57
|
+
length: 100,
|
|
58
|
+
nullable: true,
|
|
59
|
+
default: null,
|
|
60
|
+
comment: "Expresión regular que debe cumplir el número. NULL = sin validación de formato.",
|
|
61
|
+
}),
|
|
62
|
+
__metadata("design:type", Object)
|
|
63
|
+
], DocumentType.prototype, "regex", void 0);
|
|
64
|
+
__decorate([
|
|
65
|
+
(0, typeorm_1.Column)({
|
|
66
|
+
type: "json",
|
|
67
|
+
nullable: true,
|
|
68
|
+
default: null,
|
|
69
|
+
comment: "Campo de tipo JSON para guardar la información que se necesite.",
|
|
70
|
+
}),
|
|
71
|
+
__metadata("design:type", Object)
|
|
72
|
+
], DocumentType.prototype, "details", void 0);
|
|
73
|
+
__decorate([
|
|
74
|
+
(0, typeorm_1.Column)({
|
|
75
|
+
type: "datetime",
|
|
76
|
+
comment: "Fecha de creación del registro.",
|
|
77
|
+
default: () => "CURRENT_TIMESTAMP",
|
|
78
|
+
}),
|
|
79
|
+
__metadata("design:type", Date)
|
|
80
|
+
], DocumentType.prototype, "created", void 0);
|
|
81
|
+
__decorate([
|
|
82
|
+
(0, typeorm_1.Column)({
|
|
83
|
+
type: "datetime",
|
|
84
|
+
nullable: true,
|
|
85
|
+
default: null,
|
|
86
|
+
comment: "Fecha de actualización del registro.",
|
|
87
|
+
}),
|
|
88
|
+
__metadata("design:type", Object)
|
|
89
|
+
], DocumentType.prototype, "updated", void 0);
|
|
90
|
+
__decorate([
|
|
91
|
+
(0, typeorm_1.Column)({
|
|
92
|
+
default: 1,
|
|
93
|
+
type: "int",
|
|
94
|
+
width: 1,
|
|
95
|
+
comment: "Estado:\r\n1. Activo: se ofrece al crear clientes.\r\n0. Inactivo: ya no se ofrece (los clientes que lo tienen lo conservan).",
|
|
96
|
+
}),
|
|
97
|
+
__metadata("design:type", Number)
|
|
98
|
+
], DocumentType.prototype, "status", void 0);
|
|
99
|
+
exports.DocumentType = DocumentType = __decorate([
|
|
100
|
+
(0, typeorm_1.Entity)("document_type", {
|
|
101
|
+
comment: "Tipos de documento de los clientes por país.",
|
|
102
|
+
}),
|
|
103
|
+
(0, typeorm_1.Unique)("unique_country_code", ["country", "code"])
|
|
104
|
+
], DocumentType);
|
|
@@ -0,0 +1,85 @@
|
|
|
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.Insurer = void 0;
|
|
13
|
+
const typeorm_1 = require("typeorm");
|
|
14
|
+
const Country_1 = require("./Country");
|
|
15
|
+
// DOC: Catálogo de ASEGURADORAS por país. Solo lo arma el panel; la sede escoge con cuáles tiene
|
|
16
|
+
// convenio y la visita puede llevar una (con su número de siniestro).
|
|
17
|
+
let Insurer = class Insurer {
|
|
18
|
+
};
|
|
19
|
+
exports.Insurer = Insurer;
|
|
20
|
+
__decorate([
|
|
21
|
+
(0, typeorm_1.PrimaryGeneratedColumn)({
|
|
22
|
+
type: "int",
|
|
23
|
+
comment: "Número de identificación (ID) único de cada registro.",
|
|
24
|
+
}),
|
|
25
|
+
__metadata("design:type", Number)
|
|
26
|
+
], Insurer.prototype, "id", void 0);
|
|
27
|
+
__decorate([
|
|
28
|
+
(0, typeorm_1.ManyToOne)(() => Country_1.Country, {
|
|
29
|
+
onDelete: "RESTRICT",
|
|
30
|
+
onUpdate: "NO ACTION",
|
|
31
|
+
}),
|
|
32
|
+
(0, typeorm_1.JoinColumn)({ name: "country" }),
|
|
33
|
+
__metadata("design:type", Country_1.Country)
|
|
34
|
+
], Insurer.prototype, "country", void 0);
|
|
35
|
+
__decorate([
|
|
36
|
+
(0, typeorm_1.Column)({
|
|
37
|
+
type: "varchar",
|
|
38
|
+
length: 80,
|
|
39
|
+
comment: "Nombre de la aseguradora. Lo ve el cliente.",
|
|
40
|
+
}),
|
|
41
|
+
__metadata("design:type", String)
|
|
42
|
+
], Insurer.prototype, "name", void 0);
|
|
43
|
+
__decorate([
|
|
44
|
+
(0, typeorm_1.Column)({
|
|
45
|
+
type: "json",
|
|
46
|
+
nullable: true,
|
|
47
|
+
default: null,
|
|
48
|
+
comment: "JSON: color (#RRGGBB).",
|
|
49
|
+
}),
|
|
50
|
+
__metadata("design:type", Object)
|
|
51
|
+
], Insurer.prototype, "details", void 0);
|
|
52
|
+
__decorate([
|
|
53
|
+
(0, typeorm_1.Column)({
|
|
54
|
+
type: "datetime",
|
|
55
|
+
comment: "Fecha de creación del registro.",
|
|
56
|
+
default: () => "CURRENT_TIMESTAMP",
|
|
57
|
+
}),
|
|
58
|
+
__metadata("design:type", Date)
|
|
59
|
+
], Insurer.prototype, "created", void 0);
|
|
60
|
+
__decorate([
|
|
61
|
+
(0, typeorm_1.Column)({
|
|
62
|
+
type: "datetime",
|
|
63
|
+
nullable: true,
|
|
64
|
+
default: null,
|
|
65
|
+
comment: "Fecha de actualización del registro.",
|
|
66
|
+
onUpdate: "CURRENT_TIMESTAMP",
|
|
67
|
+
}),
|
|
68
|
+
__metadata("design:type", Object)
|
|
69
|
+
], Insurer.prototype, "updated", void 0);
|
|
70
|
+
__decorate([
|
|
71
|
+
(0, typeorm_1.Column)({
|
|
72
|
+
default: 1,
|
|
73
|
+
type: "int",
|
|
74
|
+
width: 1,
|
|
75
|
+
comment: "Estado:\r\n1. Activo.\r\n0. Inactivo: no se ofrece en las sedes.",
|
|
76
|
+
}),
|
|
77
|
+
__metadata("design:type", Number)
|
|
78
|
+
], Insurer.prototype, "status", void 0);
|
|
79
|
+
exports.Insurer = Insurer = __decorate([
|
|
80
|
+
(0, typeorm_1.Unique)("unique_insurer_country_name", ["country", "name"]),
|
|
81
|
+
(0, typeorm_1.Index)("IDX_insurer_country", ["country", "status"]),
|
|
82
|
+
(0, typeorm_1.Entity)("insurer", {
|
|
83
|
+
comment: "Catálogo de aseguradoras, por país.",
|
|
84
|
+
})
|
|
85
|
+
], Insurer);
|
|
@@ -0,0 +1,85 @@
|
|
|
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.OfferedService = void 0;
|
|
13
|
+
const typeorm_1 = require("typeorm");
|
|
14
|
+
const Country_1 = require("./Country");
|
|
15
|
+
// DOC: Catálogo de SERVICIOS que puede ofrecer una sede (latonería, llantas, aseguradoras...), por
|
|
16
|
+
// país. Solo lo arma el panel; la sede escoge. `details.insurers = true` habilita las aseguradoras.
|
|
17
|
+
let OfferedService = class OfferedService {
|
|
18
|
+
};
|
|
19
|
+
exports.OfferedService = OfferedService;
|
|
20
|
+
__decorate([
|
|
21
|
+
(0, typeorm_1.PrimaryGeneratedColumn)({
|
|
22
|
+
type: "int",
|
|
23
|
+
comment: "Número de identificación (ID) único de cada registro.",
|
|
24
|
+
}),
|
|
25
|
+
__metadata("design:type", Number)
|
|
26
|
+
], OfferedService.prototype, "id", void 0);
|
|
27
|
+
__decorate([
|
|
28
|
+
(0, typeorm_1.ManyToOne)(() => Country_1.Country, {
|
|
29
|
+
onDelete: "RESTRICT",
|
|
30
|
+
onUpdate: "NO ACTION",
|
|
31
|
+
}),
|
|
32
|
+
(0, typeorm_1.JoinColumn)({ name: "country" }),
|
|
33
|
+
__metadata("design:type", Country_1.Country)
|
|
34
|
+
], OfferedService.prototype, "country", void 0);
|
|
35
|
+
__decorate([
|
|
36
|
+
(0, typeorm_1.Column)({
|
|
37
|
+
type: "varchar",
|
|
38
|
+
length: 60,
|
|
39
|
+
comment: "Nombre del servicio. Lo ve el cliente.",
|
|
40
|
+
}),
|
|
41
|
+
__metadata("design:type", String)
|
|
42
|
+
], OfferedService.prototype, "name", void 0);
|
|
43
|
+
__decorate([
|
|
44
|
+
(0, typeorm_1.Column)({
|
|
45
|
+
type: "json",
|
|
46
|
+
nullable: true,
|
|
47
|
+
default: null,
|
|
48
|
+
comment: "JSON: color (#RRGGBB) e insurers (true = habilita escoger aseguradoras con convenio).",
|
|
49
|
+
}),
|
|
50
|
+
__metadata("design:type", Object)
|
|
51
|
+
], OfferedService.prototype, "details", void 0);
|
|
52
|
+
__decorate([
|
|
53
|
+
(0, typeorm_1.Column)({
|
|
54
|
+
type: "datetime",
|
|
55
|
+
comment: "Fecha de creación del registro.",
|
|
56
|
+
default: () => "CURRENT_TIMESTAMP",
|
|
57
|
+
}),
|
|
58
|
+
__metadata("design:type", Date)
|
|
59
|
+
], OfferedService.prototype, "created", void 0);
|
|
60
|
+
__decorate([
|
|
61
|
+
(0, typeorm_1.Column)({
|
|
62
|
+
type: "datetime",
|
|
63
|
+
nullable: true,
|
|
64
|
+
default: null,
|
|
65
|
+
comment: "Fecha de actualización del registro.",
|
|
66
|
+
onUpdate: "CURRENT_TIMESTAMP",
|
|
67
|
+
}),
|
|
68
|
+
__metadata("design:type", Object)
|
|
69
|
+
], OfferedService.prototype, "updated", void 0);
|
|
70
|
+
__decorate([
|
|
71
|
+
(0, typeorm_1.Column)({
|
|
72
|
+
default: 1,
|
|
73
|
+
type: "int",
|
|
74
|
+
width: 1,
|
|
75
|
+
comment: "Estado:\r\n1. Activo.\r\n0. Inactivo: no se ofrece en las sedes.",
|
|
76
|
+
}),
|
|
77
|
+
__metadata("design:type", Number)
|
|
78
|
+
], OfferedService.prototype, "status", void 0);
|
|
79
|
+
exports.OfferedService = OfferedService = __decorate([
|
|
80
|
+
(0, typeorm_1.Unique)("unique_offered_service_country_name", ["country", "name"]),
|
|
81
|
+
(0, typeorm_1.Index)("IDX_offered_service_country", ["country", "status"]),
|
|
82
|
+
(0, typeorm_1.Entity)("offered_service", {
|
|
83
|
+
comment: "Catálogo de servicios que ofrecen las sedes, por país.",
|
|
84
|
+
})
|
|
85
|
+
], OfferedService);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { SubscriptionPlan } from "./SubscriptionPlan";
|
|
2
|
+
import { CompanyType } from "./CompanyType";
|
|
3
|
+
export declare class PlanCompanyType {
|
|
4
|
+
subscription_plan_id: number;
|
|
5
|
+
company_type_id: number;
|
|
6
|
+
subscription_plan: SubscriptionPlan;
|
|
7
|
+
company_type: CompanyType;
|
|
8
|
+
}
|