@asumano/worklip-typeorm-db 1.1.58 → 1.1.59

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.
@@ -9,6 +9,9 @@ import { ServiceOrderApproval } from "./ServiceOrderApproval";
9
9
  export declare class ServiceOrder {
10
10
  id: number;
11
11
  code: string;
12
+ visit_number: string | null;
13
+ visit_year: number | null;
14
+ visit_sequence: number | null;
12
15
  title: string;
13
16
  price: number;
14
17
  workshop: Workshop;
@@ -19,6 +19,8 @@ const ServiceOrderHistory_1 = require("./ServiceOrderHistory");
19
19
  const MediaFile_1 = require("./MediaFile");
20
20
  const Reminder_1 = require("./Reminder");
21
21
  const ServiceOrderApproval_1 = require("./ServiceOrderApproval");
22
+ // DOC: El consecutivo es único por taller y año. Es la garantía de que dos visitas
23
+ // del mismo taller nunca compartan número, incluso si se crean a la vez.
22
24
  let ServiceOrder = class ServiceOrder {
23
25
  };
24
26
  exports.ServiceOrder = ServiceOrder;
@@ -38,6 +40,34 @@ __decorate([
38
40
  }),
39
41
  __metadata("design:type", String)
40
42
  ], ServiceOrder.prototype, "code", void 0);
43
+ __decorate([
44
+ (0, typeorm_1.Column)({
45
+ length: 20,
46
+ type: "varchar",
47
+ default: null,
48
+ nullable: true,
49
+ comment: "Consecutivo legible de la visita (ej: V-2026-00042).",
50
+ }),
51
+ __metadata("design:type", Object)
52
+ ], ServiceOrder.prototype, "visit_number", void 0);
53
+ __decorate([
54
+ (0, typeorm_1.Column)({
55
+ type: "int",
56
+ default: null,
57
+ nullable: true,
58
+ comment: "Año al que pertenece el consecutivo de la visita.",
59
+ }),
60
+ __metadata("design:type", Object)
61
+ ], ServiceOrder.prototype, "visit_year", void 0);
62
+ __decorate([
63
+ (0, typeorm_1.Column)({
64
+ type: "int",
65
+ default: null,
66
+ nullable: true,
67
+ comment: "Consecutivo de la visita dentro del taller y el año.",
68
+ }),
69
+ __metadata("design:type", Object)
70
+ ], ServiceOrder.prototype, "visit_sequence", void 0);
41
71
  __decorate([
42
72
  (0, typeorm_1.Column)({
43
73
  length: 100,
@@ -150,6 +180,10 @@ __decorate([
150
180
  __metadata("design:type", Array)
151
181
  ], ServiceOrder.prototype, "service_order_approvals", void 0);
152
182
  exports.ServiceOrder = ServiceOrder = __decorate([
183
+ (0, typeorm_1.Index)("UQ_service_order_visit_sequence", ["workshop", "visit_year", "visit_sequence"], { unique: true })
184
+ // DOC: Para buscar/ordenar por el número dentro de un taller sin escanear la tabla.
185
+ ,
186
+ (0, typeorm_1.Index)("IDX_service_order_visit_number", ["workshop", "visit_number"]),
153
187
  (0, typeorm_1.Entity)({
154
188
  comment: "Órdenes de servicio del concesionario/taller.",
155
189
  name: "service_order",
@@ -24,7 +24,7 @@ async function getServicesOrderForTheTable(repository, { company, workshop, stat
24
24
  // DOC: Filtro global
25
25
  if (lazyEvent.filters["global"] && lazyEvent.filters["global"].value) {
26
26
  const globalValue = `%${lazyEvent.filters["global"].value.toLowerCase()}%`;
27
- queryBuilder.andWhere("(LOWER(code) LIKE :globalValue OR LOWER(title) LIKE :globalValue OR client_document LIKE :globalValue OR LOWER(client_name) LIKE :globalValue OR LOWER(client_surname) LIKE :globalValue OR LOWER(client_full_name) LIKE :globalValue OR LOWER(workshop_name) LIKE :globalValue OR LOWER(vehicle_plate) LIKE :globalValue OR LOWER(template_code) LIKE :globalValue OR LOWER(template_name) LIKE :globalValue OR history_count LIKE :globalValue OR reminder_count LIKE :globalValue)", { globalValue });
27
+ queryBuilder.andWhere("(LOWER(visit_number) LIKE :globalValue OR LOWER(code) LIKE :globalValue OR LOWER(title) LIKE :globalValue OR client_document LIKE :globalValue OR LOWER(client_name) LIKE :globalValue OR LOWER(client_surname) LIKE :globalValue OR LOWER(client_full_name) LIKE :globalValue OR LOWER(workshop_name) LIKE :globalValue OR LOWER(vehicle_plate) LIKE :globalValue OR LOWER(template_code) LIKE :globalValue OR LOWER(template_name) LIKE :globalValue OR history_count LIKE :globalValue OR reminder_count LIKE :globalValue)", { globalValue });
28
28
  }
29
29
  // DOC: Filtro por estado FILTRO POR DEFECTO.
30
30
  if (status !== null && status >= 0) {
@@ -1,6 +1,9 @@
1
1
  export declare class ServicesOrder {
2
2
  id: number;
3
3
  code: string;
4
+ visit_number: string | null;
5
+ visit_year: number | null;
6
+ visit_sequence: number | null;
4
7
  title: string;
5
8
  price: number;
6
9
  workshop: number;
@@ -22,6 +22,18 @@ __decorate([
22
22
  (0, typeorm_1.ViewColumn)(),
23
23
  __metadata("design:type", String)
24
24
  ], ServicesOrder.prototype, "code", void 0);
25
+ __decorate([
26
+ (0, typeorm_1.ViewColumn)(),
27
+ __metadata("design:type", Object)
28
+ ], ServicesOrder.prototype, "visit_number", void 0);
29
+ __decorate([
30
+ (0, typeorm_1.ViewColumn)(),
31
+ __metadata("design:type", Object)
32
+ ], ServicesOrder.prototype, "visit_year", void 0);
33
+ __decorate([
34
+ (0, typeorm_1.ViewColumn)(),
35
+ __metadata("design:type", Object)
36
+ ], ServicesOrder.prototype, "visit_sequence", void 0);
25
37
  __decorate([
26
38
  (0, typeorm_1.ViewColumn)(),
27
39
  __metadata("design:type", String)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@asumano/worklip-typeorm-db",
3
- "version": "1.1.58",
3
+ "version": "1.1.59",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },