@asumano/worklip-typeorm-db 1.1.74 → 1.1.76
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/AssociatePermission.d.ts +1 -0
- package/dist/entities/AssociatePermission.js +10 -0
- package/dist/entities/MasterPermission.d.ts +1 -0
- package/dist/entities/MasterPermission.js +10 -0
- package/dist/entities/Template.d.ts +2 -0
- package/dist/entities/Template.js +9 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +3 -0
- package/dist/template.settings.d.ts +5 -0
- package/dist/template.settings.js +29 -0
- package/dist/views/Templates.d.ts +2 -0
- package/dist/views/Templates.js +4 -0
- package/package.json +1 -1
|
@@ -42,6 +42,16 @@ __decorate([
|
|
|
42
42
|
}),
|
|
43
43
|
__metadata("design:type", String)
|
|
44
44
|
], AssociatePermission.prototype, "label", void 0);
|
|
45
|
+
__decorate([
|
|
46
|
+
(0, typeorm_1.Column)({
|
|
47
|
+
length: 350,
|
|
48
|
+
nullable: true,
|
|
49
|
+
type: "varchar",
|
|
50
|
+
default: null,
|
|
51
|
+
comment: "Aclaración del permiso que se muestra debajo del label. NULL si no hace falta.",
|
|
52
|
+
}),
|
|
53
|
+
__metadata("design:type", Object)
|
|
54
|
+
], AssociatePermission.prototype, "comments", void 0);
|
|
45
55
|
__decorate([
|
|
46
56
|
(0, typeorm_1.Column)({
|
|
47
57
|
length: 30,
|
|
@@ -46,6 +46,16 @@ __decorate([
|
|
|
46
46
|
}),
|
|
47
47
|
__metadata("design:type", String)
|
|
48
48
|
], MasterPermission.prototype, "label", void 0);
|
|
49
|
+
__decorate([
|
|
50
|
+
(0, typeorm_1.Column)({
|
|
51
|
+
length: 350,
|
|
52
|
+
nullable: true,
|
|
53
|
+
type: "varchar",
|
|
54
|
+
default: null,
|
|
55
|
+
comment: "Aclaración del permiso que se muestra debajo del label. NULL si no hace falta.",
|
|
56
|
+
}),
|
|
57
|
+
__metadata("design:type", Object)
|
|
58
|
+
], MasterPermission.prototype, "comments", void 0);
|
|
49
59
|
__decorate([
|
|
50
60
|
(0, typeorm_1.Column)({
|
|
51
61
|
length: 30,
|
|
@@ -2,12 +2,14 @@ import { Workshop } from "./Workshop";
|
|
|
2
2
|
import { TemplateSection } from "./TemplateSection";
|
|
3
3
|
import { ServiceOrder } from "./ServiceOrder";
|
|
4
4
|
import { VehicleType } from "./VehicleType";
|
|
5
|
+
import { ITemplateSettings } from "../template.settings";
|
|
5
6
|
export declare class Template {
|
|
6
7
|
id: number;
|
|
7
8
|
code: string;
|
|
8
9
|
vehicle_type: VehicleType;
|
|
9
10
|
workshop: Workshop;
|
|
10
11
|
name: string;
|
|
12
|
+
settings: ITemplateSettings | null;
|
|
11
13
|
created: Date;
|
|
12
14
|
updated: Date | null;
|
|
13
15
|
status: number;
|
|
@@ -58,6 +58,15 @@ __decorate([
|
|
|
58
58
|
}),
|
|
59
59
|
__metadata("design:type", String)
|
|
60
60
|
], Template.prototype, "name", void 0);
|
|
61
|
+
__decorate([
|
|
62
|
+
(0, typeorm_1.Column)({
|
|
63
|
+
type: "json",
|
|
64
|
+
default: null,
|
|
65
|
+
nullable: true,
|
|
66
|
+
comment: "Configuración de la plantilla en JSON (hoy: cost). NULL si no se ha configurado nada.",
|
|
67
|
+
}),
|
|
68
|
+
__metadata("design:type", Object)
|
|
69
|
+
], Template.prototype, "settings", void 0);
|
|
61
70
|
__decorate([
|
|
62
71
|
(0, typeorm_1.Column)({
|
|
63
72
|
type: "datetime",
|
package/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { IBasicFilter } from "./types";
|
|
|
3
3
|
export * from "./entities.views.routes";
|
|
4
4
|
export * from "./visit.summary";
|
|
5
5
|
export * from "./company.legal";
|
|
6
|
+
export * from "./template.settings";
|
|
6
7
|
export declare function createDataBaseSource(): DataSource;
|
|
7
8
|
export declare function showEntityName<T extends ObjectLiteral>(entity: EntityTarget<T>): Promise<Repository<T>>;
|
|
8
9
|
export declare function callStoredProcedureName(storedProcedure: any, elements: any): Promise<any>;
|
package/dist/index.js
CHANGED
|
@@ -54,6 +54,9 @@ __exportStar(require("./visit.summary"), exports);
|
|
|
54
54
|
// DOC: Datos legales/fiscales de la empresa y el catálogo por país. Lo consumen el panel,
|
|
55
55
|
// el portal y el job del aviso, y "estar completo" tiene que significar lo mismo en los tres.
|
|
56
56
|
__exportStar(require("./company.legal"), exports);
|
|
57
|
+
// DOC: Configuración de la plantilla (hoy el costo que hereda la visita). La leen el API al
|
|
58
|
+
// crear la visita y el portal al pintar la tabla, así que la forma es una sola.
|
|
59
|
+
__exportStar(require("./template.settings"), exports);
|
|
57
60
|
let connection = null;
|
|
58
61
|
// DOC: Inicialización en curso. Se memoriza la PROMESA y no el resultado porque el patrón
|
|
59
62
|
// "si no está inicializada, inicialízala" tiene una carrera en el arranque en frío: dos
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export interface ITemplateSettings {
|
|
2
|
+
cost?: number | null;
|
|
3
|
+
}
|
|
4
|
+
export declare const getTemplateCost: (settings: ITemplateSettings | null | undefined) => number | null;
|
|
5
|
+
export declare const withTemplateCost: (settings: ITemplateSettings | null | undefined, cost: number | null) => ITemplateSettings | null;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// DOC: Configuración de la plantilla (`template.settings`). Vive acá y no en cada repo
|
|
3
|
+
// porque el API la escribe y valida, y el portal la pinta: una sola forma para los dos.
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.withTemplateCost = exports.getTemplateCost = void 0;
|
|
6
|
+
// DOC: Costo configurado de una plantilla, ya normalizado. Devuelve `null` cuando no hay
|
|
7
|
+
// costo, y NUNCA un negativo ni un NaN: es lo que se copia al precio de la visita.
|
|
8
|
+
const getTemplateCost = (settings) => {
|
|
9
|
+
const cost = settings?.cost;
|
|
10
|
+
if (cost === null || cost === undefined)
|
|
11
|
+
return null;
|
|
12
|
+
const value = Number(cost);
|
|
13
|
+
if (!Number.isFinite(value) || value < 0)
|
|
14
|
+
return null;
|
|
15
|
+
return value;
|
|
16
|
+
};
|
|
17
|
+
exports.getTemplateCost = getTemplateCost;
|
|
18
|
+
// DOC: Deja `settings` listo para guardar con el costo indicado, conservando lo demás que
|
|
19
|
+
// haya adentro. `null` borra el costo; el objeto entero pasa a `null` si queda vacío, para
|
|
20
|
+
// no dejar `{}` en la base.
|
|
21
|
+
const withTemplateCost = (settings, cost) => {
|
|
22
|
+
const next = { ...(settings ?? {}) };
|
|
23
|
+
if (cost === null)
|
|
24
|
+
delete next.cost;
|
|
25
|
+
else
|
|
26
|
+
next.cost = cost;
|
|
27
|
+
return Object.keys(next).length > 0 ? next : null;
|
|
28
|
+
};
|
|
29
|
+
exports.withTemplateCost = withTemplateCost;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import { ITemplateSettings } from "../template.settings";
|
|
1
2
|
export declare class Templates {
|
|
2
3
|
id: number;
|
|
3
4
|
code: string;
|
|
4
5
|
vehicle_type: number;
|
|
5
6
|
workshop: number;
|
|
6
7
|
name: string;
|
|
8
|
+
settings: ITemplateSettings | null;
|
|
7
9
|
created: Date;
|
|
8
10
|
updated: Date | null;
|
|
9
11
|
status: number;
|
package/dist/views/Templates.js
CHANGED
|
@@ -34,6 +34,10 @@ __decorate([
|
|
|
34
34
|
(0, typeorm_1.ViewColumn)(),
|
|
35
35
|
__metadata("design:type", String)
|
|
36
36
|
], Templates.prototype, "name", void 0);
|
|
37
|
+
__decorate([
|
|
38
|
+
(0, typeorm_1.ViewColumn)(),
|
|
39
|
+
__metadata("design:type", Object)
|
|
40
|
+
], Templates.prototype, "settings", void 0);
|
|
37
41
|
__decorate([
|
|
38
42
|
(0, typeorm_1.ViewColumn)(),
|
|
39
43
|
__metadata("design:type", Date)
|