fpavon-ee-shared 1.0.0
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/dependency-injection/dependency-injection.ts +56 -0
- package/digitalSignature/application/digitalSignature.useCase.ts +171 -0
- package/digitalSignature/domain/PDFArrayCustom.ts +60 -0
- package/digitalSignature/domain/SignPDF.ts +112 -0
- package/digitalSignature/infrastructure/routes/digitalSignature.routes.ts +3 -0
- package/digitalSignature/infrastructure/template/marco.pdf +0 -0
- package/dist/dependency-injection/dependency-injection.js +46 -0
- package/dist/digitalSignature/application/digitalSignature.useCase.js +180 -0
- package/dist/digitalSignature/domain/PDFArrayCustom.js +59 -0
- package/dist/digitalSignature/domain/SignPDF.js +100 -0
- package/dist/digitalSignature/infrastructure/routes/digitalSignature.routes.js +1 -0
- package/dist/documentos/application/documentos.useCase.js +49 -0
- package/dist/documentos/application/streamConversor.js +14 -0
- package/dist/documentos/domain/documento.class.js +60 -0
- package/dist/documentos/domain/documento.interface.js +2 -0
- package/dist/documentos/domain/documento.repository.js +2 -0
- package/dist/documentos/domain/documentoFTP.js +11 -0
- package/dist/documentos/domain/value-object/uuid.js +21 -0
- package/dist/documentos/infrastructure/repository/documentos.ftp.repository.js +172 -0
- package/dist/estados/application/flujos.useCase.js +21 -0
- package/dist/estados/domain/estado.class.js +150 -0
- package/dist/estados/domain/flujos.repository.js +2 -0
- package/dist/estados/infrastructure/controller/flujos.controller.js +34 -0
- package/dist/estados/infrastructure/repositories/flujos.sql.repository.js +36 -0
- package/dist/estados/infrastructure/routes/flujo.route.js +50 -0
- package/dist/expediente-electronico/application/expediente-electronico.useCase.js +171 -0
- package/dist/expediente-electronico/domain/expediente-electronico.class.js +190 -0
- package/dist/expediente-electronico/domain/expediente-electronico.interface.js +2 -0
- package/dist/expediente-electronico/domain/expediente-electronico.repository.js +2 -0
- package/dist/expediente-electronico/domain/value-object/limited-string.class.js +19 -0
- package/dist/expediente-electronico/domain/value-object/notas.class.js +41 -0
- package/dist/expediente-electronico/infrastructure/controller/expediente-electronico.controller.js +306 -0
- package/dist/expediente-electronico/infrastructure/repositories/expediente-electronico.sql.repository.js +775 -0
- package/dist/expediente-electronico/infrastructure/routes/expediente-electronico.route.js +46 -0
- package/dist/infrastructure/bd/connection.sql.js +64 -0
- package/dist/infrastructure/bd/pagination.sql.js +15 -0
- package/dist/infrastructure/docs/swagger.js +37 -0
- package/dist/infrastructure/fileServer/fileServer.basic-ftp.js +220 -0
- package/dist/infrastructure/fileServer/fileServer.connection.js +94 -0
- package/dist/infrastructure/middlewares/middleware.apikey.js +15 -0
- package/dist/infrastructure/middlewares/middleware.auth.js +372 -0
- package/dist/infrastructure/middlewares/middleware.deslogueo.js +1 -0
- package/dist/infrastructure/middlewares/middleware.validarCampos.js +15 -0
- package/dist/infrastructure/middlewares/middleware.validarRol.js +19 -0
- package/dist/infrastructure/middlewares/validarNivel.js +37 -0
- package/dist/infrastructure/server/httpsServer.class.js +59 -0
- package/dist/infrastructure/server/server.class.js +54 -0
- package/dist/infrastructure/socket/socketIO.js +23 -0
- package/dist/infrastructure/stream-handler/stream-handler.js +137 -0
- package/dist/notificaciones/domain/datosNotificacion.class.js +11 -0
- package/dist/notificaciones/domain/datosNotificacion.interface.js +2 -0
- package/dist/notificaciones/domain/notificacion.class.js +19 -0
- package/dist/notificaciones/domain/notificacion.interface.js +2 -0
- package/dist/notificaciones/domain/notificacion.repository.js +2 -0
- package/dist/notificaciones/infrastructure/notificacion.controller.js +31 -0
- package/dist/usuarios/application/usuarios.useCase.js +22 -0
- package/dist/usuarios/domain/usuario.class.js +24 -0
- package/dist/usuarios/domain/usuario.interface.js +2 -0
- package/dist/usuarios/domain/usuarios.repository.js +2 -0
- package/dist/usuarios/infrastructure/controller/usuarios.controller.js +28 -0
- package/dist/usuarios/infrastructure/repository/usuarios.sql.repository.js +17 -0
- package/dist/usuarios/infrastructure/routes/usuarios.routes.js +19 -0
- package/documentos/application/documentos.useCase.ts +41 -0
- package/documentos/domain/documento.class.ts +101 -0
- package/documentos/domain/documento.interface.ts +9 -0
- package/documentos/domain/documento.repository.ts +12 -0
- package/documentos/domain/documentoFTP.ts +17 -0
- package/documentos/domain/value-object/uuid.ts +23 -0
- package/documentos/infrastructure/repository/documentos.ftp.repository.ts +169 -0
- package/estados/application/flujos.useCase.ts +13 -0
- package/estados/domain/estado.class.ts +213 -0
- package/estados/domain/flujos.repository.ts +8 -0
- package/estados/infrastructure/controller/flujos.controller.ts +21 -0
- package/estados/infrastructure/repositories/flujos.sql.repository.ts +29 -0
- package/estados/infrastructure/routes/flujo.route.ts +56 -0
- package/expediente-electronico/application/expediente-electronico.useCase.ts +154 -0
- package/expediente-electronico/domain/expediente-electronico.class.ts +223 -0
- package/expediente-electronico/domain/expediente-electronico.interface.ts +19 -0
- package/expediente-electronico/domain/expediente-electronico.repository.ts +22 -0
- package/expediente-electronico/domain/value-object/limited-string.class.ts +19 -0
- package/expediente-electronico/domain/value-object/notas.class.ts +51 -0
- package/expediente-electronico/infrastructure/controller/expediente-electronico.controller.ts +308 -0
- package/expediente-electronico/infrastructure/repositories/expediente-electronico.sql.repository.ts +799 -0
- package/expediente-electronico/infrastructure/routes/expediente-electronico.route.ts +64 -0
- package/infrastructure/bd/connection.sql.ts +49 -0
- package/infrastructure/bd/pagination.sql.ts +11 -0
- package/infrastructure/docs/swagger.ts +38 -0
- package/infrastructure/fileServer/fileServer.basic-ftp.ts +196 -0
- package/infrastructure/fileServer/fileServer.connection.ts +78 -0
- package/infrastructure/middlewares/middleware.apikey.ts +17 -0
- package/infrastructure/middlewares/middleware.auth.ts +409 -0
- package/infrastructure/middlewares/middleware.deslogueo.ts +0 -0
- package/infrastructure/middlewares/middleware.validarCampos.ts +15 -0
- package/infrastructure/middlewares/middleware.validarRol.ts +15 -0
- package/infrastructure/middlewares/validarNivel.ts +37 -0
- package/infrastructure/server/httpsServer.class.ts +69 -0
- package/infrastructure/server/server.class.ts +66 -0
- package/infrastructure/socket/socketIO.ts +22 -0
- package/infrastructure/stream-handler/stream-handler.ts +161 -0
- package/jest.config.js +8 -0
- package/notificaciones/domain/datosNotificacion.class.ts +13 -0
- package/notificaciones/domain/datosNotificacion.interface.ts +5 -0
- package/notificaciones/domain/notificacion.class.ts +23 -0
- package/notificaciones/domain/notificacion.interface.ts +15 -0
- package/notificaciones/domain/notificacion.repository.ts +8 -0
- package/notificaciones/infrastructure/notificacion.controller.ts +16 -0
- package/package.json +42 -0
- package/script.js +135 -0
- package/test/expediente-electronico/domain/expediente-electronico.class.test.ts +186 -0
- package/tsconfig.json +73 -0
- package/usuarios/application/usuarios.useCase.ts +12 -0
- package/usuarios/domain/usuario.class.ts +40 -0
- package/usuarios/domain/usuario.interface.ts +18 -0
- package/usuarios/domain/usuarios.repository.ts +3 -0
- package/usuarios/infrastructure/controller/usuarios.controller.ts +19 -0
- package/usuarios/infrastructure/repository/usuarios.sql.repository.ts +19 -0
- package/usuarios/infrastructure/routes/usuarios.routes.ts +20 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.FlujosController = void 0;
|
|
13
|
+
class FlujosController {
|
|
14
|
+
constructor(flujosUseCase) {
|
|
15
|
+
this.flujosUseCase = flujosUseCase;
|
|
16
|
+
this.getFlujoByModulo = (req, res) => __awaiter(this, void 0, void 0, function* () {
|
|
17
|
+
try {
|
|
18
|
+
const modulo = req.params.modulo;
|
|
19
|
+
const flujo = yield this.flujosUseCase.getFlujoByModulo(modulo);
|
|
20
|
+
if (flujo) {
|
|
21
|
+
res.status(200).json(flujo);
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
res.status(404).send('Flujo no encontrado para el módulo especificado');
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
catch (error) {
|
|
28
|
+
console.error("FlujosController.getFlujoByModulo", error);
|
|
29
|
+
res.status(500).send('Error interno del servidor al obtener el flujo por módulo');
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
exports.FlujosController = FlujosController;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.FlujosRepository = void 0;
|
|
13
|
+
const connection_sql_1 = require("../../../infrastructure/bd/connection.sql");
|
|
14
|
+
class FlujosRepository {
|
|
15
|
+
insert(flujo) {
|
|
16
|
+
throw new Error("Method not implemented.");
|
|
17
|
+
}
|
|
18
|
+
selectByModulo(modulo) {
|
|
19
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
20
|
+
const query = `SELECT * FROM Flujos WHERE modulo = '${modulo}'`;
|
|
21
|
+
// console.log("QUERY", query)
|
|
22
|
+
return yield (0, connection_sql_1.getConnection)(query).then(resp => {
|
|
23
|
+
let flujo = JSON.parse(resp.recordset[0].flujo);
|
|
24
|
+
return flujo;
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
update(flujo) {
|
|
29
|
+
throw new Error("Method not implemented.");
|
|
30
|
+
}
|
|
31
|
+
delete(modulo) {
|
|
32
|
+
throw new Error("Method not implemented.");
|
|
33
|
+
}
|
|
34
|
+
delete2() { }
|
|
35
|
+
}
|
|
36
|
+
exports.FlujosRepository = FlujosRepository;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const express_1 = require("express");
|
|
7
|
+
const dependency_injection_1 = __importDefault(require("../../../dependency-injection/dependency-injection"));
|
|
8
|
+
const middleware_auth_1 = require("../../../infrastructure/middlewares/middleware.auth");
|
|
9
|
+
const route = (0, express_1.Router)();
|
|
10
|
+
/**
|
|
11
|
+
* Iniciar Repository
|
|
12
|
+
*/
|
|
13
|
+
const flujo = dependency_injection_1.default.get('EE.Flujos.infrastructure.FlujosController');
|
|
14
|
+
/**
|
|
15
|
+
* Routes
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* @openapi
|
|
19
|
+
* /caratulas:
|
|
20
|
+
* post:
|
|
21
|
+
* summary: Crea una nueva caratula y genera el pdf del formulario correspondiente
|
|
22
|
+
* description: Crea una nueva caratula y genera el pdf del formulario correspondiente
|
|
23
|
+
* operationId: post caratulas
|
|
24
|
+
* tags:
|
|
25
|
+
* - Tramites
|
|
26
|
+
* requestBody:
|
|
27
|
+
* description: Marcadores del pdf a generar y metadatos de una caratula.
|
|
28
|
+
* required: true
|
|
29
|
+
* content:
|
|
30
|
+
* application/json:
|
|
31
|
+
* type: object
|
|
32
|
+
* schema:
|
|
33
|
+
* properties:
|
|
34
|
+
* marcadores:
|
|
35
|
+
* type: object
|
|
36
|
+
* caratula:
|
|
37
|
+
* type: object
|
|
38
|
+
* responses:
|
|
39
|
+
* '200':
|
|
40
|
+
* content-disposition: attachment;
|
|
41
|
+
* description: Se creo una nueva caratula.
|
|
42
|
+
* '400':
|
|
43
|
+
* description: Error
|
|
44
|
+
* '500':
|
|
45
|
+
* description: Error interno
|
|
46
|
+
* security:
|
|
47
|
+
* - Authentication: []
|
|
48
|
+
*/
|
|
49
|
+
route.get('/flujo/:modulo', middleware_auth_1.validarToken, flujo.getFlujoByModulo);
|
|
50
|
+
exports.default = route;
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
+
exports.ExpedienteElectronicoUseCase = void 0;
|
|
36
|
+
const digitalSignature_useCase_1 = require("../../digitalSignature/application/digitalSignature.useCase");
|
|
37
|
+
const pagination_sql_1 = require("../../infrastructure/bd/pagination.sql");
|
|
38
|
+
const middleware_auth_1 = require("../../infrastructure/middlewares/middleware.auth");
|
|
39
|
+
const notas_class_1 = require("../domain/value-object/notas.class");
|
|
40
|
+
const axios = require('axios');
|
|
41
|
+
const fs = __importStar(require("fs"));
|
|
42
|
+
class ExpedienteElectronicoUseCase {
|
|
43
|
+
constructor(expedienteRepo) {
|
|
44
|
+
this.expedienteRepo = expedienteRepo;
|
|
45
|
+
this.getExpedienteByIdUseCase = (id) => __awaiter(this, void 0, void 0, function* () {
|
|
46
|
+
try {
|
|
47
|
+
const response = yield this.expedienteRepo.getExpedienteById(id);
|
|
48
|
+
return response;
|
|
49
|
+
}
|
|
50
|
+
catch (error) {
|
|
51
|
+
console.error("Error ExpedienteUseCase.getExpedienteByIdUseCase=>", error);
|
|
52
|
+
throw error;
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
this.getExpedienteByIdCodigoInterno = (codigoInterno) => __awaiter(this, void 0, void 0, function* () {
|
|
56
|
+
try {
|
|
57
|
+
const response = yield this.expedienteRepo.getExpedienteByCodigoInterno(codigoInterno);
|
|
58
|
+
return response;
|
|
59
|
+
}
|
|
60
|
+
catch (error) {
|
|
61
|
+
console.error("Error ExpedienteUseCase.getExpedienteByCodigoInternoUseCase=>", error);
|
|
62
|
+
throw error;
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
this.getExpUseCase = (usuario, page, limit, estado, filtro) => __awaiter(this, void 0, void 0, function* () {
|
|
66
|
+
const unidades = yield (0, middleware_auth_1.getChildrenLabelNumbers)(usuario.unidad);
|
|
67
|
+
usuario.unidades = unidades;
|
|
68
|
+
const pagination = (0, pagination_sql_1.getPagination)(page, limit);
|
|
69
|
+
let response = yield this.expedienteRepo.getExpRepo(usuario, pagination, estado, filtro);
|
|
70
|
+
return response;
|
|
71
|
+
});
|
|
72
|
+
this.getExpSinPaginacionUseCase = (usuario, estado, filtros) => __awaiter(this, void 0, void 0, function* () {
|
|
73
|
+
const unidades = yield (0, middleware_auth_1.getChildrenLabelNumbers)(usuario.unidad);
|
|
74
|
+
usuario.unidades = unidades;
|
|
75
|
+
let response = yield this.expedienteRepo.getExpSinPaginacionRepo(usuario, estado, filtros);
|
|
76
|
+
return response;
|
|
77
|
+
});
|
|
78
|
+
this.getExpPendientesUseCase = (usuario, page, limit) => __awaiter(this, void 0, void 0, function* () {
|
|
79
|
+
const unidades = yield (0, middleware_auth_1.getChildrenLabelNumbers)(usuario.unidad);
|
|
80
|
+
usuario.unidades = unidades;
|
|
81
|
+
const pagination = (0, pagination_sql_1.getPagination)(page, limit);
|
|
82
|
+
let response = yield this.expedienteRepo.getExpPendientesRepo(usuario, pagination);
|
|
83
|
+
return response;
|
|
84
|
+
});
|
|
85
|
+
this.getExpPendientesSinPaginadoUseCase = (usuario) => __awaiter(this, void 0, void 0, function* () {
|
|
86
|
+
const unidades = yield (0, middleware_auth_1.getChildrenLabelNumbers)(usuario.unidad);
|
|
87
|
+
usuario.unidades = unidades;
|
|
88
|
+
let response = yield this.expedienteRepo.getExpPendientesSinPaginacionRepo(usuario);
|
|
89
|
+
return response;
|
|
90
|
+
});
|
|
91
|
+
this.getExpRechazadosUseCase = (usuario, page, limit) => __awaiter(this, void 0, void 0, function* () {
|
|
92
|
+
const unidades = yield (0, middleware_auth_1.getChildrenLabelNumbers)(usuario.unidad);
|
|
93
|
+
usuario.unidades = unidades;
|
|
94
|
+
const pagination = (0, pagination_sql_1.getPagination)(page, limit);
|
|
95
|
+
let response = yield this.expedienteRepo.getExpRechazadosRepo(usuario, pagination);
|
|
96
|
+
return response;
|
|
97
|
+
});
|
|
98
|
+
this.getExpAprobadosUseCase = (usuario, page, limit) => __awaiter(this, void 0, void 0, function* () {
|
|
99
|
+
const unidades = yield (0, middleware_auth_1.getChildrenLabelNumbers)(usuario.unidad);
|
|
100
|
+
usuario.unidades = unidades;
|
|
101
|
+
const pagination = (0, pagination_sql_1.getPagination)(page, limit);
|
|
102
|
+
let response = yield this.expedienteRepo.getExpAprobadosRepo(usuario, pagination);
|
|
103
|
+
return response;
|
|
104
|
+
});
|
|
105
|
+
this.getExpTotalesUseCase = (usuario) => __awaiter(this, void 0, void 0, function* () {
|
|
106
|
+
const unidades = yield (0, middleware_auth_1.getChildrenLabelNumbers)(usuario.unidad);
|
|
107
|
+
usuario.unidades = unidades;
|
|
108
|
+
let response = yield this.expedienteRepo.getExpTotalesRepo(usuario);
|
|
109
|
+
return response;
|
|
110
|
+
});
|
|
111
|
+
this.getExpCantidadPendientesUseCase = (usuario) => __awaiter(this, void 0, void 0, function* () {
|
|
112
|
+
const unidades = yield (0, middleware_auth_1.getChildrenLabelNumbers)(usuario.unidad);
|
|
113
|
+
usuario.unidades = unidades;
|
|
114
|
+
let response = yield this.expedienteRepo.getExpCantidadPendientesRepo(usuario);
|
|
115
|
+
return response;
|
|
116
|
+
});
|
|
117
|
+
this.getExpCantidadAprobadosUseCase = (usuario) => __awaiter(this, void 0, void 0, function* () {
|
|
118
|
+
const unidades = yield (0, middleware_auth_1.getChildrenLabelNumbers)(usuario.unidad);
|
|
119
|
+
usuario.unidades = unidades;
|
|
120
|
+
let response = yield this.expedienteRepo.getExpCantidadAprobadosRepo(usuario);
|
|
121
|
+
return response;
|
|
122
|
+
});
|
|
123
|
+
this.getExpCantidadRechazadosUseCase = (usuario) => __awaiter(this, void 0, void 0, function* () {
|
|
124
|
+
const unidades = yield (0, middleware_auth_1.getChildrenLabelNumbers)(usuario.unidad);
|
|
125
|
+
usuario.unidades = unidades;
|
|
126
|
+
let response = yield this.expedienteRepo.getExpCantidadRechazadosRepo(usuario);
|
|
127
|
+
return response;
|
|
128
|
+
});
|
|
129
|
+
this.guardarNotaUseCase = (idExpediente, notaParams, usuario) => __awaiter(this, void 0, void 0, function* () {
|
|
130
|
+
let expediente = yield this.expedienteRepo.getExpedienteById(idExpediente);
|
|
131
|
+
if (!expediente) {
|
|
132
|
+
throw new Error(`No existe la expediente con id: ${idExpediente}`);
|
|
133
|
+
}
|
|
134
|
+
if (!notaParams.unidades.includes(usuario.unidad)) {
|
|
135
|
+
notaParams.unidades.push(usuario.unidad);
|
|
136
|
+
}
|
|
137
|
+
if (usuario.unidad !== usuario.gerencia && !notaParams.unidades.includes(usuario.gerencia)) {
|
|
138
|
+
notaParams.unidades.push(usuario.gerencia);
|
|
139
|
+
}
|
|
140
|
+
let nuevaNota = new notas_class_1.Nota(notaParams, usuario);
|
|
141
|
+
expediente.notas.push(nuevaNota);
|
|
142
|
+
return yield this.expedienteRepo.updateExpediente(idExpediente, expediente);
|
|
143
|
+
});
|
|
144
|
+
this.leerNotaUseCase = (idExpediente, usuario) => __awaiter(this, void 0, void 0, function* () {
|
|
145
|
+
let expediente = yield this.expedienteRepo.getExpedienteById(idExpediente);
|
|
146
|
+
if (!expediente) {
|
|
147
|
+
throw new Error(`No existe expediente con id: ${idExpediente}`);
|
|
148
|
+
}
|
|
149
|
+
expediente.notas.forEach(nota => {
|
|
150
|
+
nota.marcarNotaComoLeida(usuario);
|
|
151
|
+
});
|
|
152
|
+
return yield this.expedienteRepo.updateExpediente(idExpediente, expediente);
|
|
153
|
+
});
|
|
154
|
+
this.getAllUnidades = () => __awaiter(this, void 0, void 0, function* () {
|
|
155
|
+
//SE REEMPLAZA POR API CON LA GERENCIA DE DIRECTORIO
|
|
156
|
+
// let response = await this.expedienteRepo.getUnidadesPref();
|
|
157
|
+
// return response;
|
|
158
|
+
const unidades = yield (0, middleware_auth_1.getChildrenLabelNumbers)('0900');
|
|
159
|
+
return unidades;
|
|
160
|
+
});
|
|
161
|
+
this.getUnidadesByUnidad = (unidad) => __awaiter(this, void 0, void 0, function* () {
|
|
162
|
+
const unidades = yield (0, middleware_auth_1.getChildrenLabelNumbers)(unidad);
|
|
163
|
+
return unidades;
|
|
164
|
+
});
|
|
165
|
+
this.firmarDocumentoUseCase = (documento, usuario, firma, clave) => __awaiter(this, void 0, void 0, function* () {
|
|
166
|
+
let buffer = fs.readFileSync(documento.path);
|
|
167
|
+
return yield (0, digitalSignature_useCase_1.firmarDocumento)(buffer, usuario, firma, clave);
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
exports.ExpedienteElectronicoUseCase = ExpedienteElectronicoUseCase;
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ExpedienteElectronico = void 0;
|
|
4
|
+
const documento_class_1 = require("../../documentos/domain/documento.class");
|
|
5
|
+
const estado_class_1 = require("../../estados/domain/estado.class");
|
|
6
|
+
const limited_string_class_1 = require("./value-object/limited-string.class");
|
|
7
|
+
const notas_class_1 = require("./value-object/notas.class");
|
|
8
|
+
class ExpedienteElectronico {
|
|
9
|
+
constructor(params) {
|
|
10
|
+
if (params) {
|
|
11
|
+
this.id = params.id;
|
|
12
|
+
this.fechaAlta = params.fechaAlta;
|
|
13
|
+
this.titulo = new limited_string_class_1.LimitedString(params.titulo, 255).getValue();
|
|
14
|
+
this.descripcion = new limited_string_class_1.LimitedString(params.descripcion, 1000).getValue();
|
|
15
|
+
this.tipo = params.tipo;
|
|
16
|
+
this.codigoInterno = params.codigoInterno;
|
|
17
|
+
this.fechaCierre = params.fechaCierre;
|
|
18
|
+
if (params.usuarioResponsable) {
|
|
19
|
+
this.usuarioResponsable = params.usuarioResponsable;
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
throw new Error("usuarioResponsable debe estar definido");
|
|
23
|
+
}
|
|
24
|
+
this.setEstado(params.estado);
|
|
25
|
+
this.bitacora = this.asignarBitacora(params.bitacora);
|
|
26
|
+
let notas = [];
|
|
27
|
+
if (params.notas) {
|
|
28
|
+
params.notas.forEach(nota => {
|
|
29
|
+
notas.push(new notas_class_1.Nota(nota, nota.usuarioResponsable));
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
this.notas = notas;
|
|
33
|
+
if (params.documentos)
|
|
34
|
+
this.setDocumentos(params.documentos);
|
|
35
|
+
else
|
|
36
|
+
this.documentos = [];
|
|
37
|
+
this.origen = new limited_string_class_1.LimitedString(params.origen, 4).getValue();
|
|
38
|
+
;
|
|
39
|
+
this.destino = new limited_string_class_1.LimitedString(params.destino, 4).getValue();
|
|
40
|
+
;
|
|
41
|
+
if (params.extras)
|
|
42
|
+
this.extras = params.extras;
|
|
43
|
+
else
|
|
44
|
+
this.extras = {};
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
asignarBitacora(bitacora) {
|
|
48
|
+
if (bitacora) {
|
|
49
|
+
if (Array.isArray(bitacora)) {
|
|
50
|
+
return bitacora;
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
throw new Error('El atributo bitacora debe ser un array de objetos.');
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
return [];
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
static fromRecordset(recordset) {
|
|
61
|
+
if (!recordset) {
|
|
62
|
+
throw new Error("comprasContrataciones.fromRecordset recordset es undefined");
|
|
63
|
+
}
|
|
64
|
+
let expediente = recordset;
|
|
65
|
+
expediente.bitacora = JSON.parse(expediente.bitacora);
|
|
66
|
+
expediente.notas = expediente.notas ? JSON.parse(expediente.notas) : [];
|
|
67
|
+
expediente.documentos = JSON.parse(expediente.documentos);
|
|
68
|
+
expediente.documentos.forEach((doc, index) => {
|
|
69
|
+
// Verificamos si existe el campo 'estadoWorkflow' en el documento
|
|
70
|
+
const estadoWorkflow = doc.estadoWorkflow;
|
|
71
|
+
// Verificar si doc.extras existe, y si no, crear un objeto vacío
|
|
72
|
+
const extras = doc.extras || {};
|
|
73
|
+
// Creamos la instancia de DocumentoCC con estadoWorkflow incluido
|
|
74
|
+
const documento = new documento_class_1.Documento(doc.uuid, doc.nombre, doc.descripcion, doc.size, {}, doc.firmado, estadoWorkflow);
|
|
75
|
+
expediente.documentos[index] = documento;
|
|
76
|
+
});
|
|
77
|
+
expediente.extras = JSON.parse(expediente.extras);
|
|
78
|
+
expediente.usuarioResponsable = JSON.parse(expediente.usuarioResponsable);
|
|
79
|
+
expediente.estado = JSON.parse(expediente.estado);
|
|
80
|
+
expediente.estado = new estado_class_1.Estado(expediente.estado);
|
|
81
|
+
let exp = Object.assign(expediente, expediente.extras);
|
|
82
|
+
delete exp.extras;
|
|
83
|
+
return new ExpedienteElectronico(exp);
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Setea un estado al expediente. Si el estado es undefined, se setea un estado por default.
|
|
87
|
+
* @param estado El estado que se quiere setear al expediente
|
|
88
|
+
*/
|
|
89
|
+
setEstado(estado) {
|
|
90
|
+
if (estado) {
|
|
91
|
+
if (estado instanceof estado_class_1.Estado) {
|
|
92
|
+
this.estado = estado;
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
this.estado = new estado_class_1.Estado(estado);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
this.estado = estado_class_1.Estado.estadoPorDefault();
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
*
|
|
104
|
+
* @returns Devuelve el estado actual del expediente.
|
|
105
|
+
*/
|
|
106
|
+
getEstado() {
|
|
107
|
+
return this.estado;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Setea un arreglo de documentos al expediente
|
|
111
|
+
* @param documentos El nuevo arreglo de documentos que se quiere setear al expediente
|
|
112
|
+
*/
|
|
113
|
+
setDocumentos(documentos) {
|
|
114
|
+
if (Array.isArray(documentos)) {
|
|
115
|
+
if (documentos.every(doc => doc instanceof documento_class_1.Documento)) {
|
|
116
|
+
this.documentos = documentos;
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
119
|
+
throw new Error('El atributo documentos debe ser un array de objetos de tipo Documento');
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
throw new Error('El atributo documentos debe ser un array');
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Agrega un nuevo documento al arreglo de documentos del expediente.
|
|
128
|
+
* @param documento El documento que se quiere agregar al arreglo de documentos del expediente.
|
|
129
|
+
*/
|
|
130
|
+
pushDocumento(documento) {
|
|
131
|
+
if (documento instanceof documento_class_1.Documento) {
|
|
132
|
+
this.documentos.push(documento);
|
|
133
|
+
}
|
|
134
|
+
else {
|
|
135
|
+
throw new Error('El atributo documento debe ser de tipo Documento');
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Reemplaza el documento que esta en el indice indicado por el que se envia como parametro.
|
|
140
|
+
* @param index: Indice del docuemento a reemplazar.
|
|
141
|
+
* @param documento El documento que reemplaza al anterior.
|
|
142
|
+
*/
|
|
143
|
+
modificarDocumento(index, documento) {
|
|
144
|
+
if (documento instanceof documento_class_1.Documento) {
|
|
145
|
+
this.documentos[index] = documento;
|
|
146
|
+
}
|
|
147
|
+
else {
|
|
148
|
+
throw new Error('El atributo documento debe ser de tipo Documento');
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
getDocumentos() {
|
|
152
|
+
return this.documentos;
|
|
153
|
+
}
|
|
154
|
+
avanzarEstado(usuario, flujo) {
|
|
155
|
+
this.setEstado(this.estado.autorizar(usuario, flujo));
|
|
156
|
+
}
|
|
157
|
+
updateFlagExito(exito) {
|
|
158
|
+
this.estado.setFlagExito(exito);
|
|
159
|
+
}
|
|
160
|
+
supervisar(usuario, flujo) {
|
|
161
|
+
this.setEstado(this.estado.supervisar(usuario, flujo));
|
|
162
|
+
}
|
|
163
|
+
observar(usuario, flujo) {
|
|
164
|
+
this.setEstado(this.estado.observar(usuario, flujo));
|
|
165
|
+
}
|
|
166
|
+
rechazar(usuario, flujo) {
|
|
167
|
+
this.setEstado(this.estado.rechazar(usuario, flujo));
|
|
168
|
+
}
|
|
169
|
+
cancelar(usuario, flujo) {
|
|
170
|
+
this.setEstado(this.estado.cancelar(usuario, flujo));
|
|
171
|
+
}
|
|
172
|
+
devolver(usuario, flujo) {
|
|
173
|
+
this.setEstado(this.estado.devolver(usuario, flujo));
|
|
174
|
+
}
|
|
175
|
+
firmar(usuario, flujo) {
|
|
176
|
+
this.setEstado(this.estado.firmar(usuario, flujo));
|
|
177
|
+
}
|
|
178
|
+
getAtributos() {
|
|
179
|
+
return this.extras;
|
|
180
|
+
}
|
|
181
|
+
static transferirExpediente(expediente, oficinaResponsable) {
|
|
182
|
+
const unidad = oficinaResponsable.split("-");
|
|
183
|
+
let result = unidad[1].replace(/\s/g, "");
|
|
184
|
+
if (!expediente.getEstado().esVisiblePor.includes(result)) {
|
|
185
|
+
expediente.getEstado().esVisiblePor.push(result);
|
|
186
|
+
}
|
|
187
|
+
return expediente.getEstado();
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
exports.ExpedienteElectronico = ExpedienteElectronico;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LimitedString = void 0;
|
|
4
|
+
class LimitedString {
|
|
5
|
+
constructor(value, maxLength) {
|
|
6
|
+
if (value === null || value === undefined) {
|
|
7
|
+
throw new Error('Value must be defined');
|
|
8
|
+
}
|
|
9
|
+
if (value.length > maxLength) {
|
|
10
|
+
throw new Error(`El valor debe tener menos de ${maxLength} caracteres.`);
|
|
11
|
+
}
|
|
12
|
+
this.value = value;
|
|
13
|
+
this.maxLength = maxLength;
|
|
14
|
+
}
|
|
15
|
+
getValue() {
|
|
16
|
+
return this.value;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
exports.LimitedString = LimitedString;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.Nota = void 0;
|
|
7
|
+
const moment_1 = __importDefault(require("moment"));
|
|
8
|
+
class Nota {
|
|
9
|
+
constructor(params, usuario) {
|
|
10
|
+
this.title = params.title;
|
|
11
|
+
this.importance = params.importance;
|
|
12
|
+
this.message = params.message;
|
|
13
|
+
this.unidades = params.unidades;
|
|
14
|
+
this.fechaHora = (0, moment_1.default)().locale('es').format('LLL'),
|
|
15
|
+
this.leida = false;
|
|
16
|
+
this.leidaPor = params.leidaPor ? params.leidaPor : [];
|
|
17
|
+
this.usuarioResponsable = {
|
|
18
|
+
nombreCompleto: usuario.nombreCompleto,
|
|
19
|
+
unidad: usuario.unidad,
|
|
20
|
+
uid: usuario.uid
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
marcarNotaComoLeida(usuario) {
|
|
24
|
+
if (!this.leidaPor) {
|
|
25
|
+
this.leidaPor = [];
|
|
26
|
+
}
|
|
27
|
+
let leidoPorUnidad = this.leidaPor.find(leido => leido.unidad === usuario.unidad);
|
|
28
|
+
if (this.unidades.includes(usuario.unidad)) {
|
|
29
|
+
this.leida = true;
|
|
30
|
+
if (!leidoPorUnidad) {
|
|
31
|
+
this.leidaPor.push({ unidad: usuario.unidad, afiliados: [usuario.uid] });
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
if (!leidoPorUnidad.afiliados.includes(usuario.uid)) {
|
|
35
|
+
leidoPorUnidad.afiliados.push(usuario.uid);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
exports.Nota = Nota;
|