@asumano/worklip-typeorm-db 1.1.105 → 1.1.107

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.
Files changed (49) hide show
  1. package/dist/entities/Appointment.d.ts +2 -0
  2. package/dist/entities/Appointment.js +10 -0
  3. package/dist/entities/CompanyAiUsage.d.ts +5 -0
  4. package/dist/entities/CompanyAiUsage.js +35 -4
  5. package/dist/entities/CompanyQuotaAdjustment.js +1 -1
  6. package/dist/entities/EquipmentType.d.ts +10 -0
  7. package/dist/entities/EquipmentType.js +69 -0
  8. package/dist/entities/ObdCode.d.ts +5 -0
  9. package/dist/entities/ObdCode.js +33 -0
  10. package/dist/entities/ServiceOrder.d.ts +1 -0
  11. package/dist/entities/ServiceOrder.js +13 -1
  12. package/dist/entities/ServiceOrderOuting.d.ts +41 -0
  13. package/dist/entities/ServiceOrderOuting.js +184 -0
  14. package/dist/entities/ServiceOrderPart.d.ts +1 -0
  15. package/dist/entities/ServiceOrderPart.js +9 -0
  16. package/dist/entities/SubscriptionAddon.js +1 -1
  17. package/dist/entities/SubscriptionAddonTemplate.js +1 -1
  18. package/dist/entities/UsageAlert.js +1 -1
  19. package/dist/entities/Vehicle.d.ts +1 -0
  20. package/dist/entities/Vehicle.js +10 -0
  21. package/dist/entities/VehicleMeasurement.d.ts +39 -0
  22. package/dist/entities/VehicleMeasurement.js +171 -0
  23. package/dist/entities/WorkboardStatus.js +1 -1
  24. package/dist/entities/WorkshopEquipment.d.ts +18 -0
  25. package/dist/entities/WorkshopEquipment.js +83 -0
  26. package/dist/entities/WorkshopOutingRecipient.d.ts +9 -0
  27. package/dist/entities/WorkshopOutingRecipient.js +50 -0
  28. package/dist/entities/WorkshopReportInbox.d.ts +12 -0
  29. package/dist/entities/WorkshopReportInbox.js +65 -0
  30. package/dist/entities.index.d.ts +7 -0
  31. package/dist/entities.index.js +16 -2
  32. package/dist/index.d.ts +2 -0
  33. package/dist/index.js +4 -0
  34. package/dist/rules/dashboard.rules.d.ts +1 -0
  35. package/dist/rules/dashboard.rules.js +3 -0
  36. package/dist/rules/equipment.rules.d.ts +209 -0
  37. package/dist/rules/equipment.rules.js +534 -0
  38. package/dist/rules/feature.codes.d.ts +1 -0
  39. package/dist/rules/feature.codes.js +2 -0
  40. package/dist/rules/outing.rules.d.ts +52 -0
  41. package/dist/rules/outing.rules.js +87 -0
  42. package/dist/rules/visit.summary.d.ts +17 -0
  43. package/dist/rules/workboard.rules.d.ts +11 -0
  44. package/dist/rules/workboard.rules.js +14 -1
  45. package/dist/views/ServicesOrder.d.ts +1 -0
  46. package/dist/views/ServicesOrder.js +4 -0
  47. package/dist/views/ServicesOrderLite.d.ts +1 -0
  48. package/dist/views/ServicesOrderLite.js +4 -0
  49. package/package.json +1 -1
@@ -2,6 +2,7 @@ import { Associate } from "./Associate";
2
2
  import { Client } from "./Client";
3
3
  import { Reminder } from "./Reminder";
4
4
  import { ServiceOrder } from "./ServiceOrder";
5
+ import { ServiceOrderOuting } from "./ServiceOrderOuting";
5
6
  import { Template } from "./Template";
6
7
  import { Vehicle } from "./Vehicle";
7
8
  import { Workshop } from "./Workshop";
@@ -25,6 +26,7 @@ export declare class Appointment {
25
26
  template: Template | null;
26
27
  reminder: Reminder | null;
27
28
  service_order: ServiceOrder | null;
29
+ outing: ServiceOrderOuting | null;
28
30
  appointment_date: string;
29
31
  slot: number;
30
32
  status: number;
@@ -15,6 +15,7 @@ const Associate_1 = require("./Associate");
15
15
  const Client_1 = require("./Client");
16
16
  const Reminder_1 = require("./Reminder");
17
17
  const ServiceOrder_1 = require("./ServiceOrder");
18
+ const ServiceOrderOuting_1 = require("./ServiceOrderOuting");
18
19
  const Template_1 = require("./Template");
19
20
  const Vehicle_1 = require("./Vehicle");
20
21
  const Workshop_1 = require("./Workshop");
@@ -102,6 +103,15 @@ __decorate([
102
103
  (0, typeorm_1.JoinColumn)({ name: "service_order" }),
103
104
  __metadata("design:type", Object)
104
105
  ], Appointment.prototype, "service_order", void 0);
106
+ __decorate([
107
+ (0, typeorm_1.ManyToOne)(() => ServiceOrderOuting_1.ServiceOrderOuting, {
108
+ onDelete: "SET NULL",
109
+ onUpdate: "NO ACTION",
110
+ nullable: true,
111
+ }),
112
+ (0, typeorm_1.JoinColumn)({ name: "outing" }),
113
+ __metadata("design:type", Object)
114
+ ], Appointment.prototype, "outing", void 0);
105
115
  __decorate([
106
116
  (0, typeorm_1.Column)({
107
117
  type: "date",
@@ -1,10 +1,15 @@
1
1
  import { Company } from "./Company";
2
2
  import { Associate } from "./Associate";
3
+ import { Workshop } from "./Workshop";
3
4
  export declare class CompanyAiUsage {
4
5
  id: number;
5
6
  company: Company;
6
7
  associate: Associate | null;
8
+ workshop: Workshop | null;
7
9
  resource_type: number;
8
10
  quantity: number;
11
+ model: string | null;
12
+ input_tokens: number | null;
13
+ output_tokens: number | null;
9
14
  created: Date;
10
15
  }
@@ -13,8 +13,9 @@ exports.CompanyAiUsage = void 0;
13
13
  const typeorm_1 = require("typeorm");
14
14
  const Company_1 = require("./Company");
15
15
  const Associate_1 = require("./Associate");
16
- // DOC: CUPOS DE IA (sql/79): una fila por uso cobrado (nota de voz o mejora de texto). El contador
17
- // rápido vive en Redis; esta tabla es la fuente de verdad para reconstruirlo y para el consumo.
16
+ const Workshop_1 = require("./Workshop");
17
+ // DOC: CUPOS DE IA (sql/79): una fila por uso cobrado (nota de voz, mejora de texto o lectura de equipo). El
18
+ // contador rápido vive en Redis; esta tabla es la fuente de verdad para reconstruirlo y para el consumo.
18
19
  let CompanyAiUsage = class CompanyAiUsage {
19
20
  };
20
21
  exports.CompanyAiUsage = CompanyAiUsage;
@@ -32,10 +33,15 @@ __decorate([
32
33
  (0, typeorm_1.JoinColumn)({ name: "associate" }),
33
34
  __metadata("design:type", Object)
34
35
  ], CompanyAiUsage.prototype, "associate", void 0);
36
+ __decorate([
37
+ (0, typeorm_1.ManyToOne)(() => Workshop_1.Workshop, { onDelete: "SET NULL", onUpdate: "NO ACTION", nullable: true }),
38
+ (0, typeorm_1.JoinColumn)({ name: "workshop" }),
39
+ __metadata("design:type", Object)
40
+ ], CompanyAiUsage.prototype, "workshop", void 0);
35
41
  __decorate([
36
42
  (0, typeorm_1.Column)({
37
43
  type: "int",
38
- comment: "Recurso (mismos números que subscription_addon.addon_type):\r\n10: Notas de voz con IA.\r\n11: Mejoras de texto con IA.",
44
+ comment: "Recurso (mismos números que subscription_addon.addon_type):\r\n10: Notas de voz con IA.\r\n11: Mejoras de texto con IA.\r\n12: Lecturas de equipos con IA.",
39
45
  }),
40
46
  __metadata("design:type", Number)
41
47
  ], CompanyAiUsage.prototype, "resource_type", void 0);
@@ -43,13 +49,38 @@ __decorate([
43
49
  (0, typeorm_1.Column)({ type: "int", default: 1, comment: "Cuántas unidades gastó este uso (textos corregidos en una sola llamada)." }),
44
50
  __metadata("design:type", Number)
45
51
  ], CompanyAiUsage.prototype, "quantity", void 0);
52
+ __decorate([
53
+ (0, typeorm_1.Column)({
54
+ type: "varchar",
55
+ length: 80,
56
+ nullable: true,
57
+ comment: "Modelo que respondió (el del respaldo si entró el respaldo). NULL en los usos anteriores a sql/83.",
58
+ }),
59
+ __metadata("design:type", Object)
60
+ ], CompanyAiUsage.prototype, "model", void 0);
61
+ __decorate([
62
+ (0, typeorm_1.Column)({
63
+ type: "int",
64
+ nullable: true,
65
+ comment: "Tokens de entrada que cobró el proveedor (suma de todas las llamadas del uso). NULL si el proveedor no cobra por tokens.",
66
+ }),
67
+ __metadata("design:type", Object)
68
+ ], CompanyAiUsage.prototype, "input_tokens", void 0);
69
+ __decorate([
70
+ (0, typeorm_1.Column)({
71
+ type: "int",
72
+ nullable: true,
73
+ comment: "Tokens de salida que cobró el proveedor (incluye el razonamiento del modelo). NULL si el proveedor no cobra por tokens.",
74
+ }),
75
+ __metadata("design:type", Object)
76
+ ], CompanyAiUsage.prototype, "output_tokens", void 0);
46
77
  __decorate([
47
78
  (0, typeorm_1.Column)({ type: "datetime", default: () => "CURRENT_TIMESTAMP", comment: "Fecha de creación del registro." }),
48
79
  __metadata("design:type", Date)
49
80
  ], CompanyAiUsage.prototype, "created", void 0);
50
81
  exports.CompanyAiUsage = CompanyAiUsage = __decorate([
51
82
  (0, typeorm_1.Entity)({
52
- comment: "Usos de IA que cuentan contra el cupo del plan: notas de voz y mejoras de texto.",
83
+ comment: "Usos de IA que cuentan contra el cupo del plan: notas de voz, mejoras de texto y lecturas de equipos.",
53
84
  name: "company_ai_usage",
54
85
  }),
55
86
  (0, typeorm_1.Index)("IDX_company_ai_usage_company", ["company", "resource_type", "created"])
@@ -30,7 +30,7 @@ __decorate([
30
30
  __decorate([
31
31
  (0, typeorm_1.Column)({
32
32
  type: "int",
33
- comment: "Recurso que se ajusta (mismos números que subscription_addon.addon_type):\r\n9: Análisis con IA.\r\n10: Notas de voz con IA.\r\n11: Mejoras de texto con IA.",
33
+ comment: "Recurso que se ajusta (mismos números que subscription_addon.addon_type):\r\n9: Análisis con IA.\r\n10: Notas de voz con IA.\r\n11: Mejoras de texto con IA.\r\n12: Lecturas de equipos con IA.",
34
34
  }),
35
35
  __metadata("design:type", Number)
36
36
  ], CompanyQuotaAdjustment.prototype, "resource_type", void 0);
@@ -0,0 +1,10 @@
1
+ export declare class EquipmentType {
2
+ id: number;
3
+ name: string;
4
+ reading_schema: number;
5
+ icon: string | null;
6
+ details: any | null;
7
+ status: number;
8
+ created: Date;
9
+ updated: Date | null;
10
+ }
@@ -0,0 +1,69 @@
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.EquipmentType = void 0;
13
+ const typeorm_1 = require("typeorm");
14
+ // DOC: Catálogo de Worklip (sql/81): qué equipos existen y qué forma tiene su lectura (`equipment.rules.ts`).
15
+ let EquipmentType = class EquipmentType {
16
+ };
17
+ exports.EquipmentType = EquipmentType;
18
+ __decorate([
19
+ (0, typeorm_1.PrimaryGeneratedColumn)({ type: "int", comment: "Número de identificación (ID) único de cada registro." }),
20
+ __metadata("design:type", Number)
21
+ ], EquipmentType.prototype, "id", void 0);
22
+ __decorate([
23
+ (0, typeorm_1.Column)({ type: "varchar", length: 80, comment: "Nombre del tipo de equipo." }),
24
+ __metadata("design:type", String)
25
+ ], EquipmentType.prototype, "name", void 0);
26
+ __decorate([
27
+ (0, typeorm_1.Column)({
28
+ type: "int",
29
+ comment: "Forma de la lectura:\r\n1: Escáner (sistemas y códigos).\r\n2: Probador de baterías.\r\n3: Alineadora (medidas con rango).\r\n4: Lista de medidas con rango (balanceo, gases, frenos…).",
30
+ }),
31
+ __metadata("design:type", Number)
32
+ ], EquipmentType.prototype, "reading_schema", void 0);
33
+ __decorate([
34
+ (0, typeorm_1.Column)({ type: "varchar", length: 40, nullable: true, default: null, comment: "Ícono (PrimeIcons, sin el prefijo pi-)." }),
35
+ __metadata("design:type", Object)
36
+ ], EquipmentType.prototype, "icon", void 0);
37
+ __decorate([
38
+ (0, typeorm_1.Column)({
39
+ type: "json",
40
+ nullable: true,
41
+ default: null,
42
+ comment: "vehicle_types: tipos de vehículo donde aplica (null = todos). ai_hint: pista extra para leer la foto.",
43
+ }),
44
+ __metadata("design:type", Object)
45
+ ], EquipmentType.prototype, "details", void 0);
46
+ __decorate([
47
+ (0, typeorm_1.Column)({ type: "int", width: 1, default: 1, comment: "Estado:\r\n1: Activo.\r\n0: Inactivo." }),
48
+ __metadata("design:type", Number)
49
+ ], EquipmentType.prototype, "status", void 0);
50
+ __decorate([
51
+ (0, typeorm_1.Column)({ type: "datetime", default: () => "CURRENT_TIMESTAMP", comment: "Fecha de creación del registro." }),
52
+ __metadata("design:type", Date)
53
+ ], EquipmentType.prototype, "created", void 0);
54
+ __decorate([
55
+ (0, typeorm_1.Column)({
56
+ type: "datetime",
57
+ nullable: true,
58
+ default: null,
59
+ onUpdate: "CURRENT_TIMESTAMP",
60
+ comment: "Fecha de la última actualización del registro.",
61
+ }),
62
+ __metadata("design:type", Object)
63
+ ], EquipmentType.prototype, "updated", void 0);
64
+ exports.EquipmentType = EquipmentType = __decorate([
65
+ (0, typeorm_1.Entity)({
66
+ comment: "Tipos de equipo del taller (escáner, probador de baterías, alineadora…). Catálogo de Worklip.",
67
+ name: "equipment_type",
68
+ })
69
+ ], EquipmentType);
@@ -0,0 +1,5 @@
1
+ export declare class ObdCode {
2
+ id: number;
3
+ code: string;
4
+ description: string;
5
+ }
@@ -0,0 +1,33 @@
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.ObdCode = void 0;
13
+ const typeorm_1 = require("typeorm");
14
+ // DOC: Significado en español de los códigos genéricos (SAE J2012). Los propios de marca no están.
15
+ let ObdCode = class ObdCode {
16
+ };
17
+ exports.ObdCode = ObdCode;
18
+ __decorate([
19
+ (0, typeorm_1.PrimaryGeneratedColumn)({ type: "int", comment: "Número de identificación (ID) único de cada registro." }),
20
+ __metadata("design:type", Number)
21
+ ], ObdCode.prototype, "id", void 0);
22
+ __decorate([
23
+ (0, typeorm_1.Column)({ type: "varchar", length: 5, comment: "Código (ej. P0301)." }),
24
+ __metadata("design:type", String)
25
+ ], ObdCode.prototype, "code", void 0);
26
+ __decorate([
27
+ (0, typeorm_1.Column)({ type: "varchar", length: 255, comment: "Qué significa, en español." }),
28
+ __metadata("design:type", String)
29
+ ], ObdCode.prototype, "description", void 0);
30
+ exports.ObdCode = ObdCode = __decorate([
31
+ (0, typeorm_1.Entity)({ comment: "Catálogo de códigos de falla OBD2 genéricos, en español.", name: "obd_code" }),
32
+ (0, typeorm_1.Unique)("UQ_obd_code_code", ["code"])
33
+ ], ObdCode);
@@ -60,6 +60,7 @@ export declare class ServiceOrder {
60
60
  reinspection_of: ServiceOrder | null;
61
61
  insurer: Insurer | null;
62
62
  claim_number: string | null;
63
+ outside_since: Date | null;
63
64
  stages: ServiceOrderStage[];
64
65
  workboard_events: WorkboardEvent[];
65
66
  service_order_history: ServiceOrderHistory[];
@@ -320,6 +320,15 @@ __decorate([
320
320
  }),
321
321
  __metadata("design:type", Object)
322
322
  ], ServiceOrder.prototype, "claim_number", void 0);
323
+ __decorate([
324
+ (0, typeorm_1.Column)({
325
+ type: "datetime",
326
+ nullable: true,
327
+ default: null,
328
+ comment: "Desde cuándo está el vehículo fuera del taller (salida temporal abierta). NULL: está en el taller.",
329
+ }),
330
+ __metadata("design:type", Object)
331
+ ], ServiceOrder.prototype, "outside_since", void 0);
323
332
  __decorate([
324
333
  (0, typeorm_1.OneToMany)(() => ServiceOrderStage_1.ServiceOrderStage, (stage) => stage.service_order),
325
334
  __metadata("design:type", Array)
@@ -356,7 +365,10 @@ exports.ServiceOrder = ServiceOrder = __decorate([
356
365
  (0, typeorm_1.Index)("UQ_service_order_visit_sequence", ["workshop", "visit_year", "visit_sequence"], { unique: true })
357
366
  // DOC: Para buscar/ordenar por el número dentro de un taller sin escanear la tabla.
358
367
  ,
359
- (0, typeorm_1.Index)("IDX_service_order_visit_number", ["workshop", "visit_number"]),
368
+ (0, typeorm_1.Index)("IDX_service_order_visit_number", ["workshop", "visit_number"])
369
+ // DOC: «Los vehículos fuera del taller de esta sede», para la tabla, el aviso y las métricas.
370
+ ,
371
+ (0, typeorm_1.Index)("IDX_service_order_outside", ["workshop", "outside_since"]),
360
372
  (0, typeorm_1.Entity)({
361
373
  comment: "Órdenes de servicio del concesionario/taller.",
362
374
  name: "service_order",
@@ -0,0 +1,41 @@
1
+ import { Associate } from "./Associate";
2
+ import { Client } from "./Client";
3
+ import { ServiceOrder } from "./ServiceOrder";
4
+ import { WorkboardStatus } from "./WorkboardStatus";
5
+ import { Workshop } from "./Workshop";
6
+ /**
7
+ * DOC: UNA SALIDA TEMPORAL del vehículo con la visita abierta, y su reingreso (sql/84).
8
+ *
9
+ * Lo que se llena (inventario, fotos, firma) va en las COPIAS de las secciones de ingreso y salida
10
+ * dentro de `service_order.data`; esta fila es el registro corto para filtrar, contar y medir sin
11
+ * leer ese JSON. `returned_at` NULL = el vehículo sigue afuera, y `service_order.outside_since` lo
12
+ * repite para la tabla de visitas.
13
+ *
14
+ * Quien se lo lleva o lo trae se guarda COPIADO (nombre y documento) aunque se escoja de la lista
15
+ * de clientes: es la constancia de ese día, y la ficha del cliente puede cambiar después.
16
+ */
17
+ export declare class ServiceOrderOuting {
18
+ id: number;
19
+ service_order: ServiceOrder;
20
+ workshop: Workshop;
21
+ left_at: Date;
22
+ left_by: Associate;
23
+ left_mileage: number | null;
24
+ left_client: Client | null;
25
+ left_person_name: string;
26
+ left_person_document_type: string | null;
27
+ left_person_document: string | null;
28
+ left_section: string | null;
29
+ left_workboard_status: WorkboardStatus | null;
30
+ note: string | null;
31
+ returned_at: Date | null;
32
+ returned_by: Associate | null;
33
+ returned_mileage: number | null;
34
+ returned_client: Client | null;
35
+ returned_person_name: string | null;
36
+ returned_person_document_type: string | null;
37
+ returned_person_document: string | null;
38
+ returned_section: string | null;
39
+ created: Date;
40
+ updated: Date | null;
41
+ }
@@ -0,0 +1,184 @@
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.ServiceOrderOuting = void 0;
13
+ const typeorm_1 = require("typeorm");
14
+ const Associate_1 = require("./Associate");
15
+ const Client_1 = require("./Client");
16
+ const ServiceOrder_1 = require("./ServiceOrder");
17
+ const WorkboardStatus_1 = require("./WorkboardStatus");
18
+ const Workshop_1 = require("./Workshop");
19
+ /**
20
+ * DOC: UNA SALIDA TEMPORAL del vehículo con la visita abierta, y su reingreso (sql/84).
21
+ *
22
+ * Lo que se llena (inventario, fotos, firma) va en las COPIAS de las secciones de ingreso y salida
23
+ * dentro de `service_order.data`; esta fila es el registro corto para filtrar, contar y medir sin
24
+ * leer ese JSON. `returned_at` NULL = el vehículo sigue afuera, y `service_order.outside_since` lo
25
+ * repite para la tabla de visitas.
26
+ *
27
+ * Quien se lo lleva o lo trae se guarda COPIADO (nombre y documento) aunque se escoja de la lista
28
+ * de clientes: es la constancia de ese día, y la ficha del cliente puede cambiar después.
29
+ */
30
+ let ServiceOrderOuting = class ServiceOrderOuting {
31
+ };
32
+ exports.ServiceOrderOuting = ServiceOrderOuting;
33
+ __decorate([
34
+ (0, typeorm_1.PrimaryGeneratedColumn)({ type: "int", comment: "Número de identificación (ID) único de cada registro." }),
35
+ __metadata("design:type", Number)
36
+ ], ServiceOrderOuting.prototype, "id", void 0);
37
+ __decorate([
38
+ (0, typeorm_1.ManyToOne)(() => ServiceOrder_1.ServiceOrder, { onDelete: "CASCADE", onUpdate: "NO ACTION" }),
39
+ (0, typeorm_1.JoinColumn)({ name: "service_order" }),
40
+ __metadata("design:type", ServiceOrder_1.ServiceOrder)
41
+ ], ServiceOrderOuting.prototype, "service_order", void 0);
42
+ __decorate([
43
+ (0, typeorm_1.ManyToOne)(() => Workshop_1.Workshop, { onDelete: "CASCADE", onUpdate: "NO ACTION" }),
44
+ (0, typeorm_1.JoinColumn)({ name: "workshop" }),
45
+ __metadata("design:type", Workshop_1.Workshop)
46
+ ], ServiceOrderOuting.prototype, "workshop", void 0);
47
+ __decorate([
48
+ (0, typeorm_1.Column)({ type: "datetime", default: () => "CURRENT_TIMESTAMP", comment: "Cuándo salió el vehículo del taller." }),
49
+ __metadata("design:type", Date)
50
+ ], ServiceOrderOuting.prototype, "left_at", void 0);
51
+ __decorate([
52
+ (0, typeorm_1.ManyToOne)(() => Associate_1.Associate, { onDelete: "RESTRICT", onUpdate: "NO ACTION" }),
53
+ (0, typeorm_1.JoinColumn)({ name: "left_by" }),
54
+ __metadata("design:type", Associate_1.Associate)
55
+ ], ServiceOrderOuting.prototype, "left_by", void 0);
56
+ __decorate([
57
+ (0, typeorm_1.Column)({ type: "int", nullable: true, default: null, comment: "Kilometraje al salir." }),
58
+ __metadata("design:type", Object)
59
+ ], ServiceOrderOuting.prototype, "left_mileage", void 0);
60
+ __decorate([
61
+ (0, typeorm_1.ManyToOne)(() => Client_1.Client, { onDelete: "SET NULL", onUpdate: "NO ACTION", nullable: true }),
62
+ (0, typeorm_1.JoinColumn)({ name: "left_client" }),
63
+ __metadata("design:type", Object)
64
+ ], ServiceOrderOuting.prototype, "left_client", void 0);
65
+ __decorate([
66
+ (0, typeorm_1.Column)({
67
+ type: "varchar",
68
+ length: 150,
69
+ comment: "Nombre de quien se lo llevó (copiado del cliente si se escogió de la lista).",
70
+ }),
71
+ __metadata("design:type", String)
72
+ ], ServiceOrderOuting.prototype, "left_person_name", void 0);
73
+ __decorate([
74
+ (0, typeorm_1.Column)({
75
+ type: "varchar",
76
+ length: 10,
77
+ nullable: true,
78
+ default: null,
79
+ comment: "Tipo de documento de quien se lo llevó (C.C, PASAPORTE...), como client.document_type.",
80
+ }),
81
+ __metadata("design:type", Object)
82
+ ], ServiceOrderOuting.prototype, "left_person_document_type", void 0);
83
+ __decorate([
84
+ (0, typeorm_1.Column)({ type: "varchar", length: 30, nullable: true, default: null, comment: "Documento de quien se lo llevó." }),
85
+ __metadata("design:type", Object)
86
+ ], ServiceOrderOuting.prototype, "left_person_document", void 0);
87
+ __decorate([
88
+ (0, typeorm_1.Column)({
89
+ type: "varchar",
90
+ length: 120,
91
+ nullable: true,
92
+ default: null,
93
+ comment: "Id de la copia de la sección de salida dentro de service_order.data.",
94
+ }),
95
+ __metadata("design:type", Object)
96
+ ], ServiceOrderOuting.prototype, "left_section", void 0);
97
+ __decorate([
98
+ (0, typeorm_1.ManyToOne)(() => WorkboardStatus_1.WorkboardStatus, { onDelete: "SET NULL", onUpdate: "NO ACTION", nullable: true }),
99
+ (0, typeorm_1.JoinColumn)({ name: "left_workboard_status" }),
100
+ __metadata("design:type", Object)
101
+ ], ServiceOrderOuting.prototype, "left_workboard_status", void 0);
102
+ __decorate([
103
+ (0, typeorm_1.Column)({
104
+ type: "varchar",
105
+ length: 500,
106
+ nullable: true,
107
+ default: null,
108
+ comment: "Motivo u observación de la salida (p. ej. esperando repuestos).",
109
+ }),
110
+ __metadata("design:type", Object)
111
+ ], ServiceOrderOuting.prototype, "note", void 0);
112
+ __decorate([
113
+ (0, typeorm_1.Column)({
114
+ type: "datetime",
115
+ nullable: true,
116
+ default: null,
117
+ comment: "Cuándo volvió. NULL: el vehículo sigue fuera del taller.",
118
+ }),
119
+ __metadata("design:type", Object)
120
+ ], ServiceOrderOuting.prototype, "returned_at", void 0);
121
+ __decorate([
122
+ (0, typeorm_1.ManyToOne)(() => Associate_1.Associate, { onDelete: "RESTRICT", onUpdate: "NO ACTION", nullable: true }),
123
+ (0, typeorm_1.JoinColumn)({ name: "returned_by" }),
124
+ __metadata("design:type", Object)
125
+ ], ServiceOrderOuting.prototype, "returned_by", void 0);
126
+ __decorate([
127
+ (0, typeorm_1.Column)({ type: "int", nullable: true, default: null, comment: "Kilometraje al volver." }),
128
+ __metadata("design:type", Object)
129
+ ], ServiceOrderOuting.prototype, "returned_mileage", void 0);
130
+ __decorate([
131
+ (0, typeorm_1.ManyToOne)(() => Client_1.Client, { onDelete: "SET NULL", onUpdate: "NO ACTION", nullable: true }),
132
+ (0, typeorm_1.JoinColumn)({ name: "returned_client" }),
133
+ __metadata("design:type", Object)
134
+ ], ServiceOrderOuting.prototype, "returned_client", void 0);
135
+ __decorate([
136
+ (0, typeorm_1.Column)({ type: "varchar", length: 150, nullable: true, default: null, comment: "Nombre de quien lo trajo." }),
137
+ __metadata("design:type", Object)
138
+ ], ServiceOrderOuting.prototype, "returned_person_name", void 0);
139
+ __decorate([
140
+ (0, typeorm_1.Column)({
141
+ type: "varchar",
142
+ length: 10,
143
+ nullable: true,
144
+ default: null,
145
+ comment: "Tipo de documento de quien lo trajo.",
146
+ }),
147
+ __metadata("design:type", Object)
148
+ ], ServiceOrderOuting.prototype, "returned_person_document_type", void 0);
149
+ __decorate([
150
+ (0, typeorm_1.Column)({ type: "varchar", length: 30, nullable: true, default: null, comment: "Documento de quien lo trajo." }),
151
+ __metadata("design:type", Object)
152
+ ], ServiceOrderOuting.prototype, "returned_person_document", void 0);
153
+ __decorate([
154
+ (0, typeorm_1.Column)({
155
+ type: "varchar",
156
+ length: 120,
157
+ nullable: true,
158
+ default: null,
159
+ comment: "Id de la copia de la sección de ingreso dentro de service_order.data.",
160
+ }),
161
+ __metadata("design:type", Object)
162
+ ], ServiceOrderOuting.prototype, "returned_section", void 0);
163
+ __decorate([
164
+ (0, typeorm_1.Column)({ type: "datetime", default: () => "CURRENT_TIMESTAMP", comment: "Fecha de creación del registro." }),
165
+ __metadata("design:type", Date)
166
+ ], ServiceOrderOuting.prototype, "created", void 0);
167
+ __decorate([
168
+ (0, typeorm_1.Column)({
169
+ type: "datetime",
170
+ nullable: true,
171
+ default: null,
172
+ onUpdate: "CURRENT_TIMESTAMP",
173
+ comment: "Fecha de actualización del registro.",
174
+ }),
175
+ __metadata("design:type", Object)
176
+ ], ServiceOrderOuting.prototype, "updated", void 0);
177
+ exports.ServiceOrderOuting = ServiceOrderOuting = __decorate([
178
+ (0, typeorm_1.Index)("IDX_service_order_outing_order", ["service_order", "returned_at"]),
179
+ (0, typeorm_1.Index)("IDX_service_order_outing_workshop", ["workshop", "returned_at"]),
180
+ (0, typeorm_1.Entity)({
181
+ comment: "Salidas temporales del vehículo con la visita abierta (en pausa) y su reingreso.",
182
+ name: "service_order_outing",
183
+ })
184
+ ], ServiceOrderOuting);
@@ -9,6 +9,7 @@ export declare class ServiceOrderPart {
9
9
  quantity: string;
10
10
  state: number;
11
11
  expected_date: string | null;
12
+ ordered_at: Date | null;
12
13
  received_at: Date | null;
13
14
  received_by: Associate | null;
14
15
  note: string | null;
@@ -89,6 +89,15 @@ __decorate([
89
89
  }),
90
90
  __metadata("design:type", Object)
91
91
  ], ServiceOrderPart.prototype, "expected_date", void 0);
92
+ __decorate([
93
+ (0, typeorm_1.Column)({
94
+ type: "datetime",
95
+ nullable: true,
96
+ default: null,
97
+ comment: "Cuándo pasó a Pedido (o se creó ya pedido). NULL en los anteriores a sql/84: no entran en el promedio de llegada.",
98
+ }),
99
+ __metadata("design:type", Object)
100
+ ], ServiceOrderPart.prototype, "ordered_at", void 0);
92
101
  __decorate([
93
102
  (0, typeorm_1.Column)({
94
103
  type: "datetime",
@@ -43,7 +43,7 @@ __decorate([
43
43
  __decorate([
44
44
  (0, typeorm_1.Column)({
45
45
  type: "int",
46
- comment: "Tipo de complemento de suscripción:\r\n1. STORAGE_GB.\r\n2. WHATSAPP_MESSAGES.\r\n3. EMAIL_MESSAGES.\r\n4. USERS.\r\n5. WORKSHOPS.\r\n6. RETIRADO (eran minutos de notas de voz; NO reutilizar: hay filas vendidas con este valor).\r\n7. VISITS.\r\n8. CHATBOT_MESSAGES (respuestas del bot; NO es el 2, que son las notificaciones por plantilla).\r\n9. AI_ANALYSES (análisis con IA del Historial inteligente).\r\n10. VOICE_NOTES (notas de voz con IA).\r\n11. TEXT_IMPROVEMENTS (mejoras de texto con IA).",
46
+ comment: "Tipo de complemento de suscripción:\r\n1. STORAGE_GB.\r\n2. WHATSAPP_MESSAGES.\r\n3. EMAIL_MESSAGES.\r\n4. USERS.\r\n5. WORKSHOPS.\r\n6. RETIRADO (eran minutos de notas de voz; NO reutilizar: hay filas vendidas con este valor).\r\n7. VISITS.\r\n8. CHATBOT_MESSAGES (respuestas del bot; NO es el 2, que son las notificaciones por plantilla).\r\n9. AI_ANALYSES (análisis con IA del Historial inteligente).\r\n10. VOICE_NOTES (notas de voz con IA).\r\n11. TEXT_IMPROVEMENTS (mejoras de texto con IA).\r\n12. EQUIPMENT_READINGS (lecturas de equipos con IA).",
47
47
  }),
48
48
  __metadata("design:type", Number)
49
49
  ], SubscriptionAddon.prototype, "addon_type", void 0);
@@ -51,7 +51,7 @@ __decorate([
51
51
  __decorate([
52
52
  (0, typeorm_1.Column)({
53
53
  type: "int",
54
- comment: "Tipo de recurso:\r\n1. STORAGE_GB.\r\n2. WHATSAPP_MESSAGES.\r\n3. EMAIL_MESSAGES.\r\n4. USERS.\r\n5. WORKSHOPS.\r\n6. RETIRADO (eran minutos de notas de voz; NO reutilizar).\r\n7. VISITS.\r\n8. CHATBOT_MESSAGES (respuestas del bot; NO es el 2, que son las notificaciones por plantilla).\r\n9. AI_ANALYSES (análisis con IA del Historial inteligente).\r\n10. VOICE_NOTES (notas de voz con IA).\r\n11. TEXT_IMPROVEMENTS (mejoras de texto con IA).",
54
+ comment: "Tipo de recurso:\r\n1. STORAGE_GB.\r\n2. WHATSAPP_MESSAGES.\r\n3. EMAIL_MESSAGES.\r\n4. USERS.\r\n5. WORKSHOPS.\r\n6. RETIRADO (eran minutos de notas de voz; NO reutilizar).\r\n7. VISITS.\r\n8. CHATBOT_MESSAGES (respuestas del bot; NO es el 2, que son las notificaciones por plantilla).\r\n9. AI_ANALYSES (análisis con IA del Historial inteligente).\r\n10. VOICE_NOTES (notas de voz con IA).\r\n11. TEXT_IMPROVEMENTS (mejoras de texto con IA).\r\n12. EQUIPMENT_READINGS (lecturas de equipos con IA).",
55
55
  }),
56
56
  __metadata("design:type", Number)
57
57
  ], SubscriptionAddonTemplate.prototype, "addon_type", void 0);
@@ -34,7 +34,7 @@ __decorate([
34
34
  __decorate([
35
35
  (0, typeorm_1.Column)({
36
36
  type: "int",
37
- comment: "Tipo de recurso:\r\n1. STORAGE_GB.\r\n2. WHATSAPP_MESSAGES.\r\n3. EMAIL_MESSAGES.\r\n4. USERS.\r\n5. WORKSHOPS.\r\n6. RETIRADO (eran segundos de notas de voz; NO reutilizar).\r\n7. VISITS.\r\n8. CHATBOT_MESSAGES (respuestas del bot; NO es el 2, que son las notificaciones por plantilla).\r\n9. AI_ANALYSES (análisis con IA del Historial inteligente).\r\n10. VOICE_NOTES (notas de voz con IA).\r\n11. TEXT_IMPROVEMENTS (mejoras de texto con IA).",
37
+ comment: "Tipo de recurso:\r\n1. STORAGE_GB.\r\n2. WHATSAPP_MESSAGES.\r\n3. EMAIL_MESSAGES.\r\n4. USERS.\r\n5. WORKSHOPS.\r\n6. RETIRADO (eran segundos de notas de voz; NO reutilizar).\r\n7. VISITS.\r\n8. CHATBOT_MESSAGES (respuestas del bot; NO es el 2, que son las notificaciones por plantilla).\r\n9. AI_ANALYSES (análisis con IA del Historial inteligente).\r\n10. VOICE_NOTES (notas de voz con IA).\r\n11. TEXT_IMPROVEMENTS (mejoras de texto con IA).\r\n12. EQUIPMENT_READINGS (lecturas de equipos con IA).",
38
38
  }),
39
39
  __metadata("design:type", Number)
40
40
  ], UsageAlert.prototype, "resource_type", void 0);
@@ -11,6 +11,7 @@ export declare class Vehicle {
11
11
  vehicle_type: VehicleType;
12
12
  plate: string | null;
13
13
  serial: string | null;
14
+ vin: string | null;
14
15
  brand: Brand;
15
16
  company: Company | null;
16
17
  created_by: Associate | null;
@@ -60,6 +60,16 @@ __decorate([
60
60
  }),
61
61
  __metadata("design:type", Object)
62
62
  ], Vehicle.prototype, "serial", void 0);
63
+ __decorate([
64
+ (0, typeorm_1.Column)({
65
+ length: 17,
66
+ type: "varchar",
67
+ nullable: true,
68
+ default: null,
69
+ comment: "VIN leído por un equipo o traído del RUNT. No es único.",
70
+ }),
71
+ __metadata("design:type", Object)
72
+ ], Vehicle.prototype, "vin", void 0);
63
73
  __decorate([
64
74
  (0, typeorm_1.ManyToOne)(() => Brand_1.Brand, (brand) => brand.vehicles, {
65
75
  onDelete: "RESTRICT",
@@ -0,0 +1,39 @@
1
+ import { Associate } from "./Associate";
2
+ import { Company } from "./Company";
3
+ import { EquipmentType } from "./EquipmentType";
4
+ import { ServiceOrder } from "./ServiceOrder";
5
+ import { Vehicle } from "./Vehicle";
6
+ import { Workshop } from "./Workshop";
7
+ import { WorkshopEquipment } from "./WorkshopEquipment";
8
+ /**
9
+ * DOC: Una medición de un equipo (sql/81). Va aparte del `data` de la visita: es del VEHÍCULO (para la
10
+ * tendencia entre visitas) y no engorda el JSON que lee el tablero. Los números en `equipment.rules.ts`.
11
+ */
12
+ export declare class VehicleMeasurement {
13
+ id: number;
14
+ company: Company;
15
+ workshop: Workshop;
16
+ vehicle: Vehicle | null;
17
+ service_order: ServiceOrder | null;
18
+ item_id: string | null;
19
+ equipment_type: EquipmentType;
20
+ workshop_equipment: WorkshopEquipment | null;
21
+ moment: number;
22
+ source: number;
23
+ origin: number;
24
+ status: number;
25
+ result: number | null;
26
+ data: any | null;
27
+ summary: string | null;
28
+ files: any | null;
29
+ vin: string | null;
30
+ vin_check: number | null;
31
+ ai_units: number;
32
+ email_from: string | null;
33
+ error_code: string | null;
34
+ created_by: Associate | null;
35
+ confirmed_by: Associate | null;
36
+ confirmed_at: Date | null;
37
+ created: Date;
38
+ updated: Date | null;
39
+ }