@muni-sanfer/types-gestor-documental 0.0.1-beta.6 → 0.0.1-beta.7
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/base/entities.d.ts +16 -0
- package/dist/contracts/document.contract.d.ts +21 -1
- package/dist/contracts/document.contract.js +1 -0
- package/dist/contracts/documentType.contract.d.ts +1 -0
- package/dist/contracts/index.d.ts +12 -1
- package/dist/contracts/index.js +3 -0
- package/dist/contracts/signatureBatch.contract.d.ts +108 -0
- package/dist/contracts/signatureBatch.contract.js +12 -0
- package/dist/entities/document/document.entity.d.ts +31 -0
- package/dist/entities/documentType/documentType.entity.d.ts +1 -0
- package/dist/entities/index.d.ts +1 -0
- package/dist/entities/index.js +1 -0
- package/dist/entities/signatureBatch/index.d.ts +1 -0
- package/dist/entities/signatureBatch/index.js +17 -0
- package/dist/entities/signatureBatch/signatureBatch.entity.d.ts +106 -0
- package/dist/entities/signatureBatch/signatureBatch.entity.js +2 -0
- package/package.json +1 -1
- package/src/base/entities.ts +17 -0
- package/src/contracts/document.contract.ts +17 -0
- package/src/contracts/documentType.contract.ts +2 -0
- package/src/contracts/index.ts +5 -1
- package/src/contracts/signatureBatch.contract.ts +94 -0
- package/src/entities/document/document.entity.ts +27 -0
- package/src/entities/documentType/documentType.entity.ts +2 -0
- package/src/entities/index.ts +1 -0
- package/src/entities/signatureBatch/index.ts +1 -0
- package/src/entities/signatureBatch/signatureBatch.entity.ts +104 -0
- package/tsconfig.json +1 -3
package/dist/base/entities.d.ts
CHANGED
|
@@ -169,11 +169,13 @@ export interface DocumentTypeEntity {
|
|
|
169
169
|
nextCorrelative: number;
|
|
170
170
|
correlativeYear?: number | null;
|
|
171
171
|
resetsYearly: boolean;
|
|
172
|
+
numbered: boolean;
|
|
172
173
|
directorateCodeReference?: number | null;
|
|
173
174
|
enabled: boolean;
|
|
174
175
|
documents?: DocumentEntity[];
|
|
175
176
|
annulledNumbers?: DocumentAnnulledNumberEntity[];
|
|
176
177
|
flowSteps?: DocumentTypeFlowStepEntity[];
|
|
178
|
+
signatureBatches?: SignatureBatchEntity[];
|
|
177
179
|
deleted: boolean;
|
|
178
180
|
createdAt: string;
|
|
179
181
|
updatedAt: string;
|
|
@@ -201,6 +203,8 @@ export interface DocumentEntity {
|
|
|
201
203
|
externalDate?: string | null;
|
|
202
204
|
contentText?: string | null;
|
|
203
205
|
textExtractedAt?: string | null;
|
|
206
|
+
batch?: SignatureBatchEntity | null;
|
|
207
|
+
batchId?: string | null;
|
|
204
208
|
replyTo?: DocumentEntity | null;
|
|
205
209
|
replyToDocumentId?: string | null;
|
|
206
210
|
replies?: DocumentEntity[];
|
|
@@ -230,6 +234,18 @@ export interface DocumentEntity {
|
|
|
230
234
|
createdAt: string;
|
|
231
235
|
updatedAt: string;
|
|
232
236
|
}
|
|
237
|
+
export interface SignatureBatchEntity {
|
|
238
|
+
id: string;
|
|
239
|
+
name: string;
|
|
240
|
+
createdByEmployeeId: string;
|
|
241
|
+
createdByFullName: string;
|
|
242
|
+
documentType?: DocumentTypeEntity;
|
|
243
|
+
documentTypeId: string;
|
|
244
|
+
documents?: DocumentEntity[];
|
|
245
|
+
deleted: boolean;
|
|
246
|
+
createdAt: string;
|
|
247
|
+
updatedAt: string;
|
|
248
|
+
}
|
|
233
249
|
export interface DocumentParticipantEntity {
|
|
234
250
|
id: string;
|
|
235
251
|
role: DocumentParticipantRole;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type DocumentAccessLevel, type DocumentAttachmentEntity, type DocumentDeliveryEntity, type DocumentEntity, type DocumentInstruction, type DocumentParticipantEntity, type DocumentStatus } from '../base/entities';
|
|
2
|
-
import { type DocumentAnnulResponseEntity, type DocumentCloseDeliveryResponseEntity, type DocumentCreateResponseEntity, type DocumentDeriveResponseEntity, type DocumentDiscardResponseEntity, type DocumentGetAllResponseEntity, type DocumentGetByIdResponseEntity, type DocumentGetSummaryResponseEntity, type DocumentInboxItemEntity, type DocumentPublicFileResponseEntity, type DocumentReassignResponseEntity, type DocumentReviewResponseEntity, type DocumentUpdateResponseEntity, type DocumentVerifyResponseEntity } from '../entities';
|
|
2
|
+
import { type DocumentAnnulResponseEntity, type DocumentCloseDeliveryResponseEntity, type DocumentCreateResponseEntity, type DocumentDeriveResponseEntity, type DocumentDiscardResponseEntity, type DocumentGetAllResponseEntity, type DocumentGetByIdResponseEntity, type DocumentGetSummaryResponseEntity, type DocumentInboxItemEntity, type DocumentPublicFileResponseEntity, type DocumentReassignResponseEntity, type DocumentReviewResponseEntity, type DocumentSignManyResponseEntity, type DocumentUpdateResponseEntity, type DocumentVerifyResponseEntity } from '../entities';
|
|
3
3
|
import { type RpcPage } from './contract';
|
|
4
4
|
/** Patrones NATS de `document`: `<servicio>.<recurso>.<acción>`. */
|
|
5
5
|
export declare const DocumentPatterns: {
|
|
@@ -10,6 +10,7 @@ export declare const DocumentPatterns: {
|
|
|
10
10
|
readonly create: "gestorDocumental.document.create";
|
|
11
11
|
readonly update: "gestorDocumental.document.update";
|
|
12
12
|
readonly review: "gestorDocumental.document.review";
|
|
13
|
+
readonly signMany: "gestorDocumental.document.signMany";
|
|
13
14
|
readonly reassign: "gestorDocumental.document.reassign";
|
|
14
15
|
readonly discard: "gestorDocumental.document.discard";
|
|
15
16
|
readonly annul: "gestorDocumental.document.annul";
|
|
@@ -161,6 +162,25 @@ export interface DocumentContract {
|
|
|
161
162
|
};
|
|
162
163
|
response: DocumentReviewResponseEntity;
|
|
163
164
|
};
|
|
165
|
+
/**
|
|
166
|
+
* Firma con un solo OTP varios documentos que el funcionario tiene en su turno de firma (los de un lote, o los que
|
|
167
|
+
* marcó en su bandeja). Cada uno queda firmado aparte; los que no caben en la solicitud quedan en `remaining`.
|
|
168
|
+
*/
|
|
169
|
+
[DocumentPatterns.signMany]: {
|
|
170
|
+
payload: {
|
|
171
|
+
ids: DocumentEntity['id'][];
|
|
172
|
+
observation?: string | null;
|
|
173
|
+
signer: {
|
|
174
|
+
rut: string;
|
|
175
|
+
fullName: string;
|
|
176
|
+
role: string;
|
|
177
|
+
areaName: string;
|
|
178
|
+
};
|
|
179
|
+
otp?: string;
|
|
180
|
+
actor: DocumentActor;
|
|
181
|
+
};
|
|
182
|
+
response: DocumentSignManyResponseEntity;
|
|
183
|
+
};
|
|
164
184
|
/**
|
|
165
185
|
* Pasa un turno pendiente (de visación o de firma) a otro funcionario, por ausencia o por error, y lo deja en la
|
|
166
186
|
* trazabilidad con su motivo. Puede hacerlo quien redactó el documento; con `anyDocument`, quien lleva el registro.
|
|
@@ -10,6 +10,7 @@ exports.DocumentPatterns = {
|
|
|
10
10
|
create: 'gestorDocumental.document.create',
|
|
11
11
|
update: 'gestorDocumental.document.update',
|
|
12
12
|
review: 'gestorDocumental.document.review',
|
|
13
|
+
signMany: 'gestorDocumental.document.signMany',
|
|
13
14
|
reassign: 'gestorDocumental.document.reassign',
|
|
14
15
|
discard: 'gestorDocumental.document.discard',
|
|
15
16
|
annul: 'gestorDocumental.document.annul',
|
|
@@ -4,6 +4,7 @@ import { type DocumentTypeContract } from './documentType.contract';
|
|
|
4
4
|
import { type PartsOfficeContract } from './partsOffice.contract';
|
|
5
5
|
import { type ProcedureContract } from './procedure.contract';
|
|
6
6
|
import { type RegisterBookContract } from './registerBook.contract';
|
|
7
|
+
import { type SignatureBatchContract } from './signatureBatch.contract';
|
|
7
8
|
export * from './contract';
|
|
8
9
|
export * from './document.contract';
|
|
9
10
|
export * from './documentType.contract';
|
|
@@ -11,6 +12,7 @@ export * from './procedure.contract';
|
|
|
11
12
|
export * from './caseFile.contract';
|
|
12
13
|
export * from './partsOffice.contract';
|
|
13
14
|
export * from './registerBook.contract';
|
|
15
|
+
export * from './signatureBatch.contract';
|
|
14
16
|
/** Patrones NATS de gestor-documental-ms, por recurso: `gestorDocumental.<recurso>.<acción>`. */
|
|
15
17
|
export declare const GestorDocumentalPatterns: {
|
|
16
18
|
readonly documentType: {
|
|
@@ -28,6 +30,7 @@ export declare const GestorDocumentalPatterns: {
|
|
|
28
30
|
readonly create: "gestorDocumental.document.create";
|
|
29
31
|
readonly update: "gestorDocumental.document.update";
|
|
30
32
|
readonly review: "gestorDocumental.document.review";
|
|
33
|
+
readonly signMany: "gestorDocumental.document.signMany";
|
|
31
34
|
readonly reassign: "gestorDocumental.document.reassign";
|
|
32
35
|
readonly discard: "gestorDocumental.document.discard";
|
|
33
36
|
readonly annul: "gestorDocumental.document.annul";
|
|
@@ -79,6 +82,14 @@ export declare const GestorDocumentalPatterns: {
|
|
|
79
82
|
readonly get: "gestorDocumental.registerBook.get";
|
|
80
83
|
readonly export: "gestorDocumental.registerBook.export";
|
|
81
84
|
};
|
|
85
|
+
readonly signatureBatch: {
|
|
86
|
+
readonly getAll: "gestorDocumental.signatureBatch.getAll";
|
|
87
|
+
readonly getById: "gestorDocumental.signatureBatch.getById";
|
|
88
|
+
readonly create: "gestorDocumental.signatureBatch.create";
|
|
89
|
+
readonly visa: "gestorDocumental.signatureBatch.visa";
|
|
90
|
+
readonly sign: "gestorDocumental.signatureBatch.sign";
|
|
91
|
+
readonly reject: "gestorDocumental.signatureBatch.reject";
|
|
92
|
+
};
|
|
82
93
|
};
|
|
83
94
|
/** Contrato completo de gestor-documental-ms: la unión de los contratos de sus recursos. */
|
|
84
|
-
export type GestorDocumentalContract = DocumentTypeContract & DocumentContract & ProcedureContract & CaseFileContract & PartsOfficeContract & RegisterBookContract;
|
|
95
|
+
export type GestorDocumentalContract = DocumentTypeContract & DocumentContract & ProcedureContract & CaseFileContract & PartsOfficeContract & RegisterBookContract & SignatureBatchContract;
|
package/dist/contracts/index.js
CHANGED
|
@@ -21,6 +21,7 @@ const documentType_contract_1 = require("./documentType.contract");
|
|
|
21
21
|
const partsOffice_contract_1 = require("./partsOffice.contract");
|
|
22
22
|
const procedure_contract_1 = require("./procedure.contract");
|
|
23
23
|
const registerBook_contract_1 = require("./registerBook.contract");
|
|
24
|
+
const signatureBatch_contract_1 = require("./signatureBatch.contract");
|
|
24
25
|
__exportStar(require("./contract"), exports);
|
|
25
26
|
__exportStar(require("./document.contract"), exports);
|
|
26
27
|
__exportStar(require("./documentType.contract"), exports);
|
|
@@ -28,6 +29,7 @@ __exportStar(require("./procedure.contract"), exports);
|
|
|
28
29
|
__exportStar(require("./caseFile.contract"), exports);
|
|
29
30
|
__exportStar(require("./partsOffice.contract"), exports);
|
|
30
31
|
__exportStar(require("./registerBook.contract"), exports);
|
|
32
|
+
__exportStar(require("./signatureBatch.contract"), exports);
|
|
31
33
|
/** Patrones NATS de gestor-documental-ms, por recurso: `gestorDocumental.<recurso>.<acción>`. */
|
|
32
34
|
exports.GestorDocumentalPatterns = {
|
|
33
35
|
documentType: documentType_contract_1.DocumentTypePatterns,
|
|
@@ -36,4 +38,5 @@ exports.GestorDocumentalPatterns = {
|
|
|
36
38
|
caseFile: caseFile_contract_1.CaseFilePatterns,
|
|
37
39
|
partsOffice: partsOffice_contract_1.PartsOfficePatterns,
|
|
38
40
|
registerBook: registerBook_contract_1.RegisterBookPatterns,
|
|
41
|
+
signatureBatch: signatureBatch_contract_1.SignatureBatchPatterns,
|
|
39
42
|
};
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { type DocumentAccessLevel } from '../base/entities';
|
|
2
|
+
import { type SignatureBatchCreateResponseEntity, type SignatureBatchGetAllResponseEntity, type SignatureBatchGetByIdResponseEntity, type SignatureBatchRejectResponseEntity, type SignatureBatchSignResponseEntity, type SignatureBatchTab, type SignatureBatchVisaResponseEntity } from '../entities';
|
|
3
|
+
import { type RpcPage } from './contract';
|
|
4
|
+
import { type DocumentActor } from './document.contract';
|
|
5
|
+
/** Patrones NATS de `signatureBatch` (lotes de firma): `<servicio>.<recurso>.<acción>`. */
|
|
6
|
+
export declare const SignatureBatchPatterns: {
|
|
7
|
+
readonly getAll: "gestorDocumental.signatureBatch.getAll";
|
|
8
|
+
readonly getById: "gestorDocumental.signatureBatch.getById";
|
|
9
|
+
readonly create: "gestorDocumental.signatureBatch.create";
|
|
10
|
+
readonly visa: "gestorDocumental.signatureBatch.visa";
|
|
11
|
+
readonly sign: "gestorDocumental.signatureBatch.sign";
|
|
12
|
+
readonly reject: "gestorDocumental.signatureBatch.reject";
|
|
13
|
+
};
|
|
14
|
+
/** Datos de quien firma, para el sello de la firma (los resuelve el gateway desde la sesión). */
|
|
15
|
+
export interface SignatureBatchSigner {
|
|
16
|
+
rut: string;
|
|
17
|
+
fullName: string;
|
|
18
|
+
role: string;
|
|
19
|
+
areaName: string;
|
|
20
|
+
}
|
|
21
|
+
export interface SignatureBatchContract {
|
|
22
|
+
[SignatureBatchPatterns.getAll]: {
|
|
23
|
+
payload: {
|
|
24
|
+
pagination?: {
|
|
25
|
+
page?: number;
|
|
26
|
+
limit?: number;
|
|
27
|
+
};
|
|
28
|
+
filters?: {
|
|
29
|
+
search?: string;
|
|
30
|
+
tab?: SignatureBatchTab;
|
|
31
|
+
};
|
|
32
|
+
actor: DocumentActor;
|
|
33
|
+
};
|
|
34
|
+
response: RpcPage<SignatureBatchGetAllResponseEntity[]>;
|
|
35
|
+
};
|
|
36
|
+
/** Lo ven su redactor y quienes visan o firman sus documentos; con `viewAll`, quien lleva el registro. */
|
|
37
|
+
[SignatureBatchPatterns.getById]: {
|
|
38
|
+
payload: {
|
|
39
|
+
id: string;
|
|
40
|
+
actor: DocumentActor;
|
|
41
|
+
viewAll?: boolean;
|
|
42
|
+
};
|
|
43
|
+
response: SignatureBatchGetByIdResponseEntity;
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Crea el lote y lo envía a tramitación: un documento por cada PDF, todos del mismo tipo y con el mismo flujo.
|
|
47
|
+
* Cada documento recibe su código de verificación y, con su primera firma, su número (si el tipo lo lleva).
|
|
48
|
+
*/
|
|
49
|
+
[SignatureBatchPatterns.create]: {
|
|
50
|
+
payload: {
|
|
51
|
+
name: string;
|
|
52
|
+
documentTypeId: string;
|
|
53
|
+
keywords: string[];
|
|
54
|
+
accessLevel?: DocumentAccessLevel;
|
|
55
|
+
hasSensitiveData?: boolean;
|
|
56
|
+
directorateCodeReference?: number | null;
|
|
57
|
+
departmentId?: string | null;
|
|
58
|
+
visaEmployeeIds?: string[];
|
|
59
|
+
signatureEmployeeIds: string[];
|
|
60
|
+
signatureSheet?: boolean;
|
|
61
|
+
documents: {
|
|
62
|
+
subject: string;
|
|
63
|
+
file: {
|
|
64
|
+
fileId: string;
|
|
65
|
+
name: string;
|
|
66
|
+
};
|
|
67
|
+
}[];
|
|
68
|
+
actor: DocumentActor;
|
|
69
|
+
};
|
|
70
|
+
response: SignatureBatchCreateResponseEntity;
|
|
71
|
+
};
|
|
72
|
+
/** Visa de una vez los documentos del lote que el funcionario tiene en su turno de visación. */
|
|
73
|
+
[SignatureBatchPatterns.visa]: {
|
|
74
|
+
payload: {
|
|
75
|
+
id: string;
|
|
76
|
+
observation?: string | null;
|
|
77
|
+
actor: DocumentActor;
|
|
78
|
+
};
|
|
79
|
+
response: SignatureBatchVisaResponseEntity;
|
|
80
|
+
};
|
|
81
|
+
/**
|
|
82
|
+
* Firma con un solo OTP los documentos del lote que el funcionario tiene en su turno de firma. FirmaGob admite 5 MB
|
|
83
|
+
* por solicitud: los que no caben quedan en `remaining`, para firmarlos con un OTP nuevo.
|
|
84
|
+
*/
|
|
85
|
+
[SignatureBatchPatterns.sign]: {
|
|
86
|
+
payload: {
|
|
87
|
+
id: string;
|
|
88
|
+
observation?: string | null;
|
|
89
|
+
signer: SignatureBatchSigner;
|
|
90
|
+
otp?: string;
|
|
91
|
+
actor: DocumentActor;
|
|
92
|
+
};
|
|
93
|
+
response: SignatureBatchSignResponseEntity;
|
|
94
|
+
};
|
|
95
|
+
/**
|
|
96
|
+
* Devuelve a su redactor los documentos del lote que el funcionario tiene en su turno: todos, o los indicados en
|
|
97
|
+
* `documentIds`. Los demás siguen su curso.
|
|
98
|
+
*/
|
|
99
|
+
[SignatureBatchPatterns.reject]: {
|
|
100
|
+
payload: {
|
|
101
|
+
id: string;
|
|
102
|
+
observation: string;
|
|
103
|
+
documentIds?: string[];
|
|
104
|
+
actor: DocumentActor;
|
|
105
|
+
};
|
|
106
|
+
response: SignatureBatchRejectResponseEntity;
|
|
107
|
+
};
|
|
108
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SignatureBatchPatterns = void 0;
|
|
4
|
+
/** Patrones NATS de `signatureBatch` (lotes de firma): `<servicio>.<recurso>.<acción>`. */
|
|
5
|
+
exports.SignatureBatchPatterns = {
|
|
6
|
+
getAll: 'gestorDocumental.signatureBatch.getAll',
|
|
7
|
+
getById: 'gestorDocumental.signatureBatch.getById',
|
|
8
|
+
create: 'gestorDocumental.signatureBatch.create',
|
|
9
|
+
visa: 'gestorDocumental.signatureBatch.visa',
|
|
10
|
+
sign: 'gestorDocumental.signatureBatch.sign',
|
|
11
|
+
reject: 'gestorDocumental.signatureBatch.reject',
|
|
12
|
+
};
|
|
@@ -145,6 +145,11 @@ export interface DocumentGetByIdResponseEntity {
|
|
|
145
145
|
recipients: DocumentRecipientResponseEntity[];
|
|
146
146
|
deliveries: DocumentDeliveryResponseEntity[];
|
|
147
147
|
replyTo: DocumentLinkEntity | null;
|
|
148
|
+
/** Lote de firma al que pertenece. */
|
|
149
|
+
batch: {
|
|
150
|
+
id: string;
|
|
151
|
+
name: string;
|
|
152
|
+
} | null;
|
|
148
153
|
replies: DocumentLinkEntity[];
|
|
149
154
|
/** Expedientes en que está incorporado y que quien consulta puede ver. */
|
|
150
155
|
caseFiles: {
|
|
@@ -197,6 +202,11 @@ export interface DocumentGetByIdResponseEntity {
|
|
|
197
202
|
export interface DocumentGetSummaryResponseEntity {
|
|
198
203
|
toVisa: number;
|
|
199
204
|
toSign: number;
|
|
205
|
+
/** Lotes de firma con documentos en su turno (los documentos de un lote no se cuentan en `toVisa` ni `toSign`). */
|
|
206
|
+
batches: {
|
|
207
|
+
toVisa: number;
|
|
208
|
+
toSign: number;
|
|
209
|
+
};
|
|
200
210
|
created: {
|
|
201
211
|
drafted: number;
|
|
202
212
|
inProgress: number;
|
|
@@ -222,6 +232,27 @@ export interface DocumentReviewResponseEntity {
|
|
|
222
232
|
ok: boolean;
|
|
223
233
|
status: DocumentEntity['status'];
|
|
224
234
|
}
|
|
235
|
+
/** Resultado de un documento en una firma de varios documentos. */
|
|
236
|
+
export interface DocumentSignManyResultEntity {
|
|
237
|
+
id: DocumentEntity['id'];
|
|
238
|
+
ok: boolean;
|
|
239
|
+
/** Estado en que quedó, si se firmó. */
|
|
240
|
+
status?: DocumentEntity['status'];
|
|
241
|
+
/** Por qué no se firmó. */
|
|
242
|
+
message?: string;
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* Firma de varios documentos con un solo OTP. FirmaGob admite 5 MB por solicitud: los que no cupieron quedan en
|
|
246
|
+
* `remaining`, en el turno del firmante, para firmarlos con un OTP nuevo.
|
|
247
|
+
*/
|
|
248
|
+
export interface DocumentSignManyResponseEntity {
|
|
249
|
+
results: DocumentSignManyResultEntity[];
|
|
250
|
+
signed: number;
|
|
251
|
+
failed: number;
|
|
252
|
+
remaining: DocumentEntity['id'][];
|
|
253
|
+
/** FirmaGob avisó que el OTP venció antes de firmar todos los documentos de la solicitud. */
|
|
254
|
+
otpExpired: boolean;
|
|
255
|
+
}
|
|
225
256
|
export interface DocumentDiscardResponseEntity {
|
|
226
257
|
id: DocumentEntity['id'];
|
|
227
258
|
ok: boolean;
|
|
@@ -19,6 +19,7 @@ export interface DocumentTypeGetAllResponseEntity {
|
|
|
19
19
|
nextCorrelative: DocumentTypeEntity['nextCorrelative'];
|
|
20
20
|
correlativeYear: DocumentTypeEntity['correlativeYear'];
|
|
21
21
|
resetsYearly: DocumentTypeEntity['resetsYearly'];
|
|
22
|
+
numbered: DocumentTypeEntity['numbered'];
|
|
22
23
|
directorateCodeReference: DocumentTypeEntity['directorateCodeReference'];
|
|
23
24
|
enabled: DocumentTypeEntity['enabled'];
|
|
24
25
|
flow: {
|
package/dist/entities/index.d.ts
CHANGED
package/dist/entities/index.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './signatureBatch.entity';
|
|
@@ -0,0 +1,17 @@
|
|
|
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./signatureBatch.entity"), exports);
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { type DocumentAccessLevel, type DocumentEntity, type DocumentParticipantRole, type DocumentStatus, type SignatureBatchEntity } from '../../base/entities';
|
|
2
|
+
import { type DocumentSignManyResponseEntity, type DocumentSignManyResultEntity } from '../document';
|
|
3
|
+
/**
|
|
4
|
+
* Estado de un lote, deducido del de sus documentos: en tramitación mientras alguno lo esté; devuelto si no queda
|
|
5
|
+
* ninguno en tramitación y alguno volvió a su redactor; finalizado si todos terminaron (o se anularon después).
|
|
6
|
+
*/
|
|
7
|
+
export type SignatureBatchStatus = 'InProgress' | 'Returned' | 'Finished';
|
|
8
|
+
/** Lista de lotes: los que esperan al funcionario, los que redactó o todos en que participa. */
|
|
9
|
+
export type SignatureBatchTab = 'pending' | 'created' | 'participated';
|
|
10
|
+
/** Cuántos documentos del lote hay en cada situación. */
|
|
11
|
+
export interface SignatureBatchCountsEntity {
|
|
12
|
+
total: number;
|
|
13
|
+
inProgress: number;
|
|
14
|
+
finished: number;
|
|
15
|
+
/** Devueltos a su redactor (rechazados), para corregirlos y reenviarlos. */
|
|
16
|
+
returned: number;
|
|
17
|
+
annulled: number;
|
|
18
|
+
}
|
|
19
|
+
export interface SignatureBatchGetAllResponseEntity {
|
|
20
|
+
id: string;
|
|
21
|
+
name: string;
|
|
22
|
+
documentType: {
|
|
23
|
+
id: string;
|
|
24
|
+
name: string;
|
|
25
|
+
};
|
|
26
|
+
createdByEmployeeId: string;
|
|
27
|
+
createdByFullName: string;
|
|
28
|
+
createdAt: SignatureBatchEntity['createdAt'];
|
|
29
|
+
status: SignatureBatchStatus;
|
|
30
|
+
counts: SignatureBatchCountsEntity;
|
|
31
|
+
/** Documentos del lote que esperan al funcionario que consulta, por rol. */
|
|
32
|
+
myPending: {
|
|
33
|
+
visa: number;
|
|
34
|
+
signature: number;
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
/** Un documento del lote, con su turno vigente. */
|
|
38
|
+
export interface SignatureBatchDocumentEntity {
|
|
39
|
+
id: string;
|
|
40
|
+
subject: string;
|
|
41
|
+
status: DocumentStatus;
|
|
42
|
+
correlative: number | null;
|
|
43
|
+
correlativeYear: number | null;
|
|
44
|
+
numberedAt: DocumentEntity['numberedAt'];
|
|
45
|
+
verificationCode: string | null;
|
|
46
|
+
originalFileName: string;
|
|
47
|
+
currentTurn: {
|
|
48
|
+
employeeId: string;
|
|
49
|
+
fullName: string;
|
|
50
|
+
role: DocumentParticipantRole;
|
|
51
|
+
} | null;
|
|
52
|
+
/** Si el turno vigente es del funcionario que consulta, qué le toca hacer. */
|
|
53
|
+
myTurn: DocumentParticipantRole | null;
|
|
54
|
+
}
|
|
55
|
+
export interface SignatureBatchGetByIdResponseEntity extends SignatureBatchGetAllResponseEntity {
|
|
56
|
+
documentType: {
|
|
57
|
+
id: string;
|
|
58
|
+
name: string;
|
|
59
|
+
abbreviation: string | null;
|
|
60
|
+
numbered: boolean;
|
|
61
|
+
};
|
|
62
|
+
keywords: string[];
|
|
63
|
+
accessLevel: DocumentAccessLevel;
|
|
64
|
+
hasSensitiveData: boolean;
|
|
65
|
+
/** Visadores y firmantes del lote, en orden (los del primer documento: todos parten con el mismo flujo). */
|
|
66
|
+
flow: {
|
|
67
|
+
role: DocumentParticipantRole;
|
|
68
|
+
employeeId: string;
|
|
69
|
+
fullName: string;
|
|
70
|
+
position: string | null;
|
|
71
|
+
}[];
|
|
72
|
+
documents: SignatureBatchDocumentEntity[];
|
|
73
|
+
}
|
|
74
|
+
/** A quién le quedó el turno después de una operación sobre el lote: para avisarle una sola vez por lote. */
|
|
75
|
+
export interface SignatureBatchTurnEntity {
|
|
76
|
+
employeeId: string;
|
|
77
|
+
fullName: string;
|
|
78
|
+
role: DocumentParticipantRole;
|
|
79
|
+
count: number;
|
|
80
|
+
}
|
|
81
|
+
/** Lo que el gateway necesita para avisar: el lote, su redactor, a quién le toca ahora y cuántos terminaron. */
|
|
82
|
+
export interface SignatureBatchOutcomeEntity {
|
|
83
|
+
id: string;
|
|
84
|
+
name: string;
|
|
85
|
+
createdByEmployeeId: string;
|
|
86
|
+
nextTurns: SignatureBatchTurnEntity[];
|
|
87
|
+
/** Documentos que quedaron finalizados con esta operación. */
|
|
88
|
+
finished: number;
|
|
89
|
+
}
|
|
90
|
+
export interface SignatureBatchCreateResponseEntity extends SignatureBatchOutcomeEntity {
|
|
91
|
+
ok: boolean;
|
|
92
|
+
documentIds: string[];
|
|
93
|
+
}
|
|
94
|
+
export interface SignatureBatchVisaResponseEntity extends SignatureBatchOutcomeEntity {
|
|
95
|
+
ok: boolean;
|
|
96
|
+
visaed: number;
|
|
97
|
+
/** Los que no se pudieron visar, con el motivo. */
|
|
98
|
+
failures: DocumentSignManyResultEntity[];
|
|
99
|
+
}
|
|
100
|
+
export type SignatureBatchSignResponseEntity = SignatureBatchOutcomeEntity & DocumentSignManyResponseEntity;
|
|
101
|
+
export interface SignatureBatchRejectResponseEntity extends SignatureBatchOutcomeEntity {
|
|
102
|
+
ok: boolean;
|
|
103
|
+
/** Documentos devueltos a su redactor. */
|
|
104
|
+
rejected: number;
|
|
105
|
+
observation: string;
|
|
106
|
+
}
|
package/package.json
CHANGED
package/src/base/entities.ts
CHANGED
|
@@ -250,11 +250,13 @@ export interface DocumentTypeEntity {
|
|
|
250
250
|
nextCorrelative: number;
|
|
251
251
|
correlativeYear?: number | null;
|
|
252
252
|
resetsYearly: boolean;
|
|
253
|
+
numbered: boolean;
|
|
253
254
|
directorateCodeReference?: number | null;
|
|
254
255
|
enabled: boolean;
|
|
255
256
|
documents?: DocumentEntity[];
|
|
256
257
|
annulledNumbers?: DocumentAnnulledNumberEntity[];
|
|
257
258
|
flowSteps?: DocumentTypeFlowStepEntity[];
|
|
259
|
+
signatureBatches?: SignatureBatchEntity[];
|
|
258
260
|
deleted: boolean;
|
|
259
261
|
createdAt: string;
|
|
260
262
|
updatedAt: string;
|
|
@@ -283,6 +285,8 @@ export interface DocumentEntity {
|
|
|
283
285
|
externalDate?: string | null;
|
|
284
286
|
contentText?: string | null;
|
|
285
287
|
textExtractedAt?: string | null;
|
|
288
|
+
batch?: SignatureBatchEntity | null;
|
|
289
|
+
batchId?: string | null;
|
|
286
290
|
replyTo?: DocumentEntity | null;
|
|
287
291
|
replyToDocumentId?: string | null;
|
|
288
292
|
replies?: DocumentEntity[];
|
|
@@ -313,6 +317,19 @@ export interface DocumentEntity {
|
|
|
313
317
|
updatedAt: string;
|
|
314
318
|
}
|
|
315
319
|
|
|
320
|
+
export interface SignatureBatchEntity {
|
|
321
|
+
id: string;
|
|
322
|
+
name: string;
|
|
323
|
+
createdByEmployeeId: string;
|
|
324
|
+
createdByFullName: string;
|
|
325
|
+
documentType?: DocumentTypeEntity;
|
|
326
|
+
documentTypeId: string;
|
|
327
|
+
documents?: DocumentEntity[];
|
|
328
|
+
deleted: boolean;
|
|
329
|
+
createdAt: string;
|
|
330
|
+
updatedAt: string;
|
|
331
|
+
}
|
|
332
|
+
|
|
316
333
|
export interface DocumentParticipantEntity {
|
|
317
334
|
id: string;
|
|
318
335
|
role: DocumentParticipantRole;
|
|
@@ -20,6 +20,7 @@ import {
|
|
|
20
20
|
type DocumentPublicFileResponseEntity,
|
|
21
21
|
type DocumentReassignResponseEntity,
|
|
22
22
|
type DocumentReviewResponseEntity,
|
|
23
|
+
type DocumentSignManyResponseEntity,
|
|
23
24
|
type DocumentUpdateResponseEntity,
|
|
24
25
|
type DocumentVerifyResponseEntity,
|
|
25
26
|
} from '../entities';
|
|
@@ -34,6 +35,7 @@ export const DocumentPatterns = {
|
|
|
34
35
|
create: 'gestorDocumental.document.create',
|
|
35
36
|
update: 'gestorDocumental.document.update',
|
|
36
37
|
review: 'gestorDocumental.document.review',
|
|
38
|
+
signMany: 'gestorDocumental.document.signMany',
|
|
37
39
|
reassign: 'gestorDocumental.document.reassign',
|
|
38
40
|
discard: 'gestorDocumental.document.discard',
|
|
39
41
|
annul: 'gestorDocumental.document.annul',
|
|
@@ -184,6 +186,21 @@ export interface DocumentContract {
|
|
|
184
186
|
};
|
|
185
187
|
response: DocumentReviewResponseEntity;
|
|
186
188
|
};
|
|
189
|
+
/**
|
|
190
|
+
* Firma con un solo OTP varios documentos que el funcionario tiene en su turno de firma (los de un lote, o los que
|
|
191
|
+
* marcó en su bandeja). Cada uno queda firmado aparte; los que no caben en la solicitud quedan en `remaining`.
|
|
192
|
+
*/
|
|
193
|
+
[DocumentPatterns.signMany]: {
|
|
194
|
+
payload: {
|
|
195
|
+
ids: DocumentEntity['id'][];
|
|
196
|
+
observation?: string | null;
|
|
197
|
+
// Datos de quien firma, para el sello de la firma (los resuelve el gateway desde la sesión).
|
|
198
|
+
signer: { rut: string; fullName: string; role: string; areaName: string };
|
|
199
|
+
otp?: string;
|
|
200
|
+
actor: DocumentActor;
|
|
201
|
+
};
|
|
202
|
+
response: DocumentSignManyResponseEntity;
|
|
203
|
+
};
|
|
187
204
|
/**
|
|
188
205
|
* Pasa un turno pendiente (de visación o de firma) a otro funcionario, por ausencia o por error, y lo deja en la
|
|
189
206
|
* trazabilidad con su motivo. Puede hacerlo quien redactó el documento; con `anyDocument`, quien lleva el registro.
|
|
@@ -34,6 +34,8 @@ export interface DocumentTypeWritePayload {
|
|
|
34
34
|
// Próximo número que se asignará: permite partir desde el correlativo que la municipalidad ya lleva.
|
|
35
35
|
nextCorrelative?: number;
|
|
36
36
|
resetsYearly?: boolean;
|
|
37
|
+
// Sus documentos llevan número (por omisión, sí).
|
|
38
|
+
numbered?: boolean;
|
|
37
39
|
directorateCodeReference?: number | null;
|
|
38
40
|
enabled?: boolean;
|
|
39
41
|
// Flujo sugerido, en el orden en que les toca dentro de cada rol. Al editar, si no viene, el flujo no cambia.
|
package/src/contracts/index.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { DocumentTypePatterns, type DocumentTypeContract } from './documentType.
|
|
|
4
4
|
import { PartsOfficePatterns, type PartsOfficeContract } from './partsOffice.contract';
|
|
5
5
|
import { ProcedurePatterns, type ProcedureContract } from './procedure.contract';
|
|
6
6
|
import { RegisterBookPatterns, type RegisterBookContract } from './registerBook.contract';
|
|
7
|
+
import { SignatureBatchPatterns, type SignatureBatchContract } from './signatureBatch.contract';
|
|
7
8
|
|
|
8
9
|
export * from './contract';
|
|
9
10
|
export * from './document.contract';
|
|
@@ -12,6 +13,7 @@ export * from './procedure.contract';
|
|
|
12
13
|
export * from './caseFile.contract';
|
|
13
14
|
export * from './partsOffice.contract';
|
|
14
15
|
export * from './registerBook.contract';
|
|
16
|
+
export * from './signatureBatch.contract';
|
|
15
17
|
|
|
16
18
|
/** Patrones NATS de gestor-documental-ms, por recurso: `gestorDocumental.<recurso>.<acción>`. */
|
|
17
19
|
export const GestorDocumentalPatterns = {
|
|
@@ -21,6 +23,7 @@ export const GestorDocumentalPatterns = {
|
|
|
21
23
|
caseFile: CaseFilePatterns,
|
|
22
24
|
partsOffice: PartsOfficePatterns,
|
|
23
25
|
registerBook: RegisterBookPatterns,
|
|
26
|
+
signatureBatch: SignatureBatchPatterns,
|
|
24
27
|
} as const;
|
|
25
28
|
|
|
26
29
|
/** Contrato completo de gestor-documental-ms: la unión de los contratos de sus recursos. */
|
|
@@ -29,4 +32,5 @@ export type GestorDocumentalContract = DocumentTypeContract &
|
|
|
29
32
|
ProcedureContract &
|
|
30
33
|
CaseFileContract &
|
|
31
34
|
PartsOfficeContract &
|
|
32
|
-
RegisterBookContract
|
|
35
|
+
RegisterBookContract &
|
|
36
|
+
SignatureBatchContract;
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { type DocumentAccessLevel } from '../base/entities';
|
|
2
|
+
import {
|
|
3
|
+
type SignatureBatchCreateResponseEntity,
|
|
4
|
+
type SignatureBatchGetAllResponseEntity,
|
|
5
|
+
type SignatureBatchGetByIdResponseEntity,
|
|
6
|
+
type SignatureBatchRejectResponseEntity,
|
|
7
|
+
type SignatureBatchSignResponseEntity,
|
|
8
|
+
type SignatureBatchTab,
|
|
9
|
+
type SignatureBatchVisaResponseEntity,
|
|
10
|
+
} from '../entities';
|
|
11
|
+
import { type RpcPage } from './contract';
|
|
12
|
+
import { type DocumentActor } from './document.contract';
|
|
13
|
+
|
|
14
|
+
/** Patrones NATS de `signatureBatch` (lotes de firma): `<servicio>.<recurso>.<acción>`. */
|
|
15
|
+
export const SignatureBatchPatterns = {
|
|
16
|
+
getAll: 'gestorDocumental.signatureBatch.getAll',
|
|
17
|
+
getById: 'gestorDocumental.signatureBatch.getById',
|
|
18
|
+
create: 'gestorDocumental.signatureBatch.create',
|
|
19
|
+
visa: 'gestorDocumental.signatureBatch.visa',
|
|
20
|
+
sign: 'gestorDocumental.signatureBatch.sign',
|
|
21
|
+
reject: 'gestorDocumental.signatureBatch.reject',
|
|
22
|
+
} as const;
|
|
23
|
+
|
|
24
|
+
/** Datos de quien firma, para el sello de la firma (los resuelve el gateway desde la sesión). */
|
|
25
|
+
export interface SignatureBatchSigner {
|
|
26
|
+
rut: string;
|
|
27
|
+
fullName: string;
|
|
28
|
+
role: string;
|
|
29
|
+
areaName: string;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface SignatureBatchContract {
|
|
33
|
+
[SignatureBatchPatterns.getAll]: {
|
|
34
|
+
payload: {
|
|
35
|
+
pagination?: { page?: number; limit?: number };
|
|
36
|
+
filters?: { search?: string; tab?: SignatureBatchTab };
|
|
37
|
+
actor: DocumentActor;
|
|
38
|
+
};
|
|
39
|
+
response: RpcPage<SignatureBatchGetAllResponseEntity[]>;
|
|
40
|
+
};
|
|
41
|
+
/** Lo ven su redactor y quienes visan o firman sus documentos; con `viewAll`, quien lleva el registro. */
|
|
42
|
+
[SignatureBatchPatterns.getById]: {
|
|
43
|
+
payload: { id: string; actor: DocumentActor; viewAll?: boolean };
|
|
44
|
+
response: SignatureBatchGetByIdResponseEntity;
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* Crea el lote y lo envía a tramitación: un documento por cada PDF, todos del mismo tipo y con el mismo flujo.
|
|
48
|
+
* Cada documento recibe su código de verificación y, con su primera firma, su número (si el tipo lo lleva).
|
|
49
|
+
*/
|
|
50
|
+
[SignatureBatchPatterns.create]: {
|
|
51
|
+
payload: {
|
|
52
|
+
name: string;
|
|
53
|
+
documentTypeId: string;
|
|
54
|
+
keywords: string[];
|
|
55
|
+
accessLevel?: DocumentAccessLevel;
|
|
56
|
+
hasSensitiveData?: boolean;
|
|
57
|
+
directorateCodeReference?: number | null;
|
|
58
|
+
departmentId?: string | null;
|
|
59
|
+
visaEmployeeIds?: string[];
|
|
60
|
+
signatureEmployeeIds: string[];
|
|
61
|
+
signatureSheet?: boolean;
|
|
62
|
+
documents: { subject: string; file: { fileId: string; name: string } }[];
|
|
63
|
+
actor: DocumentActor;
|
|
64
|
+
};
|
|
65
|
+
response: SignatureBatchCreateResponseEntity;
|
|
66
|
+
};
|
|
67
|
+
/** Visa de una vez los documentos del lote que el funcionario tiene en su turno de visación. */
|
|
68
|
+
[SignatureBatchPatterns.visa]: {
|
|
69
|
+
payload: { id: string; observation?: string | null; actor: DocumentActor };
|
|
70
|
+
response: SignatureBatchVisaResponseEntity;
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* Firma con un solo OTP los documentos del lote que el funcionario tiene en su turno de firma. FirmaGob admite 5 MB
|
|
74
|
+
* por solicitud: los que no caben quedan en `remaining`, para firmarlos con un OTP nuevo.
|
|
75
|
+
*/
|
|
76
|
+
[SignatureBatchPatterns.sign]: {
|
|
77
|
+
payload: {
|
|
78
|
+
id: string;
|
|
79
|
+
observation?: string | null;
|
|
80
|
+
signer: SignatureBatchSigner;
|
|
81
|
+
otp?: string;
|
|
82
|
+
actor: DocumentActor;
|
|
83
|
+
};
|
|
84
|
+
response: SignatureBatchSignResponseEntity;
|
|
85
|
+
};
|
|
86
|
+
/**
|
|
87
|
+
* Devuelve a su redactor los documentos del lote que el funcionario tiene en su turno: todos, o los indicados en
|
|
88
|
+
* `documentIds`. Los demás siguen su curso.
|
|
89
|
+
*/
|
|
90
|
+
[SignatureBatchPatterns.reject]: {
|
|
91
|
+
payload: { id: string; observation: string; documentIds?: string[]; actor: DocumentActor };
|
|
92
|
+
response: SignatureBatchRejectResponseEntity;
|
|
93
|
+
};
|
|
94
|
+
}
|
|
@@ -176,6 +176,8 @@ export interface DocumentGetByIdResponseEntity {
|
|
|
176
176
|
deliveries: DocumentDeliveryResponseEntity[];
|
|
177
177
|
// Documento al que este responde, y los que le responden (solo los ya finalizados, más los propios de quien consulta).
|
|
178
178
|
replyTo: DocumentLinkEntity | null;
|
|
179
|
+
/** Lote de firma al que pertenece. */
|
|
180
|
+
batch: { id: string; name: string } | null;
|
|
179
181
|
replies: DocumentLinkEntity[];
|
|
180
182
|
/** Expedientes en que está incorporado y que quien consulta puede ver. */
|
|
181
183
|
caseFiles: { id: string; code: string; title: string; status: 'Open' | 'Closed' }[];
|
|
@@ -230,6 +232,8 @@ export interface DocumentGetByIdResponseEntity {
|
|
|
230
232
|
export interface DocumentGetSummaryResponseEntity {
|
|
231
233
|
toVisa: number;
|
|
232
234
|
toSign: number;
|
|
235
|
+
/** Lotes de firma con documentos en su turno (los documentos de un lote no se cuentan en `toVisa` ni `toSign`). */
|
|
236
|
+
batches: { toVisa: number; toSign: number };
|
|
233
237
|
created: {
|
|
234
238
|
drafted: number;
|
|
235
239
|
inProgress: number;
|
|
@@ -260,6 +264,29 @@ export interface DocumentReviewResponseEntity {
|
|
|
260
264
|
status: DocumentEntity['status'];
|
|
261
265
|
}
|
|
262
266
|
|
|
267
|
+
/** Resultado de un documento en una firma de varios documentos. */
|
|
268
|
+
export interface DocumentSignManyResultEntity {
|
|
269
|
+
id: DocumentEntity['id'];
|
|
270
|
+
ok: boolean;
|
|
271
|
+
/** Estado en que quedó, si se firmó. */
|
|
272
|
+
status?: DocumentEntity['status'];
|
|
273
|
+
/** Por qué no se firmó. */
|
|
274
|
+
message?: string;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
/**
|
|
278
|
+
* Firma de varios documentos con un solo OTP. FirmaGob admite 5 MB por solicitud: los que no cupieron quedan en
|
|
279
|
+
* `remaining`, en el turno del firmante, para firmarlos con un OTP nuevo.
|
|
280
|
+
*/
|
|
281
|
+
export interface DocumentSignManyResponseEntity {
|
|
282
|
+
results: DocumentSignManyResultEntity[];
|
|
283
|
+
signed: number;
|
|
284
|
+
failed: number;
|
|
285
|
+
remaining: DocumentEntity['id'][];
|
|
286
|
+
/** FirmaGob avisó que el OTP venció antes de firmar todos los documentos de la solicitud. */
|
|
287
|
+
otpExpired: boolean;
|
|
288
|
+
}
|
|
289
|
+
|
|
263
290
|
export interface DocumentDiscardResponseEntity {
|
|
264
291
|
id: DocumentEntity['id'];
|
|
265
292
|
ok: boolean;
|
|
@@ -22,6 +22,8 @@ export interface DocumentTypeGetAllResponseEntity {
|
|
|
22
22
|
nextCorrelative: DocumentTypeEntity['nextCorrelative'];
|
|
23
23
|
correlativeYear: DocumentTypeEntity['correlativeYear'];
|
|
24
24
|
resetsYearly: DocumentTypeEntity['resetsYearly'];
|
|
25
|
+
// Sin numeración, sus documentos solo llevan fecha, código de verificación y QR.
|
|
26
|
+
numbered: DocumentTypeEntity['numbered'];
|
|
25
27
|
directorateCodeReference: DocumentTypeEntity['directorateCodeReference'];
|
|
26
28
|
enabled: DocumentTypeEntity['enabled'];
|
|
27
29
|
// Cuántos visadores y firmantes tiene su flujo sugerido.
|
package/src/entities/index.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './signatureBatch.entity';
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import {
|
|
2
|
+
type DocumentAccessLevel,
|
|
3
|
+
type DocumentEntity,
|
|
4
|
+
type DocumentParticipantRole,
|
|
5
|
+
type DocumentStatus,
|
|
6
|
+
type SignatureBatchEntity,
|
|
7
|
+
} from '../../base/entities';
|
|
8
|
+
import { type DocumentSignManyResponseEntity, type DocumentSignManyResultEntity } from '../document';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Estado de un lote, deducido del de sus documentos: en tramitación mientras alguno lo esté; devuelto si no queda
|
|
12
|
+
* ninguno en tramitación y alguno volvió a su redactor; finalizado si todos terminaron (o se anularon después).
|
|
13
|
+
*/
|
|
14
|
+
export type SignatureBatchStatus = 'InProgress' | 'Returned' | 'Finished';
|
|
15
|
+
|
|
16
|
+
/** Lista de lotes: los que esperan al funcionario, los que redactó o todos en que participa. */
|
|
17
|
+
export type SignatureBatchTab = 'pending' | 'created' | 'participated';
|
|
18
|
+
|
|
19
|
+
/** Cuántos documentos del lote hay en cada situación. */
|
|
20
|
+
export interface SignatureBatchCountsEntity {
|
|
21
|
+
total: number;
|
|
22
|
+
inProgress: number;
|
|
23
|
+
finished: number;
|
|
24
|
+
/** Devueltos a su redactor (rechazados), para corregirlos y reenviarlos. */
|
|
25
|
+
returned: number;
|
|
26
|
+
annulled: number;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface SignatureBatchGetAllResponseEntity {
|
|
30
|
+
id: string;
|
|
31
|
+
name: string;
|
|
32
|
+
documentType: { id: string; name: string };
|
|
33
|
+
createdByEmployeeId: string;
|
|
34
|
+
createdByFullName: string;
|
|
35
|
+
createdAt: SignatureBatchEntity['createdAt'];
|
|
36
|
+
status: SignatureBatchStatus;
|
|
37
|
+
counts: SignatureBatchCountsEntity;
|
|
38
|
+
/** Documentos del lote que esperan al funcionario que consulta, por rol. */
|
|
39
|
+
myPending: { visa: number; signature: number };
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** Un documento del lote, con su turno vigente. */
|
|
43
|
+
export interface SignatureBatchDocumentEntity {
|
|
44
|
+
id: string;
|
|
45
|
+
subject: string;
|
|
46
|
+
status: DocumentStatus;
|
|
47
|
+
correlative: number | null;
|
|
48
|
+
correlativeYear: number | null;
|
|
49
|
+
numberedAt: DocumentEntity['numberedAt'];
|
|
50
|
+
verificationCode: string | null;
|
|
51
|
+
originalFileName: string;
|
|
52
|
+
currentTurn: { employeeId: string; fullName: string; role: DocumentParticipantRole } | null;
|
|
53
|
+
/** Si el turno vigente es del funcionario que consulta, qué le toca hacer. */
|
|
54
|
+
myTurn: DocumentParticipantRole | null;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export interface SignatureBatchGetByIdResponseEntity extends SignatureBatchGetAllResponseEntity {
|
|
58
|
+
documentType: { id: string; name: string; abbreviation: string | null; numbered: boolean };
|
|
59
|
+
keywords: string[];
|
|
60
|
+
accessLevel: DocumentAccessLevel;
|
|
61
|
+
hasSensitiveData: boolean;
|
|
62
|
+
/** Visadores y firmantes del lote, en orden (los del primer documento: todos parten con el mismo flujo). */
|
|
63
|
+
flow: { role: DocumentParticipantRole; employeeId: string; fullName: string; position: string | null }[];
|
|
64
|
+
documents: SignatureBatchDocumentEntity[];
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/** A quién le quedó el turno después de una operación sobre el lote: para avisarle una sola vez por lote. */
|
|
68
|
+
export interface SignatureBatchTurnEntity {
|
|
69
|
+
employeeId: string;
|
|
70
|
+
fullName: string;
|
|
71
|
+
role: DocumentParticipantRole;
|
|
72
|
+
count: number;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/** Lo que el gateway necesita para avisar: el lote, su redactor, a quién le toca ahora y cuántos terminaron. */
|
|
76
|
+
export interface SignatureBatchOutcomeEntity {
|
|
77
|
+
id: string;
|
|
78
|
+
name: string;
|
|
79
|
+
createdByEmployeeId: string;
|
|
80
|
+
nextTurns: SignatureBatchTurnEntity[];
|
|
81
|
+
/** Documentos que quedaron finalizados con esta operación. */
|
|
82
|
+
finished: number;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export interface SignatureBatchCreateResponseEntity extends SignatureBatchOutcomeEntity {
|
|
86
|
+
ok: boolean;
|
|
87
|
+
documentIds: string[];
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export interface SignatureBatchVisaResponseEntity extends SignatureBatchOutcomeEntity {
|
|
91
|
+
ok: boolean;
|
|
92
|
+
visaed: number;
|
|
93
|
+
/** Los que no se pudieron visar, con el motivo. */
|
|
94
|
+
failures: DocumentSignManyResultEntity[];
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export type SignatureBatchSignResponseEntity = SignatureBatchOutcomeEntity & DocumentSignManyResponseEntity;
|
|
98
|
+
|
|
99
|
+
export interface SignatureBatchRejectResponseEntity extends SignatureBatchOutcomeEntity {
|
|
100
|
+
ok: boolean;
|
|
101
|
+
/** Documentos devueltos a su redactor. */
|
|
102
|
+
rejected: number;
|
|
103
|
+
observation: string;
|
|
104
|
+
}
|