@asumano/worklip-typeorm-db 1.1.112 → 1.1.114
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/Associate.d.ts +3 -0
- package/dist/entities/Associate.js +26 -0
- package/dist/entities/AssociateFace.d.ts +9 -0
- package/dist/entities/AssociateFace.js +72 -0
- package/dist/entities/AssociatePushSubscription.d.ts +12 -0
- package/dist/entities/AssociatePushSubscription.js +61 -0
- package/dist/entities/ServiceOrderIncident.d.ts +23 -0
- package/dist/entities/ServiceOrderIncident.js +147 -0
- package/dist/entities/ServiceOrderIncidentAssociate.d.ts +7 -0
- package/dist/entities/ServiceOrderIncidentAssociate.js +47 -0
- package/dist/entities/ServiceOrderMessage.d.ts +13 -0
- package/dist/entities/ServiceOrderMessage.js +64 -0
- package/dist/entities/ServiceOrderMessageRead.d.ts +8 -0
- package/dist/entities/ServiceOrderMessageRead.js +41 -0
- package/dist/entities/ServiceOrderPart.d.ts +5 -0
- package/dist/entities/ServiceOrderPart.js +29 -1
- package/dist/entities/ServiceOrderStageReopen.d.ts +14 -0
- package/dist/entities/ServiceOrderStageReopen.js +69 -0
- package/dist/entities/Vehicle.d.ts +2 -0
- package/dist/entities/Vehicle.js +6 -0
- package/dist/entities/WorkboardEvent.js +1 -1
- package/dist/entities.index.d.ts +7 -0
- package/dist/entities.index.js +16 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -0
- package/dist/rules/associate.face.rules.d.ts +19 -0
- package/dist/rules/associate.face.rules.js +28 -0
- package/dist/rules/associate.profile.rules.d.ts +7 -0
- package/dist/rules/associate.profile.rules.js +8 -1
- package/dist/rules/attendance.rules.d.ts +1 -0
- package/dist/rules/attendance.rules.js +1 -0
- package/dist/rules/dashboard.rules.d.ts +2 -0
- package/dist/rules/dashboard.rules.js +5 -0
- package/dist/rules/incident.rules.d.ts +30 -0
- package/dist/rules/incident.rules.js +25 -0
- package/dist/rules/parts.rules.d.ts +12 -0
- package/dist/rules/parts.rules.js +11 -1
- package/dist/rules/visit.summary.d.ts +12 -0
- package/dist/rules/visit.summary.js +12 -1
- package/dist/rules/workboard.rules.d.ts +1 -0
- package/dist/rules/workboard.rules.js +2 -0
- package/package.json +1 -1
|
@@ -20,7 +20,10 @@ export declare class Associate {
|
|
|
20
20
|
city: City | null;
|
|
21
21
|
address: string | null;
|
|
22
22
|
photo: string | null;
|
|
23
|
+
face_consent: number | null;
|
|
24
|
+
face_consent_at: Date | null;
|
|
23
25
|
blood_type: number | null;
|
|
26
|
+
employment_type: number;
|
|
24
27
|
job_title: JobTitle | null;
|
|
25
28
|
password: string;
|
|
26
29
|
details: any | null;
|
|
@@ -132,6 +132,24 @@ __decorate([
|
|
|
132
132
|
}),
|
|
133
133
|
__metadata("design:type", Object)
|
|
134
134
|
], Associate.prototype, "photo", void 0);
|
|
135
|
+
__decorate([
|
|
136
|
+
(0, typeorm_1.Column)({
|
|
137
|
+
nullable: true,
|
|
138
|
+
default: null,
|
|
139
|
+
type: "int",
|
|
140
|
+
comment: "Reconocimiento facial. NULL: sin registrar, 1: autoriza (al registrarle las fotos), 2: retiró la autorización.",
|
|
141
|
+
}),
|
|
142
|
+
__metadata("design:type", Object)
|
|
143
|
+
], Associate.prototype, "face_consent", void 0);
|
|
144
|
+
__decorate([
|
|
145
|
+
(0, typeorm_1.Column)({
|
|
146
|
+
nullable: true,
|
|
147
|
+
default: null,
|
|
148
|
+
type: "datetime",
|
|
149
|
+
comment: "Fecha en que autorizó o retiró el reconocimiento facial.",
|
|
150
|
+
}),
|
|
151
|
+
__metadata("design:type", Object)
|
|
152
|
+
], Associate.prototype, "face_consent_at", void 0);
|
|
135
153
|
__decorate([
|
|
136
154
|
(0, typeorm_1.Column)({
|
|
137
155
|
nullable: true,
|
|
@@ -141,6 +159,14 @@ __decorate([
|
|
|
141
159
|
}),
|
|
142
160
|
__metadata("design:type", Object)
|
|
143
161
|
], Associate.prototype, "blood_type", void 0);
|
|
162
|
+
__decorate([
|
|
163
|
+
(0, typeorm_1.Column)({
|
|
164
|
+
type: "int",
|
|
165
|
+
default: 1,
|
|
166
|
+
comment: "Tipo de vinculación:\r\n1: Empleado (directo).\r\n2: Contratista (independiente).",
|
|
167
|
+
}),
|
|
168
|
+
__metadata("design:type", Number)
|
|
169
|
+
], Associate.prototype, "employment_type", void 0);
|
|
144
170
|
__decorate([
|
|
145
171
|
(0, typeorm_1.ManyToOne)(() => JobTitle_1.JobTitle, {
|
|
146
172
|
nullable: true,
|
|
@@ -0,0 +1,72 @@
|
|
|
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.AssociateFace = void 0;
|
|
13
|
+
const typeorm_1 = require("typeorm");
|
|
14
|
+
const Associate_1 = require("./Associate");
|
|
15
|
+
// DOC: Fotos del rostro del empleado para el reconocimiento facial (sql/99). Máximo 3 por empleado.
|
|
16
|
+
let AssociateFace = class AssociateFace {
|
|
17
|
+
};
|
|
18
|
+
exports.AssociateFace = AssociateFace;
|
|
19
|
+
__decorate([
|
|
20
|
+
(0, typeorm_1.PrimaryGeneratedColumn)({
|
|
21
|
+
type: "int",
|
|
22
|
+
comment: "Número de identificación (ID) único de cada registro.",
|
|
23
|
+
}),
|
|
24
|
+
__metadata("design:type", Number)
|
|
25
|
+
], AssociateFace.prototype, "id", void 0);
|
|
26
|
+
__decorate([
|
|
27
|
+
(0, typeorm_1.ManyToOne)(() => Associate_1.Associate, {
|
|
28
|
+
onDelete: "CASCADE",
|
|
29
|
+
onUpdate: "NO ACTION",
|
|
30
|
+
}),
|
|
31
|
+
(0, typeorm_1.JoinColumn)({ name: "associate" }),
|
|
32
|
+
__metadata("design:type", Associate_1.Associate)
|
|
33
|
+
], AssociateFace.prototype, "associate", void 0);
|
|
34
|
+
__decorate([
|
|
35
|
+
(0, typeorm_1.Column)({
|
|
36
|
+
type: "varchar",
|
|
37
|
+
length: 255,
|
|
38
|
+
comment: "Llave en R2 de la foto (WebP o JPG), en companies/<empresa>/associates-face/<empleado>/.",
|
|
39
|
+
}),
|
|
40
|
+
__metadata("design:type", String)
|
|
41
|
+
], AssociateFace.prototype, "image", void 0);
|
|
42
|
+
__decorate([
|
|
43
|
+
(0, typeorm_1.Column)({
|
|
44
|
+
type: "int",
|
|
45
|
+
default: 1,
|
|
46
|
+
comment: "Dónde se tomó. 1: sistema (pantalla), 2: terminal.",
|
|
47
|
+
}),
|
|
48
|
+
__metadata("design:type", Number)
|
|
49
|
+
], AssociateFace.prototype, "source", void 0);
|
|
50
|
+
__decorate([
|
|
51
|
+
(0, typeorm_1.ManyToOne)(() => Associate_1.Associate, {
|
|
52
|
+
nullable: true,
|
|
53
|
+
onDelete: "SET NULL",
|
|
54
|
+
onUpdate: "NO ACTION",
|
|
55
|
+
}),
|
|
56
|
+
(0, typeorm_1.JoinColumn)({ name: "created_by" }),
|
|
57
|
+
__metadata("design:type", Object)
|
|
58
|
+
], AssociateFace.prototype, "created_by", void 0);
|
|
59
|
+
__decorate([
|
|
60
|
+
(0, typeorm_1.Column)({
|
|
61
|
+
type: "datetime",
|
|
62
|
+
comment: "Fecha de creación del registro.",
|
|
63
|
+
default: () => "CURRENT_TIMESTAMP",
|
|
64
|
+
}),
|
|
65
|
+
__metadata("design:type", Date)
|
|
66
|
+
], AssociateFace.prototype, "created", void 0);
|
|
67
|
+
exports.AssociateFace = AssociateFace = __decorate([
|
|
68
|
+
(0, typeorm_1.Index)("IDX_associate_face_associate", ["associate"]),
|
|
69
|
+
(0, typeorm_1.Entity)("associate_face", {
|
|
70
|
+
comment: "Fotos del rostro de los empleados para el reconocimiento facial de la terminal.",
|
|
71
|
+
})
|
|
72
|
+
], AssociateFace);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Associate } from "./Associate";
|
|
2
|
+
export declare class AssociatePushSubscription {
|
|
3
|
+
id: number;
|
|
4
|
+
associate: Associate;
|
|
5
|
+
endpoint: string;
|
|
6
|
+
endpoint_hash: string;
|
|
7
|
+
p256dh: string;
|
|
8
|
+
auth: string;
|
|
9
|
+
user_agent: string | null;
|
|
10
|
+
created: Date;
|
|
11
|
+
last_success: Date | null;
|
|
12
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
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.AssociatePushSubscription = void 0;
|
|
13
|
+
const typeorm_1 = require("typeorm");
|
|
14
|
+
const Associate_1 = require("./Associate");
|
|
15
|
+
// DOC: Un dispositivo (navegador / PWA instalada) del empleado que aceptó los avisos Web Push (sql/107).
|
|
16
|
+
// Un empleado puede tener varios. Si el navegador la invalida (404/410) se borra.
|
|
17
|
+
let AssociatePushSubscription = class AssociatePushSubscription {
|
|
18
|
+
};
|
|
19
|
+
exports.AssociatePushSubscription = AssociatePushSubscription;
|
|
20
|
+
__decorate([
|
|
21
|
+
(0, typeorm_1.PrimaryGeneratedColumn)({ type: "int", comment: "Número de identificación (ID) único de cada registro." }),
|
|
22
|
+
__metadata("design:type", Number)
|
|
23
|
+
], AssociatePushSubscription.prototype, "id", void 0);
|
|
24
|
+
__decorate([
|
|
25
|
+
(0, typeorm_1.ManyToOne)(() => Associate_1.Associate, { onDelete: "CASCADE", onUpdate: "NO ACTION" }),
|
|
26
|
+
(0, typeorm_1.JoinColumn)({ name: "associate" }),
|
|
27
|
+
__metadata("design:type", Associate_1.Associate)
|
|
28
|
+
], AssociatePushSubscription.prototype, "associate", void 0);
|
|
29
|
+
__decorate([
|
|
30
|
+
(0, typeorm_1.Column)({ type: "varchar", length: 1000, comment: "URL del servicio de push del navegador." }),
|
|
31
|
+
__metadata("design:type", String)
|
|
32
|
+
], AssociatePushSubscription.prototype, "endpoint", void 0);
|
|
33
|
+
__decorate([
|
|
34
|
+
(0, typeorm_1.Column)({ type: "char", length: 64, comment: "SHA-256 del endpoint (para que sea único sin indexar la URL)." }),
|
|
35
|
+
__metadata("design:type", String)
|
|
36
|
+
], AssociatePushSubscription.prototype, "endpoint_hash", void 0);
|
|
37
|
+
__decorate([
|
|
38
|
+
(0, typeorm_1.Column)({ type: "varchar", length: 255, comment: "Llave pública del navegador (p256dh)." }),
|
|
39
|
+
__metadata("design:type", String)
|
|
40
|
+
], AssociatePushSubscription.prototype, "p256dh", void 0);
|
|
41
|
+
__decorate([
|
|
42
|
+
(0, typeorm_1.Column)({ type: "varchar", length: 255, comment: "Secreto de autenticación del navegador." }),
|
|
43
|
+
__metadata("design:type", String)
|
|
44
|
+
], AssociatePushSubscription.prototype, "auth", void 0);
|
|
45
|
+
__decorate([
|
|
46
|
+
(0, typeorm_1.Column)({ type: "varchar", length: 255, nullable: true, default: null, comment: "Navegador / dispositivo." }),
|
|
47
|
+
__metadata("design:type", Object)
|
|
48
|
+
], AssociatePushSubscription.prototype, "user_agent", void 0);
|
|
49
|
+
__decorate([
|
|
50
|
+
(0, typeorm_1.Column)({ type: "datetime", default: () => "CURRENT_TIMESTAMP", comment: "Fecha de creación del registro." }),
|
|
51
|
+
__metadata("design:type", Date)
|
|
52
|
+
], AssociatePushSubscription.prototype, "created", void 0);
|
|
53
|
+
__decorate([
|
|
54
|
+
(0, typeorm_1.Column)({ type: "datetime", nullable: true, default: null, comment: "Último envío que el servicio aceptó." }),
|
|
55
|
+
__metadata("design:type", Object)
|
|
56
|
+
], AssociatePushSubscription.prototype, "last_success", void 0);
|
|
57
|
+
exports.AssociatePushSubscription = AssociatePushSubscription = __decorate([
|
|
58
|
+
(0, typeorm_1.Index)("UQ_associate_push_endpoint", ["endpoint_hash"], { unique: true }),
|
|
59
|
+
(0, typeorm_1.Index)("IDX_associate_push_associate", ["associate"]),
|
|
60
|
+
(0, typeorm_1.Entity)("associate_push_subscription", { comment: "Suscripciones Web Push de los empleados (PWA)." })
|
|
61
|
+
], AssociatePushSubscription);
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Associate } from "./Associate";
|
|
2
|
+
import { ServiceOrder } from "./ServiceOrder";
|
|
3
|
+
import { ServiceOrderIncidentAssociate } from "./ServiceOrderIncidentAssociate";
|
|
4
|
+
import type { IIncidentQuoteItem, IIncidentSection } from "../rules/incident.rules";
|
|
5
|
+
export declare class ServiceOrderIncident {
|
|
6
|
+
id: number;
|
|
7
|
+
service_order: ServiceOrder;
|
|
8
|
+
name: string;
|
|
9
|
+
caused_by: Associate;
|
|
10
|
+
observations: string | null;
|
|
11
|
+
rework_sections: IIncidentSection[] | null;
|
|
12
|
+
quote: IIncidentQuoteItem[] | null;
|
|
13
|
+
quote_total: string;
|
|
14
|
+
state: number;
|
|
15
|
+
resolved_at: Date | null;
|
|
16
|
+
resolved_by: Associate | null;
|
|
17
|
+
associates: ServiceOrderIncidentAssociate[];
|
|
18
|
+
created: Date;
|
|
19
|
+
created_by: Associate;
|
|
20
|
+
updated: Date | null;
|
|
21
|
+
updated_by: Associate | null;
|
|
22
|
+
status: number;
|
|
23
|
+
}
|
|
@@ -0,0 +1,147 @@
|
|
|
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.ServiceOrderIncident = void 0;
|
|
13
|
+
const typeorm_1 = require("typeorm");
|
|
14
|
+
const Associate_1 = require("./Associate");
|
|
15
|
+
const ServiceOrder_1 = require("./ServiceOrder");
|
|
16
|
+
const ServiceOrderIncidentAssociate_1 = require("./ServiceOrderIncidentAssociate");
|
|
17
|
+
// DOC: Un imprevisto de la visita (sql/100): qué pasó, quién lo causó, qué secciones rehacer, quiénes
|
|
18
|
+
// lo resuelven y cuánto le cuesta AL TALLER. Es interno: el cliente no lo ve.
|
|
19
|
+
let ServiceOrderIncident = class ServiceOrderIncident {
|
|
20
|
+
};
|
|
21
|
+
exports.ServiceOrderIncident = ServiceOrderIncident;
|
|
22
|
+
__decorate([
|
|
23
|
+
(0, typeorm_1.PrimaryGeneratedColumn)({
|
|
24
|
+
type: "int",
|
|
25
|
+
comment: "Número de identificación (ID) único de cada registro.",
|
|
26
|
+
}),
|
|
27
|
+
__metadata("design:type", Number)
|
|
28
|
+
], ServiceOrderIncident.prototype, "id", void 0);
|
|
29
|
+
__decorate([
|
|
30
|
+
(0, typeorm_1.ManyToOne)(() => ServiceOrder_1.ServiceOrder, { onDelete: "CASCADE", onUpdate: "NO ACTION" }),
|
|
31
|
+
(0, typeorm_1.JoinColumn)({ name: "service_order" }),
|
|
32
|
+
__metadata("design:type", ServiceOrder_1.ServiceOrder)
|
|
33
|
+
], ServiceOrderIncident.prototype, "service_order", void 0);
|
|
34
|
+
__decorate([
|
|
35
|
+
(0, typeorm_1.Column)({ type: "varchar", length: 150, comment: "Nombre corto del imprevisto." }),
|
|
36
|
+
__metadata("design:type", String)
|
|
37
|
+
], ServiceOrderIncident.prototype, "name", void 0);
|
|
38
|
+
__decorate([
|
|
39
|
+
(0, typeorm_1.ManyToOne)(() => Associate_1.Associate, { onDelete: "RESTRICT", onUpdate: "NO ACTION" }),
|
|
40
|
+
(0, typeorm_1.JoinColumn)({ name: "caused_by" }),
|
|
41
|
+
__metadata("design:type", Associate_1.Associate)
|
|
42
|
+
], ServiceOrderIncident.prototype, "caused_by", void 0);
|
|
43
|
+
__decorate([
|
|
44
|
+
(0, typeorm_1.Column)({
|
|
45
|
+
type: "varchar",
|
|
46
|
+
length: 2000,
|
|
47
|
+
nullable: true,
|
|
48
|
+
default: null,
|
|
49
|
+
comment: "Observaciones (escritas o dictadas).",
|
|
50
|
+
}),
|
|
51
|
+
__metadata("design:type", Object)
|
|
52
|
+
], ServiceOrderIncident.prototype, "observations", void 0);
|
|
53
|
+
__decorate([
|
|
54
|
+
(0, typeorm_1.Column)({
|
|
55
|
+
type: "json",
|
|
56
|
+
nullable: true,
|
|
57
|
+
default: null,
|
|
58
|
+
comment: "Secciones de la visita a rehacer: [{ id, name }]. Solo registro; no reabre nada.",
|
|
59
|
+
}),
|
|
60
|
+
__metadata("design:type", Object)
|
|
61
|
+
], ServiceOrderIncident.prototype, "rework_sections", void 0);
|
|
62
|
+
__decorate([
|
|
63
|
+
(0, typeorm_1.Column)({
|
|
64
|
+
type: "json",
|
|
65
|
+
nullable: true,
|
|
66
|
+
default: null,
|
|
67
|
+
comment: "Costo interno del taller: [{ description, amount }]. El cliente nunca lo ve.",
|
|
68
|
+
}),
|
|
69
|
+
__metadata("design:type", Object)
|
|
70
|
+
], ServiceOrderIncident.prototype, "quote", void 0);
|
|
71
|
+
__decorate([
|
|
72
|
+
(0, typeorm_1.Column)({
|
|
73
|
+
type: "decimal",
|
|
74
|
+
precision: 14,
|
|
75
|
+
scale: 2,
|
|
76
|
+
default: 0,
|
|
77
|
+
comment: "Suma de quote (para reportes sin leer el JSON).",
|
|
78
|
+
}),
|
|
79
|
+
__metadata("design:type", String)
|
|
80
|
+
], ServiceOrderIncident.prototype, "quote_total", void 0);
|
|
81
|
+
__decorate([
|
|
82
|
+
(0, typeorm_1.Column)({
|
|
83
|
+
type: "int",
|
|
84
|
+
width: 1,
|
|
85
|
+
default: 1,
|
|
86
|
+
comment: "Estado del imprevisto:\r\n1: Abierto.\r\n2: Resuelto.",
|
|
87
|
+
}),
|
|
88
|
+
__metadata("design:type", Number)
|
|
89
|
+
], ServiceOrderIncident.prototype, "state", void 0);
|
|
90
|
+
__decorate([
|
|
91
|
+
(0, typeorm_1.Column)({ type: "datetime", nullable: true, default: null, comment: "Cuándo se marcó como resuelto." }),
|
|
92
|
+
__metadata("design:type", Object)
|
|
93
|
+
], ServiceOrderIncident.prototype, "resolved_at", void 0);
|
|
94
|
+
__decorate([
|
|
95
|
+
(0, typeorm_1.ManyToOne)(() => Associate_1.Associate, { onDelete: "RESTRICT", onUpdate: "NO ACTION", nullable: true }),
|
|
96
|
+
(0, typeorm_1.JoinColumn)({ name: "resolved_by" }),
|
|
97
|
+
__metadata("design:type", Object)
|
|
98
|
+
], ServiceOrderIncident.prototype, "resolved_by", void 0);
|
|
99
|
+
__decorate([
|
|
100
|
+
(0, typeorm_1.OneToMany)(() => ServiceOrderIncidentAssociate_1.ServiceOrderIncidentAssociate, (row) => row.incident),
|
|
101
|
+
__metadata("design:type", Array)
|
|
102
|
+
], ServiceOrderIncident.prototype, "associates", void 0);
|
|
103
|
+
__decorate([
|
|
104
|
+
(0, typeorm_1.Column)({
|
|
105
|
+
type: "datetime",
|
|
106
|
+
comment: "Fecha de creación del registro.",
|
|
107
|
+
default: () => "CURRENT_TIMESTAMP",
|
|
108
|
+
}),
|
|
109
|
+
__metadata("design:type", Date)
|
|
110
|
+
], ServiceOrderIncident.prototype, "created", void 0);
|
|
111
|
+
__decorate([
|
|
112
|
+
(0, typeorm_1.ManyToOne)(() => Associate_1.Associate, { onDelete: "RESTRICT", onUpdate: "NO ACTION" }),
|
|
113
|
+
(0, typeorm_1.JoinColumn)({ name: "created_by" }),
|
|
114
|
+
__metadata("design:type", Associate_1.Associate)
|
|
115
|
+
], ServiceOrderIncident.prototype, "created_by", void 0);
|
|
116
|
+
__decorate([
|
|
117
|
+
(0, typeorm_1.Column)({
|
|
118
|
+
type: "datetime",
|
|
119
|
+
nullable: true,
|
|
120
|
+
default: null,
|
|
121
|
+
comment: "Fecha de actualización del registro.",
|
|
122
|
+
onUpdate: "CURRENT_TIMESTAMP",
|
|
123
|
+
}),
|
|
124
|
+
__metadata("design:type", Object)
|
|
125
|
+
], ServiceOrderIncident.prototype, "updated", void 0);
|
|
126
|
+
__decorate([
|
|
127
|
+
(0, typeorm_1.ManyToOne)(() => Associate_1.Associate, { onDelete: "RESTRICT", onUpdate: "NO ACTION", nullable: true }),
|
|
128
|
+
(0, typeorm_1.JoinColumn)({ name: "updated_by" }),
|
|
129
|
+
__metadata("design:type", Object)
|
|
130
|
+
], ServiceOrderIncident.prototype, "updated_by", void 0);
|
|
131
|
+
__decorate([
|
|
132
|
+
(0, typeorm_1.Column)({
|
|
133
|
+
default: 1,
|
|
134
|
+
type: "int",
|
|
135
|
+
width: 1,
|
|
136
|
+
comment: "Estado del registro:\r\n1. Activo.\r\n0. Eliminado (cargado por error).",
|
|
137
|
+
}),
|
|
138
|
+
__metadata("design:type", Number)
|
|
139
|
+
], ServiceOrderIncident.prototype, "status", void 0);
|
|
140
|
+
exports.ServiceOrderIncident = ServiceOrderIncident = __decorate([
|
|
141
|
+
(0, typeorm_1.Index)("IDX_service_order_incident_order", ["service_order", "status"]),
|
|
142
|
+
(0, typeorm_1.Index)("IDX_service_order_incident_caused_by", ["caused_by"]),
|
|
143
|
+
(0, typeorm_1.Index)("IDX_service_order_incident_created", ["status", "created"]),
|
|
144
|
+
(0, typeorm_1.Entity)("service_order_incident", {
|
|
145
|
+
comment: "Imprevistos de una visita: causante, reprocesos y costo interno del taller.",
|
|
146
|
+
})
|
|
147
|
+
], ServiceOrderIncident);
|
|
@@ -0,0 +1,47 @@
|
|
|
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.ServiceOrderIncidentAssociate = void 0;
|
|
13
|
+
const typeorm_1 = require("typeorm");
|
|
14
|
+
const Associate_1 = require("./Associate");
|
|
15
|
+
const ServiceOrderIncident_1 = require("./ServiceOrderIncident");
|
|
16
|
+
// DOC: Empleados que hacen el reproceso de un imprevisto (sql/100). Tabla y no JSON: así se puede
|
|
17
|
+
// buscar «imprevistos en los que trabajé».
|
|
18
|
+
let ServiceOrderIncidentAssociate = class ServiceOrderIncidentAssociate {
|
|
19
|
+
};
|
|
20
|
+
exports.ServiceOrderIncidentAssociate = ServiceOrderIncidentAssociate;
|
|
21
|
+
__decorate([
|
|
22
|
+
(0, typeorm_1.PrimaryGeneratedColumn)({
|
|
23
|
+
type: "int",
|
|
24
|
+
comment: "Número de identificación (ID) único de cada registro.",
|
|
25
|
+
}),
|
|
26
|
+
__metadata("design:type", Number)
|
|
27
|
+
], ServiceOrderIncidentAssociate.prototype, "id", void 0);
|
|
28
|
+
__decorate([
|
|
29
|
+
(0, typeorm_1.ManyToOne)(() => ServiceOrderIncident_1.ServiceOrderIncident, (incident) => incident.associates, {
|
|
30
|
+
onDelete: "CASCADE",
|
|
31
|
+
onUpdate: "NO ACTION",
|
|
32
|
+
}),
|
|
33
|
+
(0, typeorm_1.JoinColumn)({ name: "incident" }),
|
|
34
|
+
__metadata("design:type", ServiceOrderIncident_1.ServiceOrderIncident)
|
|
35
|
+
], ServiceOrderIncidentAssociate.prototype, "incident", void 0);
|
|
36
|
+
__decorate([
|
|
37
|
+
(0, typeorm_1.ManyToOne)(() => Associate_1.Associate, { onDelete: "CASCADE", onUpdate: "NO ACTION" }),
|
|
38
|
+
(0, typeorm_1.JoinColumn)({ name: "associate" }),
|
|
39
|
+
__metadata("design:type", Associate_1.Associate)
|
|
40
|
+
], ServiceOrderIncidentAssociate.prototype, "associate", void 0);
|
|
41
|
+
exports.ServiceOrderIncidentAssociate = ServiceOrderIncidentAssociate = __decorate([
|
|
42
|
+
(0, typeorm_1.Index)("UQ_service_order_incident_associate", ["incident", "associate"], { unique: true }),
|
|
43
|
+
(0, typeorm_1.Index)("IDX_service_order_incident_associate_associate", ["associate"]),
|
|
44
|
+
(0, typeorm_1.Entity)("service_order_incident_associate", {
|
|
45
|
+
comment: "Empleados asignados al reproceso de un imprevisto.",
|
|
46
|
+
})
|
|
47
|
+
], ServiceOrderIncidentAssociate);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Associate } from "./Associate";
|
|
2
|
+
import { ServiceOrder } from "./ServiceOrder";
|
|
3
|
+
export declare class ServiceOrderMessage {
|
|
4
|
+
id: number;
|
|
5
|
+
service_order: ServiceOrder;
|
|
6
|
+
associate: Associate;
|
|
7
|
+
body: string;
|
|
8
|
+
mentions: number[] | null;
|
|
9
|
+
source: number;
|
|
10
|
+
created: Date;
|
|
11
|
+
edited: Date | null;
|
|
12
|
+
status: number;
|
|
13
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
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.ServiceOrderMessage = void 0;
|
|
13
|
+
const typeorm_1 = require("typeorm");
|
|
14
|
+
const Associate_1 = require("./Associate");
|
|
15
|
+
const ServiceOrder_1 = require("./ServiceOrder");
|
|
16
|
+
// DOC: Un mensaje del CHAT INTERNO de la visita (sql/107): como un grupo de WhatsApp por visita, solo
|
|
17
|
+
// del taller. `mentions` son los empleados mencionados (@): a ellos les llega el aviso.
|
|
18
|
+
let ServiceOrderMessage = class ServiceOrderMessage {
|
|
19
|
+
};
|
|
20
|
+
exports.ServiceOrderMessage = ServiceOrderMessage;
|
|
21
|
+
__decorate([
|
|
22
|
+
(0, typeorm_1.PrimaryGeneratedColumn)({ type: "int", comment: "Número de identificación (ID) único de cada registro." }),
|
|
23
|
+
__metadata("design:type", Number)
|
|
24
|
+
], ServiceOrderMessage.prototype, "id", void 0);
|
|
25
|
+
__decorate([
|
|
26
|
+
(0, typeorm_1.ManyToOne)(() => ServiceOrder_1.ServiceOrder, { onDelete: "CASCADE", onUpdate: "NO ACTION" }),
|
|
27
|
+
(0, typeorm_1.JoinColumn)({ name: "service_order" }),
|
|
28
|
+
__metadata("design:type", ServiceOrder_1.ServiceOrder)
|
|
29
|
+
], ServiceOrderMessage.prototype, "service_order", void 0);
|
|
30
|
+
__decorate([
|
|
31
|
+
(0, typeorm_1.ManyToOne)(() => Associate_1.Associate, { onDelete: "RESTRICT", onUpdate: "NO ACTION" }),
|
|
32
|
+
(0, typeorm_1.JoinColumn)({ name: "associate" }),
|
|
33
|
+
__metadata("design:type", Associate_1.Associate)
|
|
34
|
+
], ServiceOrderMessage.prototype, "associate", void 0);
|
|
35
|
+
__decorate([
|
|
36
|
+
(0, typeorm_1.Column)({ type: "varchar", length: 2000, comment: "Texto del mensaje (escrito o dictado)." }),
|
|
37
|
+
__metadata("design:type", String)
|
|
38
|
+
], ServiceOrderMessage.prototype, "body", void 0);
|
|
39
|
+
__decorate([
|
|
40
|
+
(0, typeorm_1.Column)({ type: "json", nullable: true, default: null, comment: "Ids de los empleados mencionados (@)." }),
|
|
41
|
+
__metadata("design:type", Object)
|
|
42
|
+
], ServiceOrderMessage.prototype, "mentions", void 0);
|
|
43
|
+
__decorate([
|
|
44
|
+
(0, typeorm_1.Column)({ type: "int", width: 1, default: 1, comment: "Cómo se escribió:\r\n1: Escrito.\r\n2: Dictado (audio transcrito)." }),
|
|
45
|
+
__metadata("design:type", Number)
|
|
46
|
+
], ServiceOrderMessage.prototype, "source", void 0);
|
|
47
|
+
__decorate([
|
|
48
|
+
(0, typeorm_1.Column)({ type: "datetime", default: () => "CURRENT_TIMESTAMP", comment: "Fecha de creación del registro." }),
|
|
49
|
+
__metadata("design:type", Date)
|
|
50
|
+
], ServiceOrderMessage.prototype, "created", void 0);
|
|
51
|
+
__decorate([
|
|
52
|
+
(0, typeorm_1.Column)({ type: "datetime", nullable: true, default: null, comment: "Cuándo se editó por última vez." }),
|
|
53
|
+
__metadata("design:type", Object)
|
|
54
|
+
], ServiceOrderMessage.prototype, "edited", void 0);
|
|
55
|
+
__decorate([
|
|
56
|
+
(0, typeorm_1.Column)({ type: "int", width: 1, default: 1, comment: "Estado del registro:\r\n1. Activo.\r\n0. Eliminado por su autor." }),
|
|
57
|
+
__metadata("design:type", Number)
|
|
58
|
+
], ServiceOrderMessage.prototype, "status", void 0);
|
|
59
|
+
exports.ServiceOrderMessage = ServiceOrderMessage = __decorate([
|
|
60
|
+
(0, typeorm_1.Index)("IDX_service_order_message_order", ["service_order", "id"]),
|
|
61
|
+
(0, typeorm_1.Entity)("service_order_message", {
|
|
62
|
+
comment: "Chat interno del taller por visita (comentarios con menciones). El cliente no lo ve.",
|
|
63
|
+
})
|
|
64
|
+
], ServiceOrderMessage);
|
|
@@ -0,0 +1,41 @@
|
|
|
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.ServiceOrderMessageRead = void 0;
|
|
13
|
+
const typeorm_1 = require("typeorm");
|
|
14
|
+
const Associate_1 = require("./Associate");
|
|
15
|
+
const ServiceOrder_1 = require("./ServiceOrder");
|
|
16
|
+
// DOC: Hasta qué mensaje leyó cada empleado el chat de una visita (sql/107): da el contador de no leídos.
|
|
17
|
+
let ServiceOrderMessageRead = class ServiceOrderMessageRead {
|
|
18
|
+
};
|
|
19
|
+
exports.ServiceOrderMessageRead = ServiceOrderMessageRead;
|
|
20
|
+
__decorate([
|
|
21
|
+
(0, typeorm_1.PrimaryGeneratedColumn)({ type: "int", comment: "Número de identificación (ID) único de cada registro." }),
|
|
22
|
+
__metadata("design:type", Number)
|
|
23
|
+
], ServiceOrderMessageRead.prototype, "id", void 0);
|
|
24
|
+
__decorate([
|
|
25
|
+
(0, typeorm_1.ManyToOne)(() => ServiceOrder_1.ServiceOrder, { onDelete: "CASCADE", onUpdate: "NO ACTION" }),
|
|
26
|
+
(0, typeorm_1.JoinColumn)({ name: "service_order" }),
|
|
27
|
+
__metadata("design:type", ServiceOrder_1.ServiceOrder)
|
|
28
|
+
], ServiceOrderMessageRead.prototype, "service_order", void 0);
|
|
29
|
+
__decorate([
|
|
30
|
+
(0, typeorm_1.ManyToOne)(() => Associate_1.Associate, { onDelete: "CASCADE", onUpdate: "NO ACTION" }),
|
|
31
|
+
(0, typeorm_1.JoinColumn)({ name: "associate" }),
|
|
32
|
+
__metadata("design:type", Associate_1.Associate)
|
|
33
|
+
], ServiceOrderMessageRead.prototype, "associate", void 0);
|
|
34
|
+
__decorate([
|
|
35
|
+
(0, typeorm_1.Column)({ type: "int", default: 0, comment: "Id del último mensaje leído." }),
|
|
36
|
+
__metadata("design:type", Number)
|
|
37
|
+
], ServiceOrderMessageRead.prototype, "last_read", void 0);
|
|
38
|
+
exports.ServiceOrderMessageRead = ServiceOrderMessageRead = __decorate([
|
|
39
|
+
(0, typeorm_1.Unique)("UQ_service_order_message_read", ["service_order", "associate"]),
|
|
40
|
+
(0, typeorm_1.Entity)("service_order_message_read", { comment: "Último mensaje leído del chat de la visita, por empleado." })
|
|
41
|
+
], ServiceOrderMessageRead);
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import { ServiceOrder } from "./ServiceOrder";
|
|
2
2
|
import { Associate } from "./Associate";
|
|
3
|
+
import { ServiceOrderIncident } from "./ServiceOrderIncident";
|
|
4
|
+
import type { IPartDeliveryFile } from "../rules/parts.rules";
|
|
3
5
|
export declare class ServiceOrderPart {
|
|
4
6
|
id: number;
|
|
5
7
|
service_order: ServiceOrder;
|
|
6
8
|
item_id: string | null;
|
|
9
|
+
visibility: number;
|
|
10
|
+
incident: ServiceOrderIncident | null;
|
|
7
11
|
name: string;
|
|
8
12
|
reference: string | null;
|
|
9
13
|
quantity: string;
|
|
@@ -12,6 +16,7 @@ export declare class ServiceOrderPart {
|
|
|
12
16
|
ordered_at: Date | null;
|
|
13
17
|
received_at: Date | null;
|
|
14
18
|
received_by: Associate | null;
|
|
19
|
+
delivery_files: IPartDeliveryFile[] | null;
|
|
15
20
|
note: string | null;
|
|
16
21
|
notified_at: Date | null;
|
|
17
22
|
created: Date;
|
|
@@ -13,6 +13,7 @@ exports.ServiceOrderPart = void 0;
|
|
|
13
13
|
const typeorm_1 = require("typeorm");
|
|
14
14
|
const ServiceOrder_1 = require("./ServiceOrder");
|
|
15
15
|
const Associate_1 = require("./Associate");
|
|
16
|
+
const ServiceOrderIncident_1 = require("./ServiceOrderIncident");
|
|
16
17
|
// DOC: Un repuesto de la visita y en qué va (por aprobar, pedido, recibido, no se usa). Tabla y no
|
|
17
18
|
// JSON de la visita: el tablero y el televisor cuentan «3/5» de muchas visitas a la vez.
|
|
18
19
|
let ServiceOrderPart = class ServiceOrderPart {
|
|
@@ -43,11 +44,29 @@ __decorate([
|
|
|
43
44
|
}),
|
|
44
45
|
__metadata("design:type", Object)
|
|
45
46
|
], ServiceOrderPart.prototype, "item_id", void 0);
|
|
47
|
+
__decorate([
|
|
48
|
+
(0, typeorm_1.Column)({
|
|
49
|
+
type: "int",
|
|
50
|
+
width: 1,
|
|
51
|
+
default: 1,
|
|
52
|
+
comment: "Quién lo ve:\r\n1: Visible al cliente.\r\n2: Interno del taller (imprevisto).",
|
|
53
|
+
}),
|
|
54
|
+
__metadata("design:type", Number)
|
|
55
|
+
], ServiceOrderPart.prototype, "visibility", void 0);
|
|
56
|
+
__decorate([
|
|
57
|
+
(0, typeorm_1.ManyToOne)(() => ServiceOrderIncident_1.ServiceOrderIncident, {
|
|
58
|
+
onDelete: "SET NULL",
|
|
59
|
+
onUpdate: "NO ACTION",
|
|
60
|
+
nullable: true,
|
|
61
|
+
}),
|
|
62
|
+
(0, typeorm_1.JoinColumn)({ name: "incident" }),
|
|
63
|
+
__metadata("design:type", Object)
|
|
64
|
+
], ServiceOrderPart.prototype, "incident", void 0);
|
|
46
65
|
__decorate([
|
|
47
66
|
(0, typeorm_1.Column)({
|
|
48
67
|
type: "varchar",
|
|
49
68
|
length: 150,
|
|
50
|
-
comment: "Nombre del repuesto. Lo ve el cliente.",
|
|
69
|
+
comment: "Nombre del repuesto. Lo ve el cliente si es visible.",
|
|
51
70
|
}),
|
|
52
71
|
__metadata("design:type", String)
|
|
53
72
|
], ServiceOrderPart.prototype, "name", void 0);
|
|
@@ -116,6 +135,15 @@ __decorate([
|
|
|
116
135
|
(0, typeorm_1.JoinColumn)({ name: "received_by" }),
|
|
117
136
|
__metadata("design:type", Object)
|
|
118
137
|
], ServiceOrderPart.prototype, "received_by", void 0);
|
|
138
|
+
__decorate([
|
|
139
|
+
(0, typeorm_1.Column)({
|
|
140
|
+
type: "json",
|
|
141
|
+
nullable: true,
|
|
142
|
+
default: null,
|
|
143
|
+
comment: "Fotos y videos de la entrega: [{ key, type, preview_key, created, created_by }]. Interno.",
|
|
144
|
+
}),
|
|
145
|
+
__metadata("design:type", Object)
|
|
146
|
+
], ServiceOrderPart.prototype, "delivery_files", void 0);
|
|
119
147
|
__decorate([
|
|
120
148
|
(0, typeorm_1.Column)({
|
|
121
149
|
type: "varchar",
|