@asumano/worklip-typeorm-db 1.1.104 → 1.1.106

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.
@@ -10,5 +10,6 @@ export declare class AssociateNotification {
10
10
  params: Record<string, unknown> | null;
11
11
  url: string | null;
12
12
  read_at: Date | null;
13
+ deleted_at: Date | null;
13
14
  created: Date;
14
15
  }
@@ -60,6 +60,10 @@ __decorate([
60
60
  (0, typeorm_1.Column)({ type: "datetime", nullable: true, default: null, comment: "Cuándo lo leyó. NULL = sin leer." }),
61
61
  __metadata("design:type", Object)
62
62
  ], AssociateNotification.prototype, "read_at", void 0);
63
+ __decorate([
64
+ (0, typeorm_1.Column)({ type: "datetime", nullable: true, default: null, comment: "Cuándo lo eliminó. NULL = visible." }),
65
+ __metadata("design:type", Object)
66
+ ], AssociateNotification.prototype, "deleted_at", void 0);
63
67
  __decorate([
64
68
  (0, typeorm_1.Column)({ type: "datetime", comment: "Fecha de creación del registro.", default: () => "CURRENT_TIMESTAMP" }),
65
69
  __metadata("design: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);
@@ -6,5 +6,6 @@ export declare class MasterNotification {
6
6
  params: Record<string, unknown> | null;
7
7
  url: string | null;
8
8
  read_at: Date | null;
9
+ deleted_at: Date | null;
9
10
  created: Date;
10
11
  }
@@ -47,6 +47,10 @@ __decorate([
47
47
  (0, typeorm_1.Column)({ type: "datetime", nullable: true, default: null, comment: "Cuándo lo leyó. NULL = sin leer." }),
48
48
  __metadata("design:type", Object)
49
49
  ], MasterNotification.prototype, "read_at", void 0);
50
+ __decorate([
51
+ (0, typeorm_1.Column)({ type: "datetime", nullable: true, default: null, comment: "Cuándo lo eliminó. NULL = visible." }),
52
+ __metadata("design:type", Object)
53
+ ], MasterNotification.prototype, "deleted_at", void 0);
50
54
  __decorate([
51
55
  (0, typeorm_1.Column)({ type: "datetime", comment: "Fecha de creación del registro.", default: () => "CURRENT_TIMESTAMP" }),
52
56
  __metadata("design:type", Date)
@@ -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);
@@ -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
+ }
@@ -0,0 +1,171 @@
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.VehicleMeasurement = void 0;
13
+ const typeorm_1 = require("typeorm");
14
+ const Associate_1 = require("./Associate");
15
+ const Company_1 = require("./Company");
16
+ const EquipmentType_1 = require("./EquipmentType");
17
+ const ServiceOrder_1 = require("./ServiceOrder");
18
+ const Vehicle_1 = require("./Vehicle");
19
+ const Workshop_1 = require("./Workshop");
20
+ const WorkshopEquipment_1 = require("./WorkshopEquipment");
21
+ /**
22
+ * DOC: Una medición de un equipo (sql/81). Va aparte del `data` de la visita: es del VEHÍCULO (para la
23
+ * tendencia entre visitas) y no engorda el JSON que lee el tablero. Los números en `equipment.rules.ts`.
24
+ */
25
+ let VehicleMeasurement = class VehicleMeasurement {
26
+ };
27
+ exports.VehicleMeasurement = VehicleMeasurement;
28
+ __decorate([
29
+ (0, typeorm_1.PrimaryGeneratedColumn)({ type: "int", comment: "Número de identificación (ID) único de cada registro." }),
30
+ __metadata("design:type", Number)
31
+ ], VehicleMeasurement.prototype, "id", void 0);
32
+ __decorate([
33
+ (0, typeorm_1.ManyToOne)(() => Company_1.Company, { onDelete: "CASCADE", onUpdate: "NO ACTION" }),
34
+ (0, typeorm_1.JoinColumn)({ name: "company" }),
35
+ __metadata("design:type", Company_1.Company)
36
+ ], VehicleMeasurement.prototype, "company", void 0);
37
+ __decorate([
38
+ (0, typeorm_1.ManyToOne)(() => Workshop_1.Workshop, { onDelete: "CASCADE", onUpdate: "NO ACTION" }),
39
+ (0, typeorm_1.JoinColumn)({ name: "workshop" }),
40
+ __metadata("design:type", Workshop_1.Workshop)
41
+ ], VehicleMeasurement.prototype, "workshop", void 0);
42
+ __decorate([
43
+ (0, typeorm_1.ManyToOne)(() => Vehicle_1.Vehicle, { onDelete: "CASCADE", onUpdate: "NO ACTION", nullable: true }),
44
+ (0, typeorm_1.JoinColumn)({ name: "vehicle" }),
45
+ __metadata("design:type", Object)
46
+ ], VehicleMeasurement.prototype, "vehicle", void 0);
47
+ __decorate([
48
+ (0, typeorm_1.ManyToOne)(() => ServiceOrder_1.ServiceOrder, { onDelete: "SET NULL", onUpdate: "NO ACTION", nullable: true }),
49
+ (0, typeorm_1.JoinColumn)({ name: "service_order" }),
50
+ __metadata("design:type", Object)
51
+ ], VehicleMeasurement.prototype, "service_order", void 0);
52
+ __decorate([
53
+ (0, typeorm_1.Column)({
54
+ type: "varchar",
55
+ length: 40,
56
+ nullable: true,
57
+ default: null,
58
+ comment: "Ítem de la visita (IVisitItem.id) al que alimenta. NULL = medición suelta.",
59
+ }),
60
+ __metadata("design:type", Object)
61
+ ], VehicleMeasurement.prototype, "item_id", void 0);
62
+ __decorate([
63
+ (0, typeorm_1.ManyToOne)(() => EquipmentType_1.EquipmentType, { onDelete: "RESTRICT", onUpdate: "NO ACTION" }),
64
+ (0, typeorm_1.JoinColumn)({ name: "equipment_type" }),
65
+ __metadata("design:type", EquipmentType_1.EquipmentType)
66
+ ], VehicleMeasurement.prototype, "equipment_type", void 0);
67
+ __decorate([
68
+ (0, typeorm_1.ManyToOne)(() => WorkshopEquipment_1.WorkshopEquipment, { onDelete: "SET NULL", onUpdate: "NO ACTION", nullable: true }),
69
+ (0, typeorm_1.JoinColumn)({ name: "workshop_equipment" }),
70
+ __metadata("design:type", Object)
71
+ ], VehicleMeasurement.prototype, "workshop_equipment", void 0);
72
+ __decorate([
73
+ (0, typeorm_1.Column)({ type: "int", default: 1, comment: "Momento:\r\n1: Única.\r\n2: Antes del trabajo.\r\n3: Después del trabajo." }),
74
+ __metadata("design:type", Number)
75
+ ], VehicleMeasurement.prototype, "moment", void 0);
76
+ __decorate([
77
+ (0, typeorm_1.Column)({ type: "int", comment: "Fuente:\r\n1: Foto.\r\n2: PDF.\r\n3: En vivo (adaptador OBD2).\r\n4: Digitada a mano." }),
78
+ __metadata("design:type", Number)
79
+ ], VehicleMeasurement.prototype, "source", void 0);
80
+ __decorate([
81
+ (0, typeorm_1.Column)({ type: "int", default: 1, comment: "Origen:\r\n1: Desde la aplicación.\r\n2: Por correo." }),
82
+ __metadata("design:type", Number)
83
+ ], VehicleMeasurement.prototype, "origin", void 0);
84
+ __decorate([
85
+ (0, typeorm_1.Column)({
86
+ type: "int",
87
+ default: 1,
88
+ comment: "Estado:\r\n1: Leyendo.\r\n2: Por confirmar.\r\n3: Confirmada.\r\n4: No se pudo leer.\r\n5: Descartada.",
89
+ }),
90
+ __metadata("design:type", Number)
91
+ ], VehicleMeasurement.prototype, "status", void 0);
92
+ __decorate([
93
+ (0, typeorm_1.Column)({
94
+ type: "int",
95
+ nullable: true,
96
+ default: null,
97
+ comment: "Resultado:\r\n1: Bueno.\r\n2: Regular.\r\n3: Malo.\r\nNULL: sin evaluar.",
98
+ }),
99
+ __metadata("design:type", Object)
100
+ ], VehicleMeasurement.prototype, "result", void 0);
101
+ __decorate([
102
+ (0, typeorm_1.Column)({ type: "json", nullable: true, default: null, comment: "La lectura, con la forma del tipo de equipo." }),
103
+ __metadata("design:type", Object)
104
+ ], VehicleMeasurement.prototype, "data", void 0);
105
+ __decorate([
106
+ (0, typeorm_1.Column)({ type: "varchar", length: 255, nullable: true, default: null, comment: "Resumen corto de la lectura." }),
107
+ __metadata("design:type", Object)
108
+ ], VehicleMeasurement.prototype, "summary", void 0);
109
+ __decorate([
110
+ (0, typeorm_1.Column)({ type: "json", nullable: true, default: null, comment: "Fotos y PDF de la medición (llaves de R2)." }),
111
+ __metadata("design:type", Object)
112
+ ], VehicleMeasurement.prototype, "files", void 0);
113
+ __decorate([
114
+ (0, typeorm_1.Column)({ type: "varchar", length: 17, nullable: true, default: null, comment: "VIN que mostró el equipo." }),
115
+ __metadata("design:type", Object)
116
+ ], VehicleMeasurement.prototype, "vin", void 0);
117
+ __decorate([
118
+ (0, typeorm_1.Column)({
119
+ type: "int",
120
+ nullable: true,
121
+ default: null,
122
+ comment: "Comparación del VIN:\r\n1: Coincide.\r\n2: Sin comparar (no hay VIN registrado).\r\n3: Revisar (posible error de lectura).\r\n4: No corresponde.\r\n5: Ilegible.",
123
+ }),
124
+ __metadata("design:type", Object)
125
+ ], VehicleMeasurement.prototype, "vin_check", void 0);
126
+ __decorate([
127
+ (0, typeorm_1.Column)({ type: "int", default: 0, comment: "Lecturas con IA que gastó (cupo del complemento 12)." }),
128
+ __metadata("design:type", Number)
129
+ ], VehicleMeasurement.prototype, "ai_units", void 0);
130
+ __decorate([
131
+ (0, typeorm_1.Column)({ type: "varchar", length: 150, nullable: true, default: null, comment: "Remitente, si llegó por correo (sql/82)." }),
132
+ __metadata("design:type", Object)
133
+ ], VehicleMeasurement.prototype, "email_from", void 0);
134
+ __decorate([
135
+ (0, typeorm_1.Column)({ type: "varchar", length: 40, nullable: true, default: null, comment: "Código del error si no se pudo leer." }),
136
+ __metadata("design:type", Object)
137
+ ], VehicleMeasurement.prototype, "error_code", void 0);
138
+ __decorate([
139
+ (0, typeorm_1.ManyToOne)(() => Associate_1.Associate, { onDelete: "SET NULL", onUpdate: "NO ACTION", nullable: true }),
140
+ (0, typeorm_1.JoinColumn)({ name: "created_by" }),
141
+ __metadata("design:type", Object)
142
+ ], VehicleMeasurement.prototype, "created_by", void 0);
143
+ __decorate([
144
+ (0, typeorm_1.ManyToOne)(() => Associate_1.Associate, { onDelete: "SET NULL", onUpdate: "NO ACTION", nullable: true }),
145
+ (0, typeorm_1.JoinColumn)({ name: "confirmed_by" }),
146
+ __metadata("design:type", Object)
147
+ ], VehicleMeasurement.prototype, "confirmed_by", void 0);
148
+ __decorate([
149
+ (0, typeorm_1.Column)({ type: "datetime", nullable: true, default: null, comment: "Cuándo se confirmó." }),
150
+ __metadata("design:type", Object)
151
+ ], VehicleMeasurement.prototype, "confirmed_at", void 0);
152
+ __decorate([
153
+ (0, typeorm_1.Column)({ type: "datetime", default: () => "CURRENT_TIMESTAMP", comment: "Fecha de creación del registro." }),
154
+ __metadata("design:type", Date)
155
+ ], VehicleMeasurement.prototype, "created", void 0);
156
+ __decorate([
157
+ (0, typeorm_1.Column)({
158
+ type: "datetime",
159
+ nullable: true,
160
+ default: null,
161
+ onUpdate: "CURRENT_TIMESTAMP",
162
+ comment: "Fecha de la última actualización del registro.",
163
+ }),
164
+ __metadata("design:type", Object)
165
+ ], VehicleMeasurement.prototype, "updated", void 0);
166
+ exports.VehicleMeasurement = VehicleMeasurement = __decorate([
167
+ (0, typeorm_1.Entity)({ comment: "Mediciones de equipos del taller (escáner, batería, alineación…) por vehículo.", name: "vehicle_measurement" }),
168
+ (0, typeorm_1.Index)("IDX_vehicle_measurement_order", ["service_order", "item_id"]),
169
+ (0, typeorm_1.Index)("IDX_vehicle_measurement_vehicle", ["vehicle", "equipment_type", "created"]),
170
+ (0, typeorm_1.Index)("IDX_vehicle_measurement_workshop", ["workshop", "status", "created"])
171
+ ], VehicleMeasurement);
@@ -0,0 +1,18 @@
1
+ import { Associate } from "./Associate";
2
+ import { Company } from "./Company";
3
+ import { EquipmentType } from "./EquipmentType";
4
+ import { Workshop } from "./Workshop";
5
+ export declare class WorkshopEquipment {
6
+ id: number;
7
+ company: Company;
8
+ workshop: Workshop;
9
+ equipment_type: EquipmentType;
10
+ name: string;
11
+ brand: string | null;
12
+ model: string | null;
13
+ serial: string | null;
14
+ status: number;
15
+ created_by: Associate | null;
16
+ created: Date;
17
+ updated: Date | null;
18
+ }
@@ -0,0 +1,83 @@
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.WorkshopEquipment = void 0;
13
+ const typeorm_1 = require("typeorm");
14
+ const Associate_1 = require("./Associate");
15
+ const Company_1 = require("./Company");
16
+ const EquipmentType_1 = require("./EquipmentType");
17
+ const Workshop_1 = require("./Workshop");
18
+ // DOC: Los equipos que la sede registra (sql/81). Opcional: sin registrar se mide igual con el tipo.
19
+ let WorkshopEquipment = class WorkshopEquipment {
20
+ };
21
+ exports.WorkshopEquipment = WorkshopEquipment;
22
+ __decorate([
23
+ (0, typeorm_1.PrimaryGeneratedColumn)({ type: "int", comment: "Número de identificación (ID) único de cada registro." }),
24
+ __metadata("design:type", Number)
25
+ ], WorkshopEquipment.prototype, "id", void 0);
26
+ __decorate([
27
+ (0, typeorm_1.ManyToOne)(() => Company_1.Company, { onDelete: "CASCADE", onUpdate: "NO ACTION" }),
28
+ (0, typeorm_1.JoinColumn)({ name: "company" }),
29
+ __metadata("design:type", Company_1.Company)
30
+ ], WorkshopEquipment.prototype, "company", void 0);
31
+ __decorate([
32
+ (0, typeorm_1.ManyToOne)(() => Workshop_1.Workshop, { onDelete: "CASCADE", onUpdate: "NO ACTION" }),
33
+ (0, typeorm_1.JoinColumn)({ name: "workshop" }),
34
+ __metadata("design:type", Workshop_1.Workshop)
35
+ ], WorkshopEquipment.prototype, "workshop", void 0);
36
+ __decorate([
37
+ (0, typeorm_1.ManyToOne)(() => EquipmentType_1.EquipmentType, { onDelete: "RESTRICT", onUpdate: "NO ACTION" }),
38
+ (0, typeorm_1.JoinColumn)({ name: "equipment_type" }),
39
+ __metadata("design:type", EquipmentType_1.EquipmentType)
40
+ ], WorkshopEquipment.prototype, "equipment_type", void 0);
41
+ __decorate([
42
+ (0, typeorm_1.Column)({ type: "varchar", length: 80, comment: "Nombre con el que lo reconoce el taller (ej. Kia KDS 2.0)." }),
43
+ __metadata("design:type", String)
44
+ ], WorkshopEquipment.prototype, "name", void 0);
45
+ __decorate([
46
+ (0, typeorm_1.Column)({ type: "varchar", length: 60, nullable: true, default: null, comment: "Marca del equipo." }),
47
+ __metadata("design:type", Object)
48
+ ], WorkshopEquipment.prototype, "brand", void 0);
49
+ __decorate([
50
+ (0, typeorm_1.Column)({ type: "varchar", length: 60, nullable: true, default: null, comment: "Modelo del equipo." }),
51
+ __metadata("design:type", Object)
52
+ ], WorkshopEquipment.prototype, "model", void 0);
53
+ __decorate([
54
+ (0, typeorm_1.Column)({ type: "varchar", length: 60, nullable: true, default: null, comment: "Número de serie del equipo." }),
55
+ __metadata("design:type", Object)
56
+ ], WorkshopEquipment.prototype, "serial", void 0);
57
+ __decorate([
58
+ (0, typeorm_1.Column)({ type: "int", width: 1, default: 1, comment: "Estado:\r\n1: Activo.\r\n0: Inactivo (no se ofrece al medir)." }),
59
+ __metadata("design:type", Number)
60
+ ], WorkshopEquipment.prototype, "status", void 0);
61
+ __decorate([
62
+ (0, typeorm_1.ManyToOne)(() => Associate_1.Associate, { onDelete: "SET NULL", onUpdate: "NO ACTION", nullable: true }),
63
+ (0, typeorm_1.JoinColumn)({ name: "created_by" }),
64
+ __metadata("design:type", Object)
65
+ ], WorkshopEquipment.prototype, "created_by", void 0);
66
+ __decorate([
67
+ (0, typeorm_1.Column)({ type: "datetime", default: () => "CURRENT_TIMESTAMP", comment: "Fecha de creación del registro." }),
68
+ __metadata("design:type", Date)
69
+ ], WorkshopEquipment.prototype, "created", void 0);
70
+ __decorate([
71
+ (0, typeorm_1.Column)({
72
+ type: "datetime",
73
+ nullable: true,
74
+ default: null,
75
+ onUpdate: "CURRENT_TIMESTAMP",
76
+ comment: "Fecha de la última actualización del registro.",
77
+ }),
78
+ __metadata("design:type", Object)
79
+ ], WorkshopEquipment.prototype, "updated", void 0);
80
+ exports.WorkshopEquipment = WorkshopEquipment = __decorate([
81
+ (0, typeorm_1.Entity)({ comment: "Equipos de cada sede: tipo, marca, modelo y serial.", name: "workshop_equipment" }),
82
+ (0, typeorm_1.Index)("IDX_workshop_equipment_workshop", ["workshop", "status"])
83
+ ], WorkshopEquipment);
@@ -0,0 +1,12 @@
1
+ import { Company } from "./Company";
2
+ import { Workshop } from "./Workshop";
3
+ export declare class WorkshopReportInbox {
4
+ id: number;
5
+ company: Company;
6
+ workshop: Workshop;
7
+ address: string;
8
+ status: number;
9
+ senders: string[] | null;
10
+ created: Date;
11
+ updated: Date | null;
12
+ }