@asumano/worklip-typeorm-db 1.1.94 → 1.1.95
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.
|
@@ -33,6 +33,23 @@ export declare class ServiceOrder {
|
|
|
33
33
|
workboard_status: WorkboardStatus | null;
|
|
34
34
|
workboard_changed: Date | null;
|
|
35
35
|
promised_date: Date | null;
|
|
36
|
+
/**
|
|
37
|
+
* DOC: LA CALIFICACIÓN DEL CLIENTE. La deja él mismo desde su informe público, cuando ya
|
|
38
|
+
* recibió el vehículo, y solo si la plantilla de la visita la pide
|
|
39
|
+
* (`template.settings.satisfaction`).
|
|
40
|
+
*
|
|
41
|
+
* Son columnas y no una llave dentro de `data` —donde vive el árbol de la visita— porque
|
|
42
|
+
* esto se mira AGREGADO: el promedio del taller, del mes, la tasa de respuesta. Un AVG sobre
|
|
43
|
+
* una columna no obliga a leer el JSON completo de cada visita, y ordenar y filtrar la tabla
|
|
44
|
+
* de visitas por la nota es un rango como cualquier otro.
|
|
45
|
+
*
|
|
46
|
+
* Y no una tabla aparte porque es 1 a 1 con la visita y siempre se lee junto con ella: un
|
|
47
|
+
* LEFT JOIN en la vista y en cada promedio, a cambio de nada.
|
|
48
|
+
*/
|
|
49
|
+
satisfaction_score: number | null;
|
|
50
|
+
satisfaction_comment: string | null;
|
|
51
|
+
satisfaction_date: Date | null;
|
|
52
|
+
satisfaction_asked: Date | null;
|
|
36
53
|
stages: ServiceOrderStage[];
|
|
37
54
|
workboard_events: WorkboardEvent[];
|
|
38
55
|
service_order_history: ServiceOrderHistory[];
|
|
@@ -205,6 +205,44 @@ __decorate([
|
|
|
205
205
|
}),
|
|
206
206
|
__metadata("design:type", Object)
|
|
207
207
|
], ServiceOrder.prototype, "promised_date", void 0);
|
|
208
|
+
__decorate([
|
|
209
|
+
(0, typeorm_1.Column)({
|
|
210
|
+
type: "tinyint",
|
|
211
|
+
unsigned: true,
|
|
212
|
+
nullable: true,
|
|
213
|
+
default: null,
|
|
214
|
+
comment: "Calificación del cliente, de 1 a 5. NULL: todavía no calificó.",
|
|
215
|
+
}),
|
|
216
|
+
__metadata("design:type", Object)
|
|
217
|
+
], ServiceOrder.prototype, "satisfaction_score", void 0);
|
|
218
|
+
__decorate([
|
|
219
|
+
(0, typeorm_1.Column)({
|
|
220
|
+
length: 500,
|
|
221
|
+
type: "varchar",
|
|
222
|
+
nullable: true,
|
|
223
|
+
default: null,
|
|
224
|
+
comment: "Comentario que dejó el cliente al calificar. Opcional.",
|
|
225
|
+
}),
|
|
226
|
+
__metadata("design:type", Object)
|
|
227
|
+
], ServiceOrder.prototype, "satisfaction_comment", void 0);
|
|
228
|
+
__decorate([
|
|
229
|
+
(0, typeorm_1.Column)({
|
|
230
|
+
type: "datetime",
|
|
231
|
+
nullable: true,
|
|
232
|
+
default: null,
|
|
233
|
+
comment: "Cuándo calificó el cliente. NULL: todavía no lo ha hecho.",
|
|
234
|
+
}),
|
|
235
|
+
__metadata("design:type", Object)
|
|
236
|
+
], ServiceOrder.prototype, "satisfaction_date", void 0);
|
|
237
|
+
__decorate([
|
|
238
|
+
(0, typeorm_1.Column)({
|
|
239
|
+
type: "datetime",
|
|
240
|
+
nullable: true,
|
|
241
|
+
default: null,
|
|
242
|
+
comment: "Cuándo se le pidió al cliente que calificara. NULL: todavía no se le ha pedido.",
|
|
243
|
+
}),
|
|
244
|
+
__metadata("design:type", Object)
|
|
245
|
+
], ServiceOrder.prototype, "satisfaction_asked", void 0);
|
|
208
246
|
__decorate([
|
|
209
247
|
(0, typeorm_1.OneToMany)(() => ServiceOrderStage_1.ServiceOrderStage, (stage) => stage.service_order),
|
|
210
248
|
__metadata("design:type", Array)
|
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
export interface ITemplateSettings {
|
|
2
2
|
cost?: number | null;
|
|
3
3
|
estimated_days?: number | null;
|
|
4
|
+
satisfaction?: ITemplateSatisfactionSettings | null;
|
|
5
|
+
}
|
|
6
|
+
export interface ITemplateSatisfactionSettings {
|
|
7
|
+
enabled: boolean;
|
|
4
8
|
}
|
|
5
9
|
export declare const getTemplateCost: (settings: ITemplateSettings | null | undefined) => number | null;
|
|
6
10
|
export declare const withTemplateCost: (settings: ITemplateSettings | null | undefined, cost: number | null) => ITemplateSettings | null;
|
|
7
11
|
export declare const getTemplateEstimatedDays: (settings: ITemplateSettings | null | undefined) => number | null;
|
|
8
12
|
export declare const templatePromisedDate: (settings: ITemplateSettings | null | undefined, createdAt: Date) => string | null;
|
|
9
13
|
export declare const withTemplateEstimatedDays: (settings: ITemplateSettings | null | undefined, days: number | null) => ITemplateSettings | null;
|
|
14
|
+
export declare const isSatisfactionEnabled: (settings: ITemplateSettings | null | undefined) => boolean;
|
|
15
|
+
export declare const withSatisfactionSettings: (settings: ITemplateSettings | null | undefined, enabled: boolean) => ITemplateSettings | null;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// DOC: Configuración de la plantilla (`template.settings`). Vive acá y no en cada repo
|
|
3
3
|
// porque el API la escribe y valida, y el portal la pinta: una sola forma para los dos.
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.withTemplateEstimatedDays = exports.templatePromisedDate = exports.getTemplateEstimatedDays = exports.withTemplateCost = exports.getTemplateCost = void 0;
|
|
5
|
+
exports.withSatisfactionSettings = exports.isSatisfactionEnabled = exports.withTemplateEstimatedDays = exports.templatePromisedDate = exports.getTemplateEstimatedDays = exports.withTemplateCost = exports.getTemplateCost = void 0;
|
|
6
6
|
// DOC: Costo configurado de una plantilla, ya normalizado. Devuelve `null` cuando no hay
|
|
7
7
|
// costo, y NUNCA un negativo ni un NaN: es lo que se copia al precio de la visita.
|
|
8
8
|
const getTemplateCost = (settings) => {
|
|
@@ -69,3 +69,20 @@ const withTemplateEstimatedDays = (settings, days) => {
|
|
|
69
69
|
return Object.keys(next).length > 0 ? next : null;
|
|
70
70
|
};
|
|
71
71
|
exports.withTemplateEstimatedDays = withTemplateEstimatedDays;
|
|
72
|
+
// DOC: ¿Esta plantilla pide calificación? Se lee con un ayudante y no con `settings?.
|
|
73
|
+
// satisfaction?.enabled` suelto porque lo preguntan el API —al armar el informe y al validar
|
|
74
|
+
// el endpoint público— y el portal, y una de esas tres copias se iba a leer distinto.
|
|
75
|
+
const isSatisfactionEnabled = (settings) => settings?.satisfaction?.enabled === true;
|
|
76
|
+
exports.isSatisfactionEnabled = isSatisfactionEnabled;
|
|
77
|
+
// DOC: Deja `settings` listo para guardar con la calificación prendida o apagada, sin pisar el
|
|
78
|
+
// costo, los días ni lo que venga después. Apagada NO se guarda como `{enabled: false}`: se
|
|
79
|
+
// borra la llave, porque ausente ya significa que no. Espejo de `withTemplateCost`.
|
|
80
|
+
const withSatisfactionSettings = (settings, enabled) => {
|
|
81
|
+
const next = { ...(settings ?? {}) };
|
|
82
|
+
if (enabled)
|
|
83
|
+
next.satisfaction = { enabled: true };
|
|
84
|
+
else
|
|
85
|
+
delete next.satisfaction;
|
|
86
|
+
return Object.keys(next).length > 0 ? next : null;
|
|
87
|
+
};
|
|
88
|
+
exports.withSatisfactionSettings = withSatisfactionSettings;
|
|
@@ -60,6 +60,10 @@ export declare class ServicesOrder {
|
|
|
60
60
|
template_created: Date;
|
|
61
61
|
template_updated: Date;
|
|
62
62
|
template_status: number;
|
|
63
|
+
satisfaction_score: number | null;
|
|
64
|
+
satisfaction_comment: string | null;
|
|
65
|
+
satisfaction_date: Date | null;
|
|
66
|
+
satisfaction_asked: Date | null;
|
|
63
67
|
history_count: number;
|
|
64
68
|
reminder_count: number;
|
|
65
69
|
}
|
|
@@ -258,6 +258,22 @@ __decorate([
|
|
|
258
258
|
(0, typeorm_1.ViewColumn)(),
|
|
259
259
|
__metadata("design:type", Number)
|
|
260
260
|
], ServicesOrder.prototype, "template_status", void 0);
|
|
261
|
+
__decorate([
|
|
262
|
+
(0, typeorm_1.ViewColumn)(),
|
|
263
|
+
__metadata("design:type", Object)
|
|
264
|
+
], ServicesOrder.prototype, "satisfaction_score", void 0);
|
|
265
|
+
__decorate([
|
|
266
|
+
(0, typeorm_1.ViewColumn)(),
|
|
267
|
+
__metadata("design:type", Object)
|
|
268
|
+
], ServicesOrder.prototype, "satisfaction_comment", void 0);
|
|
269
|
+
__decorate([
|
|
270
|
+
(0, typeorm_1.ViewColumn)(),
|
|
271
|
+
__metadata("design:type", Object)
|
|
272
|
+
], ServicesOrder.prototype, "satisfaction_date", void 0);
|
|
273
|
+
__decorate([
|
|
274
|
+
(0, typeorm_1.ViewColumn)(),
|
|
275
|
+
__metadata("design:type", Object)
|
|
276
|
+
], ServicesOrder.prototype, "satisfaction_asked", void 0);
|
|
261
277
|
__decorate([
|
|
262
278
|
(0, typeorm_1.ViewColumn)(),
|
|
263
279
|
__metadata("design:type", Number)
|