@asumano/worklip-typeorm-db 1.1.99 → 1.1.101
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/booking.rules.d.ts +1 -0
- package/dist/booking.rules.js +2 -0
- 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/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 +13 -0
- package/dist/entities.index.js +29 -1
- package/dist/index.d.ts +5 -0
- package/dist/index.js +10 -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/vehicle.type.icons.d.ts +151 -0
- package/dist/vehicle.type.icons.js +56 -0
- package/dist/vehicle.type.rules.d.ts +1 -0
- 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
package/dist/booking.rules.d.ts
CHANGED
|
@@ -47,6 +47,7 @@ export declare const APPOINTMENT_SOURCE: {
|
|
|
47
47
|
readonly WEB: 2;
|
|
48
48
|
readonly WORKSHOP: 3;
|
|
49
49
|
readonly EMAIL: 4;
|
|
50
|
+
readonly APP: 5;
|
|
50
51
|
};
|
|
51
52
|
export type TAppointmentSource = (typeof APPOINTMENT_SOURCE)[keyof typeof APPOINTMENT_SOURCE];
|
|
52
53
|
export interface IWorkshopBooking {
|
package/dist/booking.rules.js
CHANGED
|
@@ -71,6 +71,8 @@ exports.APPOINTMENT_SOURCE = {
|
|
|
71
71
|
// DOC: Entró por el botón del correo del recordatorio. Va aparte de WEB para poder medir
|
|
72
72
|
// si ese botón vale lo que costó.
|
|
73
73
|
EMAIL: 4,
|
|
74
|
+
// DOC: La agendó el cliente desde la app móvil.
|
|
75
|
+
APP: 5,
|
|
74
76
|
};
|
|
75
77
|
// DOC: Ocho carros al día, cuatro por franja, con un día de anticipación y un mes de horizonte.
|
|
76
78
|
// Es un punto de partida razonable para un taller mediano; nada lo aplica solo.
|
|
@@ -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,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
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
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.PlanCompanyType = void 0;
|
|
13
|
+
const typeorm_1 = require("typeorm");
|
|
14
|
+
const SubscriptionPlan_1 = require("./SubscriptionPlan");
|
|
15
|
+
const CompanyType_1 = require("./CompanyType");
|
|
16
|
+
// DOC: A qué tipos de empresa se le ofrece el plan. A una empresa solo se le asigna uno que
|
|
17
|
+
// cubra TODOS sus tipos (`planCoversCompanyTypes`): la suscripción sigue siendo una sola.
|
|
18
|
+
let PlanCompanyType = class PlanCompanyType {
|
|
19
|
+
};
|
|
20
|
+
exports.PlanCompanyType = PlanCompanyType;
|
|
21
|
+
__decorate([
|
|
22
|
+
(0, typeorm_1.PrimaryColumn)({ type: "int", name: "subscription_plan" }),
|
|
23
|
+
__metadata("design:type", Number)
|
|
24
|
+
], PlanCompanyType.prototype, "subscription_plan_id", void 0);
|
|
25
|
+
__decorate([
|
|
26
|
+
(0, typeorm_1.PrimaryColumn)({ type: "int", name: "company_type" }),
|
|
27
|
+
__metadata("design:type", Number)
|
|
28
|
+
], PlanCompanyType.prototype, "company_type_id", void 0);
|
|
29
|
+
__decorate([
|
|
30
|
+
(0, typeorm_1.ManyToOne)(() => SubscriptionPlan_1.SubscriptionPlan, (plan) => plan.plan_company_types, {
|
|
31
|
+
onDelete: "CASCADE",
|
|
32
|
+
onUpdate: "NO ACTION",
|
|
33
|
+
}),
|
|
34
|
+
(0, typeorm_1.JoinColumn)({ name: "subscription_plan" }),
|
|
35
|
+
__metadata("design:type", SubscriptionPlan_1.SubscriptionPlan)
|
|
36
|
+
], PlanCompanyType.prototype, "subscription_plan", void 0);
|
|
37
|
+
__decorate([
|
|
38
|
+
(0, typeorm_1.ManyToOne)(() => CompanyType_1.CompanyType, {
|
|
39
|
+
onDelete: "RESTRICT",
|
|
40
|
+
onUpdate: "NO ACTION",
|
|
41
|
+
}),
|
|
42
|
+
(0, typeorm_1.JoinColumn)({ name: "company_type" }),
|
|
43
|
+
__metadata("design:type", CompanyType_1.CompanyType)
|
|
44
|
+
], PlanCompanyType.prototype, "company_type", void 0);
|
|
45
|
+
exports.PlanCompanyType = PlanCompanyType = __decorate([
|
|
46
|
+
(0, typeorm_1.Entity)("plan_company_type", {
|
|
47
|
+
comment: "Tipos de empresa a los que se ofrece cada plan.",
|
|
48
|
+
})
|
|
49
|
+
], PlanCompanyType);
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { Country } from "./Country";
|
|
2
2
|
import { VehicleType } from "./VehicleType";
|
|
3
|
+
import { ReminderTypeCompanyType } from "./ReminderTypeCompanyType";
|
|
3
4
|
export declare class ReminderType {
|
|
4
5
|
id: number;
|
|
5
6
|
country: Country;
|
|
6
7
|
vehicle_type: VehicleType;
|
|
7
8
|
name: string;
|
|
9
|
+
code: string | null;
|
|
8
10
|
category: number;
|
|
9
11
|
scope: number;
|
|
10
12
|
position: number;
|
|
@@ -12,4 +14,5 @@ export declare class ReminderType {
|
|
|
12
14
|
created: Date;
|
|
13
15
|
updated: Date | null;
|
|
14
16
|
status: number;
|
|
17
|
+
company_types: ReminderTypeCompanyType[];
|
|
15
18
|
}
|
|
@@ -13,6 +13,7 @@ exports.ReminderType = void 0;
|
|
|
13
13
|
const typeorm_1 = require("typeorm");
|
|
14
14
|
const Country_1 = require("./Country");
|
|
15
15
|
const VehicleType_1 = require("./VehicleType");
|
|
16
|
+
const ReminderTypeCompanyType_1 = require("./ReminderTypeCompanyType");
|
|
16
17
|
// DOC: El catálogo de recordatorios que ofrece Worklip (SOAT, tecnomecánica, cambio de aceite).
|
|
17
18
|
// Es por PAÍS y TIPO DE VEHÍCULO porque los vencimientos cambian de uno a otro; lo
|
|
18
19
|
// administra el panel. Ver `reminder.rules.ts`.
|
|
@@ -50,6 +51,16 @@ __decorate([
|
|
|
50
51
|
}),
|
|
51
52
|
__metadata("design:type", String)
|
|
52
53
|
], ReminderType.prototype, "name", void 0);
|
|
54
|
+
__decorate([
|
|
55
|
+
(0, typeorm_1.Column)({
|
|
56
|
+
type: "varchar",
|
|
57
|
+
length: 30,
|
|
58
|
+
nullable: true,
|
|
59
|
+
default: null,
|
|
60
|
+
comment: "Código de sistema de la opción, igual en todos los tipos de vehículo (RTM, RTM_REINSPECTION). NULL = sin código.",
|
|
61
|
+
}),
|
|
62
|
+
__metadata("design:type", Object)
|
|
63
|
+
], ReminderType.prototype, "code", void 0);
|
|
53
64
|
__decorate([
|
|
54
65
|
(0, typeorm_1.Column)({
|
|
55
66
|
default: 1,
|
|
@@ -112,9 +123,14 @@ __decorate([
|
|
|
112
123
|
}),
|
|
113
124
|
__metadata("design:type", Number)
|
|
114
125
|
], ReminderType.prototype, "status", void 0);
|
|
126
|
+
__decorate([
|
|
127
|
+
(0, typeorm_1.OneToMany)(() => ReminderTypeCompanyType_1.ReminderTypeCompanyType, (row) => row.reminder_type),
|
|
128
|
+
__metadata("design:type", Array)
|
|
129
|
+
], ReminderType.prototype, "company_types", void 0);
|
|
115
130
|
exports.ReminderType = ReminderType = __decorate([
|
|
116
131
|
(0, typeorm_1.Entity)("reminder_type", {
|
|
117
132
|
comment: "Catálogo de tipos de recordatorio por país y tipo de vehículo.",
|
|
118
133
|
}),
|
|
119
|
-
(0, typeorm_1.Unique)("unique_country_vehicle_type_name", ["country", "vehicle_type", "name"])
|
|
134
|
+
(0, typeorm_1.Unique)("unique_country_vehicle_type_name", ["country", "vehicle_type", "name"]),
|
|
135
|
+
(0, typeorm_1.Unique)("unique_country_vehicle_type_code", ["country", "vehicle_type", "code"])
|
|
120
136
|
], ReminderType);
|