@asumano/worklip-typeorm-db 1.1.54 → 1.1.56
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/Company.d.ts +2 -1
- package/dist/entities/Company.js +4 -0
- package/dist/entities/CompanyVehicleType.d.ts +7 -0
- package/dist/entities/CompanyVehicleType.js +50 -0
- package/dist/entities/VehicleType.d.ts +2 -0
- package/dist/entities/VehicleType.js +5 -0
- package/dist/entities.index.d.ts +1 -0
- package/dist/entities.index.js +4 -2
- package/dist/filters/ServicesOrderForTheTable.js +40 -35
- package/dist/views/ServicesOrder.d.ts +7 -0
- package/dist/views/ServicesOrder.js +28 -0
- package/package.json +1 -1
|
@@ -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, Country, EmailLog, MediaFile, PaymentMethod, ServiceOrderApproval, UsageAlert, WhatsappLog } from "..";
|
|
5
|
+
import { BillingInvoice, BillingUsageSnapshot, CompanyBrand, CompanySubscription, CompanyVehicleType, Country, EmailLog, MediaFile, PaymentMethod, ServiceOrderApproval, UsageAlert, WhatsappLog } from "..";
|
|
6
6
|
export declare class Company {
|
|
7
7
|
id: number;
|
|
8
8
|
country: Country;
|
|
@@ -15,6 +15,7 @@ export declare class Company {
|
|
|
15
15
|
associates: Associate[];
|
|
16
16
|
workshops: Workshop[];
|
|
17
17
|
companyBrands: CompanyBrand[];
|
|
18
|
+
companyVehicleTypes: CompanyVehicleType[];
|
|
18
19
|
payment_methods: PaymentMethod[];
|
|
19
20
|
billing_usage_snapshots: BillingUsageSnapshot[];
|
|
20
21
|
media_files: MediaFile[];
|
package/dist/entities/Company.js
CHANGED
|
@@ -85,6 +85,10 @@ __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.CompanyVehicleType, (companyVehicleType) => companyVehicleType.company),
|
|
90
|
+
__metadata("design:type", Array)
|
|
91
|
+
], Company.prototype, "companyVehicleTypes", void 0);
|
|
88
92
|
__decorate([
|
|
89
93
|
(0, typeorm_1.OneToMany)(() => __1.PaymentMethod, (paymentMethod) => paymentMethod.company),
|
|
90
94
|
__metadata("design:type", Array)
|
|
@@ -0,0 +1,50 @@
|
|
|
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.CompanyVehicleType = void 0;
|
|
13
|
+
const typeorm_1 = require("typeorm");
|
|
14
|
+
const Company_1 = require("./Company");
|
|
15
|
+
const VehicleType_1 = require("./VehicleType");
|
|
16
|
+
let CompanyVehicleType = class CompanyVehicleType {
|
|
17
|
+
};
|
|
18
|
+
exports.CompanyVehicleType = CompanyVehicleType;
|
|
19
|
+
__decorate([
|
|
20
|
+
(0, typeorm_1.PrimaryGeneratedColumn)({
|
|
21
|
+
type: "int",
|
|
22
|
+
comment: "ID único de cada registro.",
|
|
23
|
+
}),
|
|
24
|
+
__metadata("design:type", Number)
|
|
25
|
+
], CompanyVehicleType.prototype, "id", void 0);
|
|
26
|
+
__decorate([
|
|
27
|
+
(0, typeorm_1.ManyToOne)(() => Company_1.Company, (company) => company.companyVehicleTypes, {
|
|
28
|
+
onDelete: "CASCADE",
|
|
29
|
+
onUpdate: "NO ACTION",
|
|
30
|
+
}),
|
|
31
|
+
(0, typeorm_1.JoinColumn)({ name: "company" }),
|
|
32
|
+
__metadata("design:type", Company_1.Company)
|
|
33
|
+
], CompanyVehicleType.prototype, "company", void 0);
|
|
34
|
+
__decorate([
|
|
35
|
+
(0, typeorm_1.ManyToOne)(() => VehicleType_1.VehicleType, (vehicleType) => vehicleType.companyVehicleTypes, {
|
|
36
|
+
onDelete: "RESTRICT",
|
|
37
|
+
onUpdate: "NO ACTION",
|
|
38
|
+
}),
|
|
39
|
+
(0, typeorm_1.JoinColumn)({ name: "vehicle_type" }),
|
|
40
|
+
__metadata("design:type", VehicleType_1.VehicleType)
|
|
41
|
+
], CompanyVehicleType.prototype, "vehicle_type", void 0);
|
|
42
|
+
exports.CompanyVehicleType = CompanyVehicleType = __decorate([
|
|
43
|
+
(0, typeorm_1.Entity)({
|
|
44
|
+
name: "company_vehicle_type",
|
|
45
|
+
comment: "Relación entre los tipos de vehículos y los concesionarios/talleres, hay unos concesionarios/talleres que solo manejan ciertos tipos de vehículos.",
|
|
46
|
+
}),
|
|
47
|
+
(0, typeorm_1.Index)("UQ_company_vehicle_type", ["company", "vehicle_type"], {
|
|
48
|
+
unique: true,
|
|
49
|
+
})
|
|
50
|
+
], CompanyVehicleType);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { CompanyVehicleType } from "./CompanyVehicleType";
|
|
1
2
|
import { GlobalTemplate } from "./GlobalTemplate";
|
|
2
3
|
import { Template } from "./Template";
|
|
3
4
|
import { Vehicle } from "./Vehicle";
|
|
@@ -9,4 +10,5 @@ export declare class VehicleType {
|
|
|
9
10
|
vehicle_types: Vehicle[];
|
|
10
11
|
vehicle_types_template: Template[];
|
|
11
12
|
vehicle_types_global_template: GlobalTemplate[];
|
|
13
|
+
companyVehicleTypes: CompanyVehicleType[];
|
|
12
14
|
}
|
|
@@ -11,6 +11,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.VehicleType = void 0;
|
|
13
13
|
const typeorm_1 = require("typeorm");
|
|
14
|
+
const CompanyVehicleType_1 = require("./CompanyVehicleType");
|
|
14
15
|
const GlobalTemplate_1 = require("./GlobalTemplate");
|
|
15
16
|
const Template_1 = require("./Template");
|
|
16
17
|
const Vehicle_1 = require("./Vehicle");
|
|
@@ -62,6 +63,10 @@ __decorate([
|
|
|
62
63
|
(0, typeorm_1.OneToMany)(() => GlobalTemplate_1.GlobalTemplate, (globalTemplate) => globalTemplate.vehicle_type),
|
|
63
64
|
__metadata("design:type", Array)
|
|
64
65
|
], VehicleType.prototype, "vehicle_types_global_template", void 0);
|
|
66
|
+
__decorate([
|
|
67
|
+
(0, typeorm_1.OneToMany)(() => CompanyVehicleType_1.CompanyVehicleType, (companyVehicleType) => companyVehicleType.vehicle_type),
|
|
68
|
+
__metadata("design:type", Array)
|
|
69
|
+
], VehicleType.prototype, "companyVehicleTypes", void 0);
|
|
65
70
|
exports.VehicleType = VehicleType = __decorate([
|
|
66
71
|
(0, typeorm_1.Entity)({
|
|
67
72
|
comment: "Tabla creada para agregar los tipos de vehículos que va a manejar el concesionario/taller.",
|
package/dist/entities.index.d.ts
CHANGED
|
@@ -30,6 +30,7 @@ export { MasterPermission } from "./entities/MasterPermission";
|
|
|
30
30
|
export { MasterSection } from "./entities/MasterSection";
|
|
31
31
|
export { VehicleType } from "./entities/VehicleType";
|
|
32
32
|
export { CompanyBrand } from "./entities/CompanyBrand";
|
|
33
|
+
export { CompanyVehicleType } from "./entities/CompanyVehicleType";
|
|
33
34
|
export { CountryHoliday } from "./entities/CountryHoliday";
|
|
34
35
|
export { SubscriptionPlan } from "./entities/SubscriptionPlan";
|
|
35
36
|
export { CompanySubscription } from "./entities/CompanySubscription";
|
package/dist/entities.index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.WorkshopsByAssociate = exports.Workshops = exports.TemplateSectionItems = exports.TemplateSections = exports.Templates = exports.Reminders = void 0;
|
|
3
|
+
exports.Clients = exports.ServicesOrder = exports.Associates = exports.UsageAlert = exports.SubscriptionAddonTemplate = exports.PaymentTransaction = exports.BillingInvoice = exports.EmailLog = exports.WhatsappLog = exports.ServiceOrderApproval = exports.MediaFile = exports.BillingUsageSnapshot = exports.PaymentMethod = exports.SubscriptionAddon = exports.CompanySubscription = exports.SubscriptionPlan = exports.CountryHoliday = exports.CompanyVehicleType = exports.CompanyBrand = exports.VehicleType = exports.MasterSection = exports.MasterPermission = exports.MasterRole = exports.MasterPlatform = exports.AssociatePasswordReset = exports.AssociateSection = exports.AssociatePermission = exports.AssociateRole = exports.AssociatePlatform = exports.Reminder = exports.ServiceOrderHistory = exports.ServiceOrder = exports.TemplateSectionItem = exports.TemplateSection = exports.Template = exports.Workshop = exports.GlobalTemplateSectionItem = exports.GlobalTemplateSection = exports.GlobalTemplate = exports.AssociateSession = exports.MasterSession = exports.Associate = exports.Client = exports.Master = exports.Vehicle = exports.Brand = exports.Company = exports.City = exports.Region = exports.Country = void 0;
|
|
4
|
+
exports.WorkshopsByAssociate = exports.Workshops = exports.TemplateSectionItems = exports.TemplateSections = exports.Templates = exports.Reminders = exports.Vehicles = void 0;
|
|
5
5
|
var Country_1 = require("./entities/Country");
|
|
6
6
|
Object.defineProperty(exports, "Country", { enumerable: true, get: function () { return Country_1.Country; } });
|
|
7
7
|
var Region_1 = require("./entities/Region");
|
|
@@ -66,6 +66,8 @@ var VehicleType_1 = require("./entities/VehicleType");
|
|
|
66
66
|
Object.defineProperty(exports, "VehicleType", { enumerable: true, get: function () { return VehicleType_1.VehicleType; } });
|
|
67
67
|
var CompanyBrand_1 = require("./entities/CompanyBrand");
|
|
68
68
|
Object.defineProperty(exports, "CompanyBrand", { enumerable: true, get: function () { return CompanyBrand_1.CompanyBrand; } });
|
|
69
|
+
var CompanyVehicleType_1 = require("./entities/CompanyVehicleType");
|
|
70
|
+
Object.defineProperty(exports, "CompanyVehicleType", { enumerable: true, get: function () { return CompanyVehicleType_1.CompanyVehicleType; } });
|
|
69
71
|
var CountryHoliday_1 = require("./entities/CountryHoliday");
|
|
70
72
|
Object.defineProperty(exports, "CountryHoliday", { enumerable: true, get: function () { return CountryHoliday_1.CountryHoliday; } });
|
|
71
73
|
var SubscriptionPlan_1 = require("./entities/SubscriptionPlan");
|
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getServicesOrderForTheTable = getServicesOrderForTheTable;
|
|
4
|
+
// DOC: Columnas de la tabla de visitas que el front filtra por rango [desde, hasta]
|
|
5
|
+
// con matchMode "custom".
|
|
6
|
+
const DATE_RANGE_COLUMNS = ["created", "updated"];
|
|
7
|
+
// DOC: `price` estaba declarado con matchMode "custom" en el front pero no tenía
|
|
8
|
+
// rama acá, así que el filtro de precio no hacía nada. `progress_percentage`
|
|
9
|
+
// y `quotation_total` salen del resumen de la visita (ver la vista
|
|
10
|
+
// services_order).
|
|
11
|
+
const NUMBER_RANGE_COLUMNS = [
|
|
12
|
+
"price",
|
|
13
|
+
"history_count",
|
|
14
|
+
"reminder_count",
|
|
15
|
+
"progress_percentage",
|
|
16
|
+
"quotation_total",
|
|
17
|
+
];
|
|
4
18
|
async function getServicesOrderForTheTable(repository, { company, workshop, status, visible, lazyEvent }) {
|
|
5
19
|
try {
|
|
6
20
|
const queryBuilder = repository
|
|
@@ -46,23 +60,28 @@ async function getServicesOrderForTheTable(repository, { company, workshop, stat
|
|
|
46
60
|
switch (matchMode // DOC: Verificamos el modo de coincidencia del filtro.
|
|
47
61
|
) {
|
|
48
62
|
case "custom":
|
|
49
|
-
|
|
63
|
+
// DOC: Rangos [desde, hasta]. Los nombres de los parámetros llevan la
|
|
64
|
+
// columna (`${key}_from`) a propósito: antes todos usaban :from y
|
|
65
|
+
// :to, así que al aplicar DOS rangos a la vez (ej. precio y
|
|
66
|
+
// avance) el segundo le pisaba los valores al primero y el filtro
|
|
67
|
+
// devolvía cualquier cosa.
|
|
68
|
+
if (DATE_RANGE_COLUMNS.includes(key)) {
|
|
50
69
|
if (Array.isArray(value) && value.length === 2) {
|
|
51
70
|
const [from, to] = value;
|
|
52
71
|
if (from !== null && to === null) {
|
|
53
|
-
queryBuilder.andWhere(`${accessKey} >=
|
|
54
|
-
|
|
72
|
+
queryBuilder.andWhere(`${accessKey} >= :${key}_from`, {
|
|
73
|
+
[`${key}_from`]: new Date(from),
|
|
55
74
|
});
|
|
56
75
|
}
|
|
57
76
|
else if (from === null && to !== null) {
|
|
58
|
-
queryBuilder.andWhere(`${accessKey} <=
|
|
59
|
-
|
|
77
|
+
queryBuilder.andWhere(`${accessKey} <= :${key}_to`, {
|
|
78
|
+
[`${key}_to`]: new Date(to),
|
|
60
79
|
});
|
|
61
80
|
}
|
|
62
81
|
else if (from !== null && to !== null) {
|
|
63
|
-
queryBuilder.andWhere(`${accessKey} BETWEEN
|
|
64
|
-
|
|
65
|
-
|
|
82
|
+
queryBuilder.andWhere(`${accessKey} BETWEEN :${key}_from AND :${key}_to`, {
|
|
83
|
+
[`${key}_from`]: new Date(from),
|
|
84
|
+
[`${key}_to`]: new Date(to),
|
|
66
85
|
});
|
|
67
86
|
}
|
|
68
87
|
}
|
|
@@ -77,37 +96,24 @@ async function getServicesOrderForTheTable(repository, { company, workshop, stat
|
|
|
77
96
|
});
|
|
78
97
|
}
|
|
79
98
|
}
|
|
80
|
-
|
|
99
|
+
// DOC: Rangos numéricos. `price`, `progress_percentage` y
|
|
100
|
+
// `quotation_total` entran por acá igual que los conteos: el front
|
|
101
|
+
// manda [desde, hasta] con matchMode "custom".
|
|
102
|
+
if (NUMBER_RANGE_COLUMNS.includes(key)) {
|
|
81
103
|
if (Array.isArray(value) && value.length === 2) {
|
|
82
104
|
const [from, to] = value;
|
|
83
105
|
if (from !== null && to === null) {
|
|
84
|
-
queryBuilder.andWhere(`${accessKey} >=
|
|
85
|
-
|
|
86
|
-
else if (from === null && to !== null) {
|
|
87
|
-
queryBuilder.andWhere(`${accessKey} <= :to`, { to });
|
|
88
|
-
}
|
|
89
|
-
else if (from !== null && to !== null) {
|
|
90
|
-
queryBuilder.andWhere(`${accessKey} BETWEEN :from AND :to`, {
|
|
91
|
-
from,
|
|
92
|
-
to,
|
|
106
|
+
queryBuilder.andWhere(`${accessKey} >= :${key}_from`, {
|
|
107
|
+
[`${key}_from`]: from,
|
|
93
108
|
});
|
|
94
109
|
}
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
if (key === "reminder_count") {
|
|
98
|
-
if (Array.isArray(value) && value.length === 2) {
|
|
99
|
-
const [from, to] = value;
|
|
100
|
-
if (from !== null && to === null) {
|
|
101
|
-
queryBuilder.andWhere(`${accessKey} >= :from`, { from });
|
|
102
|
-
}
|
|
103
110
|
else if (from === null && to !== null) {
|
|
104
|
-
queryBuilder.andWhere(`${accessKey} <=
|
|
111
|
+
queryBuilder.andWhere(`${accessKey} <= :${key}_to`, {
|
|
112
|
+
[`${key}_to`]: to,
|
|
113
|
+
});
|
|
105
114
|
}
|
|
106
115
|
else if (from !== null && to !== null) {
|
|
107
|
-
queryBuilder.andWhere(`${accessKey} BETWEEN :from
|
|
108
|
-
from,
|
|
109
|
-
to,
|
|
110
|
-
});
|
|
116
|
+
queryBuilder.andWhere(`${accessKey} BETWEEN :${key}_from AND :${key}_to`, { [`${key}_from`]: from, [`${key}_to`]: to });
|
|
111
117
|
}
|
|
112
118
|
}
|
|
113
119
|
}
|
|
@@ -167,10 +173,9 @@ async function getServicesOrderForTheTable(repository, { company, workshop, stat
|
|
|
167
173
|
case "between": // DOC: Si el modo de coincidencia es "between".
|
|
168
174
|
if (Array.isArray(value) && value.length === 2) {
|
|
169
175
|
const [from, to] = value;
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
});
|
|
176
|
+
// DOC: Parámetros con el nombre de la columna, por lo mismo que en
|
|
177
|
+
// "custom": con :from/:to fijos, dos rangos a la vez se pisan.
|
|
178
|
+
queryBuilder.andWhere(`${accessKey} BETWEEN :${key}_from AND :${key}_to`, { [`${key}_from`]: from, [`${key}_to`]: to });
|
|
174
179
|
}
|
|
175
180
|
break;
|
|
176
181
|
}
|
|
@@ -12,6 +12,13 @@ export declare class ServicesOrder {
|
|
|
12
12
|
created: Date;
|
|
13
13
|
updated: Date;
|
|
14
14
|
status: number;
|
|
15
|
+
progress_percentage: number | null;
|
|
16
|
+
vehicle_health_percentage: number | null;
|
|
17
|
+
quotation_total: number | null;
|
|
18
|
+
quotation_pending_total: number | null;
|
|
19
|
+
quotation_items_pending: number | null;
|
|
20
|
+
items_bad: number | null;
|
|
21
|
+
items_not_marked: number | null;
|
|
15
22
|
workshop_id: number;
|
|
16
23
|
workshop_company: number;
|
|
17
24
|
workshop_name: string;
|
|
@@ -66,6 +66,34 @@ __decorate([
|
|
|
66
66
|
(0, typeorm_1.ViewColumn)(),
|
|
67
67
|
__metadata("design:type", Number)
|
|
68
68
|
], ServicesOrder.prototype, "status", void 0);
|
|
69
|
+
__decorate([
|
|
70
|
+
(0, typeorm_1.ViewColumn)(),
|
|
71
|
+
__metadata("design:type", Object)
|
|
72
|
+
], ServicesOrder.prototype, "progress_percentage", void 0);
|
|
73
|
+
__decorate([
|
|
74
|
+
(0, typeorm_1.ViewColumn)(),
|
|
75
|
+
__metadata("design:type", Object)
|
|
76
|
+
], ServicesOrder.prototype, "vehicle_health_percentage", void 0);
|
|
77
|
+
__decorate([
|
|
78
|
+
(0, typeorm_1.ViewColumn)(),
|
|
79
|
+
__metadata("design:type", Object)
|
|
80
|
+
], ServicesOrder.prototype, "quotation_total", void 0);
|
|
81
|
+
__decorate([
|
|
82
|
+
(0, typeorm_1.ViewColumn)(),
|
|
83
|
+
__metadata("design:type", Object)
|
|
84
|
+
], ServicesOrder.prototype, "quotation_pending_total", void 0);
|
|
85
|
+
__decorate([
|
|
86
|
+
(0, typeorm_1.ViewColumn)(),
|
|
87
|
+
__metadata("design:type", Object)
|
|
88
|
+
], ServicesOrder.prototype, "quotation_items_pending", void 0);
|
|
89
|
+
__decorate([
|
|
90
|
+
(0, typeorm_1.ViewColumn)(),
|
|
91
|
+
__metadata("design:type", Object)
|
|
92
|
+
], ServicesOrder.prototype, "items_bad", void 0);
|
|
93
|
+
__decorate([
|
|
94
|
+
(0, typeorm_1.ViewColumn)(),
|
|
95
|
+
__metadata("design:type", Object)
|
|
96
|
+
], ServicesOrder.prototype, "items_not_marked", void 0);
|
|
69
97
|
__decorate([
|
|
70
98
|
(0, typeorm_1.ViewColumn)(),
|
|
71
99
|
__metadata("design:type", Number)
|