@muni-sanfer/types-gestor-documental 0.0.1-beta.1 → 0.0.1-beta.3

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.
@@ -33,7 +33,7 @@ export declare const DocumentParticipantStatus: {
33
33
  Resolved: "Resolved";
34
34
  Rejected: "Rejected";
35
35
  };
36
- export type DocumentTrackingAction = 'Created' | 'Updated' | 'Submitted' | 'Visaed' | 'Signed' | 'Rejected' | 'Finished' | 'Discarded' | 'Numbered' | 'NumberAnnulled' | 'Annulled';
36
+ export type DocumentTrackingAction = 'Created' | 'Updated' | 'Submitted' | 'Visaed' | 'Signed' | 'Rejected' | 'Finished' | 'Discarded' | 'Numbered' | 'NumberAnnulled' | 'Annulled' | 'Delivered' | 'Derived' | 'Reassigned';
37
37
  export declare const DocumentTrackingAction: {
38
38
  Created: "Created";
39
39
  Updated: "Updated";
@@ -46,12 +46,38 @@ export declare const DocumentTrackingAction: {
46
46
  Numbered: "Numbered";
47
47
  NumberAnnulled: "NumberAnnulled";
48
48
  Annulled: "Annulled";
49
+ Delivered: "Delivered";
50
+ Derived: "Derived";
51
+ Reassigned: "Reassigned";
52
+ };
53
+ export type DocumentFlowStepType = 'Employee' | 'DirectorateHead';
54
+ export declare const DocumentFlowStepType: {
55
+ Employee: "Employee";
56
+ DirectorateHead: "DirectorateHead";
49
57
  };
50
58
  export type DocumentAttachmentType = 'File' | 'Link';
51
59
  export declare const DocumentAttachmentType: {
52
60
  File: "File";
53
61
  Link: "Link";
54
62
  };
63
+ export type DocumentRecipientType = 'Employee' | 'Directorate' | 'Department';
64
+ export declare const DocumentRecipientType: {
65
+ Employee: "Employee";
66
+ Directorate: "Directorate";
67
+ Department: "Department";
68
+ };
69
+ export type DocumentDeliveryOrigin = 'Recipient' | 'Derivation';
70
+ export declare const DocumentDeliveryOrigin: {
71
+ Recipient: "Recipient";
72
+ Derivation: "Derivation";
73
+ };
74
+ export type DocumentInstruction = 'Knowledge' | 'Inform' | 'Respond' | 'Archive';
75
+ export declare const DocumentInstruction: {
76
+ Knowledge: "Knowledge";
77
+ Inform: "Inform";
78
+ Respond: "Respond";
79
+ Archive: "Archive";
80
+ };
55
81
  export interface DocumentTypeEntity {
56
82
  id: string;
57
83
  name: string;
@@ -65,6 +91,7 @@ export interface DocumentTypeEntity {
65
91
  enabled: boolean;
66
92
  documents?: DocumentEntity[];
67
93
  annulledNumbers?: DocumentAnnulledNumberEntity[];
94
+ flowSteps?: DocumentTypeFlowStepEntity[];
68
95
  deleted: boolean;
69
96
  createdAt: string;
70
97
  updatedAt: string;
@@ -83,6 +110,10 @@ export interface DocumentEntity {
83
110
  signatureSheet: boolean;
84
111
  annulledAt?: string | null;
85
112
  annulmentReason?: string | null;
113
+ responseDueAt?: string | null;
114
+ replyTo?: DocumentEntity | null;
115
+ replyToDocumentId?: string | null;
116
+ replies?: DocumentEntity[];
86
117
  directorateCodeReference?: number | null;
87
118
  departmentId?: string | null;
88
119
  createdByEmployeeId: string;
@@ -99,6 +130,8 @@ export interface DocumentEntity {
99
130
  attachments?: DocumentAttachmentEntity[];
100
131
  trackings?: DocumentTrackingEntity[];
101
132
  annulledNumbers?: DocumentAnnulledNumberEntity[];
133
+ recipients?: DocumentRecipientEntity[];
134
+ deliveries?: DocumentDeliveryEntity[];
102
135
  deleted: boolean;
103
136
  createdAt: string;
104
137
  updatedAt: string;
@@ -153,3 +186,48 @@ export interface DocumentAnnulledNumberEntity {
153
186
  documentId: string;
154
187
  createdAt: string;
155
188
  }
189
+ export interface DocumentRecipientEntity {
190
+ id: string;
191
+ type: DocumentRecipientType;
192
+ employeeId?: string | null;
193
+ directorateCodeReference?: number | null;
194
+ departmentId?: string | null;
195
+ name: string;
196
+ position?: string | null;
197
+ document?: DocumentEntity;
198
+ documentId: string;
199
+ createdAt: string;
200
+ }
201
+ export interface DocumentDeliveryEntity {
202
+ id: string;
203
+ origin: DocumentDeliveryOrigin;
204
+ employeeId: string;
205
+ fullName: string;
206
+ position?: string | null;
207
+ areaName?: string | null;
208
+ sentByEmployeeId?: string | null;
209
+ sentByFullName?: string | null;
210
+ instruction?: DocumentInstruction | null;
211
+ note?: string | null;
212
+ dueAt?: string | null;
213
+ deliveredAt?: string | null;
214
+ readAt?: string | null;
215
+ closedAt?: string | null;
216
+ closingNote?: string | null;
217
+ document?: DocumentEntity;
218
+ documentId: string;
219
+ createdAt: string;
220
+ }
221
+ export interface DocumentTypeFlowStepEntity {
222
+ id: string;
223
+ role: DocumentParticipantRole;
224
+ order: number;
225
+ type: DocumentFlowStepType;
226
+ employeeId?: string | null;
227
+ directorateCodeReference?: number | null;
228
+ name: string;
229
+ position?: string | null;
230
+ documentType?: DocumentTypeEntity;
231
+ documentTypeId: string;
232
+ createdAt: string;
233
+ }
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  // This file was auto-generated by prisma-generator-typescript-interfaces
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.DocumentAttachmentType = exports.DocumentTrackingAction = exports.DocumentParticipantStatus = exports.DocumentParticipantRole = exports.DocumentAccessLevel = exports.DocumentStatus = exports.DocumentCategory = void 0;
4
+ exports.DocumentInstruction = exports.DocumentDeliveryOrigin = exports.DocumentRecipientType = exports.DocumentAttachmentType = exports.DocumentFlowStepType = exports.DocumentTrackingAction = exports.DocumentParticipantStatus = exports.DocumentParticipantRole = exports.DocumentAccessLevel = exports.DocumentStatus = exports.DocumentCategory = void 0;
5
5
  exports.DocumentCategory = {
6
6
  Decree: 'Decree',
7
7
  Communication: 'Communication',
@@ -44,8 +44,30 @@ exports.DocumentTrackingAction = {
44
44
  Numbered: 'Numbered',
45
45
  NumberAnnulled: 'NumberAnnulled',
46
46
  Annulled: 'Annulled',
47
+ Delivered: 'Delivered',
48
+ Derived: 'Derived',
49
+ Reassigned: 'Reassigned',
50
+ };
51
+ exports.DocumentFlowStepType = {
52
+ Employee: 'Employee',
53
+ DirectorateHead: 'DirectorateHead',
47
54
  };
48
55
  exports.DocumentAttachmentType = {
49
56
  File: 'File',
50
57
  Link: 'Link',
51
58
  };
59
+ exports.DocumentRecipientType = {
60
+ Employee: 'Employee',
61
+ Directorate: 'Directorate',
62
+ Department: 'Department',
63
+ };
64
+ exports.DocumentDeliveryOrigin = {
65
+ Recipient: 'Recipient',
66
+ Derivation: 'Derivation',
67
+ };
68
+ exports.DocumentInstruction = {
69
+ Knowledge: 'Knowledge',
70
+ Inform: 'Inform',
71
+ Respond: 'Respond',
72
+ Archive: 'Archive',
73
+ };
@@ -1,16 +1,20 @@
1
- import { type DocumentAccessLevel, type DocumentAttachmentEntity, type DocumentEntity, type DocumentStatus } from '../base/entities';
2
- import { type DocumentAnnulResponseEntity, type DocumentCreateResponseEntity, type DocumentDiscardResponseEntity, type DocumentGetAllResponseEntity, type DocumentGetByIdResponseEntity, type DocumentGetSummaryResponseEntity, type DocumentPublicFileResponseEntity, type DocumentReviewResponseEntity, type DocumentUpdateResponseEntity, type DocumentVerifyResponseEntity } from '../entities';
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';
3
3
  import { type RpcPage } from './contract';
4
4
  /** Patrones NATS de `document`: `<servicio>.<recurso>.<acción>`. */
5
5
  export declare const DocumentPatterns: {
6
6
  readonly getAll: "gestorDocumental.document.getAll";
7
+ readonly getInbox: "gestorDocumental.document.getInbox";
7
8
  readonly getSummary: "gestorDocumental.document.getSummary";
8
9
  readonly getById: "gestorDocumental.document.getById";
9
10
  readonly create: "gestorDocumental.document.create";
10
11
  readonly update: "gestorDocumental.document.update";
11
12
  readonly review: "gestorDocumental.document.review";
13
+ readonly reassign: "gestorDocumental.document.reassign";
12
14
  readonly discard: "gestorDocumental.document.discard";
13
15
  readonly annul: "gestorDocumental.document.annul";
16
+ readonly derive: "gestorDocumental.document.derive";
17
+ readonly closeDelivery: "gestorDocumental.document.closeDelivery";
14
18
  readonly verify: "gestorDocumental.document.verify";
15
19
  readonly getPublicFile: "gestorDocumental.document.getPublicFile";
16
20
  readonly getFilesFolder: "gestorDocumental.document.getFilesFolder";
@@ -25,7 +29,27 @@ export interface DocumentActor {
25
29
  departmentIds: string[];
26
30
  }
27
31
  /** Bandeja desde la que se lista. Todas son del funcionario (`actor`), salvo `all`. */
28
- export type DocumentBucket = 'created' | 'toVisa' | 'toSign' | 'participated' | 'all';
32
+ export type DocumentBucket = 'created' | 'sent' | 'toVisa' | 'toSign' | 'participated' | 'all';
33
+ /**
34
+ * Destinatario de un documento o de una derivación: una persona o un área completa. El gateway resuelve el nombre del
35
+ * área y quiénes la integran hoy; el navegador solo indica cuál es.
36
+ */
37
+ export type DocumentRecipientInput = {
38
+ type: 'Employee';
39
+ employeeId: string;
40
+ } | {
41
+ type: 'Directorate';
42
+ directorateCodeReference: number;
43
+ name: string;
44
+ memberEmployeeIds: string[];
45
+ } | {
46
+ type: 'Department';
47
+ departmentId: string;
48
+ name: string;
49
+ memberEmployeeIds: string[];
50
+ };
51
+ /** Qué parte de la bandeja de recibidos se lista: lo que falta atender, lo ya atendido, o todo. */
52
+ export type DocumentInboxState = 'pending' | 'closed' | 'all';
29
53
  /** Qué hace con el documento quien tiene el turno. */
30
54
  export type DocumentReviewAction = 'Visa' | 'Sign' | 'Reject';
31
55
  /**
@@ -46,6 +70,9 @@ export interface DocumentWritePayload extends Pick<DocumentEntity, 'subject' | '
46
70
  visaEmployeeIds: string[];
47
71
  signatureEmployeeIds: string[];
48
72
  signatureSheet?: boolean;
73
+ recipients?: DocumentRecipientInput[];
74
+ responseDueAt?: string | null;
75
+ replyToDocumentId?: string | null;
49
76
  action?: 'Submit';
50
77
  actor: DocumentActor;
51
78
  }
@@ -71,6 +98,21 @@ export interface DocumentContract {
71
98
  };
72
99
  response: RpcPage<DocumentGetAllResponseEntity[]>;
73
100
  };
101
+ /** Bandeja de recibidos de un funcionario: lo que le llegó como destinatario o por derivación. */
102
+ [DocumentPatterns.getInbox]: {
103
+ payload: {
104
+ pagination?: {
105
+ page?: number;
106
+ limit?: number;
107
+ };
108
+ filters?: {
109
+ search?: string;
110
+ state?: DocumentInboxState;
111
+ };
112
+ actor: DocumentActor;
113
+ };
114
+ response: RpcPage<DocumentInboxItemEntity[]>;
115
+ };
74
116
  [DocumentPatterns.getSummary]: {
75
117
  payload: {
76
118
  actor: DocumentActor;
@@ -107,6 +149,20 @@ export interface DocumentContract {
107
149
  };
108
150
  response: DocumentReviewResponseEntity;
109
151
  };
152
+ /**
153
+ * Pasa un turno pendiente (de visación o de firma) a otro funcionario, por ausencia o por error, y lo deja en la
154
+ * trazabilidad con su motivo. Puede hacerlo quien redactó el documento; con `anyDocument`, quien lleva el registro.
155
+ */
156
+ [DocumentPatterns.reassign]: {
157
+ payload: Pick<DocumentEntity, 'id'> & {
158
+ participantId: DocumentParticipantEntity['id'];
159
+ employeeId: string;
160
+ reason: string;
161
+ actor: DocumentActor;
162
+ anyDocument?: boolean;
163
+ };
164
+ response: DocumentReassignResponseEntity;
165
+ };
110
166
  [DocumentPatterns.discard]: {
111
167
  payload: Pick<DocumentEntity, 'id'> & {
112
168
  actor: DocumentActor;
@@ -121,6 +177,31 @@ export interface DocumentContract {
121
177
  };
122
178
  response: DocumentAnnulResponseEntity;
123
179
  };
180
+ /**
181
+ * Deriva un documento finalizado a otros funcionarios o áreas, con su providencia (qué se espera de ellos) y,
182
+ * si corresponde, un plazo. Puede hacerlo quien lo tiene a su alcance: su redactor, quien lo visó o firmó, quien lo
183
+ * recibió y, con `viewAll`, quien consulta el historial.
184
+ */
185
+ [DocumentPatterns.derive]: {
186
+ payload: Pick<DocumentEntity, 'id'> & {
187
+ recipients: DocumentRecipientInput[];
188
+ instruction: DocumentInstruction;
189
+ note?: string | null;
190
+ dueAt?: string | null;
191
+ actor: DocumentActor;
192
+ viewAll?: boolean;
193
+ };
194
+ response: DocumentDeriveResponseEntity;
195
+ };
196
+ /** Quien recibió un documento lo marca como atendido, con una nota opcional. */
197
+ [DocumentPatterns.closeDelivery]: {
198
+ payload: {
199
+ deliveryId: DocumentDeliveryEntity['id'];
200
+ note?: string | null;
201
+ actor: DocumentActor;
202
+ };
203
+ response: DocumentCloseDeliveryResponseEntity;
204
+ };
124
205
  /** Comprobación pública de un documento con el código que lleva impreso. No exige sesión. */
125
206
  [DocumentPatterns.verify]: {
126
207
  payload: {
@@ -4,13 +4,17 @@ exports.DocumentPatterns = void 0;
4
4
  /** Patrones NATS de `document`: `<servicio>.<recurso>.<acción>`. */
5
5
  exports.DocumentPatterns = {
6
6
  getAll: 'gestorDocumental.document.getAll',
7
+ getInbox: 'gestorDocumental.document.getInbox',
7
8
  getSummary: 'gestorDocumental.document.getSummary',
8
9
  getById: 'gestorDocumental.document.getById',
9
10
  create: 'gestorDocumental.document.create',
10
11
  update: 'gestorDocumental.document.update',
11
12
  review: 'gestorDocumental.document.review',
13
+ reassign: 'gestorDocumental.document.reassign',
12
14
  discard: 'gestorDocumental.document.discard',
13
15
  annul: 'gestorDocumental.document.annul',
16
+ derive: 'gestorDocumental.document.derive',
17
+ closeDelivery: 'gestorDocumental.document.closeDelivery',
14
18
  verify: 'gestorDocumental.document.verify',
15
19
  getPublicFile: 'gestorDocumental.document.getPublicFile',
16
20
  getFilesFolder: 'gestorDocumental.document.getFilesFolder',
@@ -1,4 +1,4 @@
1
- import { type DocumentCategory, type DocumentTypeEntity } from '../base/entities';
1
+ import { type DocumentCategory, type DocumentParticipantRole, type DocumentTypeEntity } from '../base/entities';
2
2
  import { type DocumentTypeCreateResponseEntity, type DocumentTypeGetAllResponseEntity, type DocumentTypeGetByIdResponseEntity, type DocumentTypeUpdateResponseEntity } from '../entities';
3
3
  import { type RpcPage } from './contract';
4
4
  /** Patrones NATS de `documentType`: `<servicio>.<recurso>.<acción>`. */
@@ -9,6 +9,21 @@ export declare const DocumentTypePatterns: {
9
9
  readonly update: "gestorDocumental.documentType.update";
10
10
  readonly setEnabled: "gestorDocumental.documentType.setEnabled";
11
11
  };
12
+ /**
13
+ * Paso del flujo sugerido de un tipo documental: un funcionario en particular, o quien dirija una dirección al
14
+ * momento de redactar (su jefatura o, con subrogancia activa, el subrogante). El nombre de la dirección lo resuelve
15
+ * el gateway; el navegador solo indica cuál es.
16
+ */
17
+ export type DocumentFlowStepInput = {
18
+ role: DocumentParticipantRole;
19
+ type: 'Employee';
20
+ employeeId: string;
21
+ } | {
22
+ role: DocumentParticipantRole;
23
+ type: 'DirectorateHead';
24
+ directorateCodeReference: number;
25
+ name: string;
26
+ };
12
27
  /** Datos de un tipo documental al crearlo o editarlo. */
13
28
  export interface DocumentTypeWritePayload {
14
29
  name: string;
@@ -19,6 +34,7 @@ export interface DocumentTypeWritePayload {
19
34
  resetsYearly?: boolean;
20
35
  directorateCodeReference?: number | null;
21
36
  enabled?: boolean;
37
+ flowSteps?: DocumentFlowStepInput[];
22
38
  }
23
39
  /**
24
40
  * Qué se envía y qué se responde en cada patrón. Generado desde los handlers y los DTO del microservicio.
@@ -14,13 +14,17 @@ export declare const GestorDocumentalPatterns: {
14
14
  };
15
15
  readonly document: {
16
16
  readonly getAll: "gestorDocumental.document.getAll";
17
+ readonly getInbox: "gestorDocumental.document.getInbox";
17
18
  readonly getSummary: "gestorDocumental.document.getSummary";
18
19
  readonly getById: "gestorDocumental.document.getById";
19
20
  readonly create: "gestorDocumental.document.create";
20
21
  readonly update: "gestorDocumental.document.update";
21
22
  readonly review: "gestorDocumental.document.review";
23
+ readonly reassign: "gestorDocumental.document.reassign";
22
24
  readonly discard: "gestorDocumental.document.discard";
23
25
  readonly annul: "gestorDocumental.document.annul";
26
+ readonly derive: "gestorDocumental.document.derive";
27
+ readonly closeDelivery: "gestorDocumental.document.closeDelivery";
24
28
  readonly verify: "gestorDocumental.document.verify";
25
29
  readonly getPublicFile: "gestorDocumental.document.getPublicFile";
26
30
  readonly getFilesFolder: "gestorDocumental.document.getFilesFolder";
@@ -1,4 +1,4 @@
1
- import { DocumentAnnulledNumberEntity, DocumentAttachmentEntity, DocumentEntity, DocumentParticipantEntity, DocumentTrackingEntity, DocumentTypeEntity } from '../../base/entities';
1
+ import { DocumentAnnulledNumberEntity, DocumentAttachmentEntity, DocumentDeliveryEntity, DocumentEntity, DocumentParticipantEntity, DocumentRecipientEntity, DocumentTrackingEntity, DocumentTypeEntity } from '../../base/entities';
2
2
  /** Tipo documental de un documento, con lo necesario para citarlo. */
3
3
  export interface DocumentTypeSummaryEntity {
4
4
  id: DocumentTypeEntity['id'];
@@ -17,6 +17,45 @@ export interface DocumentParticipantResponseEntity {
17
17
  observation: DocumentParticipantEntity['observation'];
18
18
  resolvedAt: DocumentParticipantEntity['resolvedAt'];
19
19
  }
20
+ /** Destinatario de un documento, como lo eligió el redactor: una persona o un área completa. */
21
+ export interface DocumentRecipientResponseEntity {
22
+ id: DocumentRecipientEntity['id'];
23
+ type: DocumentRecipientEntity['type'];
24
+ employeeId: DocumentRecipientEntity['employeeId'];
25
+ directorateCodeReference: DocumentRecipientEntity['directorateCodeReference'];
26
+ departmentId: DocumentRecipientEntity['departmentId'];
27
+ name: DocumentRecipientEntity['name'];
28
+ position: DocumentRecipientEntity['position'];
29
+ }
30
+ /** Un documento en la bandeja de un funcionario: como destinatario o porque se lo derivaron. */
31
+ export interface DocumentDeliveryResponseEntity {
32
+ id: DocumentDeliveryEntity['id'];
33
+ origin: DocumentDeliveryEntity['origin'];
34
+ employeeId: DocumentDeliveryEntity['employeeId'];
35
+ fullName: DocumentDeliveryEntity['fullName'];
36
+ position: DocumentDeliveryEntity['position'];
37
+ areaName: DocumentDeliveryEntity['areaName'];
38
+ sentByEmployeeId: DocumentDeliveryEntity['sentByEmployeeId'];
39
+ sentByFullName: DocumentDeliveryEntity['sentByFullName'];
40
+ instruction: DocumentDeliveryEntity['instruction'];
41
+ note: DocumentDeliveryEntity['note'];
42
+ dueAt: DocumentDeliveryEntity['dueAt'];
43
+ deliveredAt: DocumentDeliveryEntity['deliveredAt'];
44
+ readAt: DocumentDeliveryEntity['readAt'];
45
+ closedAt: DocumentDeliveryEntity['closedAt'];
46
+ closingNote: DocumentDeliveryEntity['closingNote'];
47
+ }
48
+ /** Lo necesario para citar otro documento y enlazarlo (el que se responde, o las respuestas). */
49
+ export interface DocumentLinkEntity {
50
+ id: DocumentEntity['id'];
51
+ subject: DocumentEntity['subject'];
52
+ status: DocumentEntity['status'];
53
+ correlative: DocumentEntity['correlative'];
54
+ correlativeYear: DocumentEntity['correlativeYear'];
55
+ createdByFullName: DocumentEntity['createdByFullName'];
56
+ finishedAt: DocumentEntity['finishedAt'];
57
+ documentType: DocumentTypeSummaryEntity;
58
+ }
20
59
  export interface DocumentGetAllResponseEntity {
21
60
  id: DocumentEntity['id'];
22
61
  subject: DocumentEntity['subject'];
@@ -31,6 +70,14 @@ export interface DocumentGetAllResponseEntity {
31
70
  createdByFullName: DocumentEntity['createdByFullName'];
32
71
  documentType: DocumentTypeSummaryEntity;
33
72
  currentParticipant: Pick<DocumentParticipantResponseEntity, 'role' | 'employeeId' | 'fullName'> | null;
73
+ distribution: {
74
+ total: number;
75
+ read: number;
76
+ } | null;
77
+ }
78
+ /** Una entrada de la bandeja de recibidos: la entrega y el documento al que corresponde. */
79
+ export interface DocumentInboxItemEntity extends DocumentDeliveryResponseEntity {
80
+ document: DocumentLinkEntity;
34
81
  }
35
82
  export interface DocumentGetByIdResponseEntity {
36
83
  id: DocumentEntity['id'];
@@ -64,6 +111,11 @@ export interface DocumentGetByIdResponseEntity {
64
111
  employeeFullName: DocumentAnnulledNumberEntity['employeeFullName'];
65
112
  createdAt: DocumentAnnulledNumberEntity['createdAt'];
66
113
  }[];
114
+ responseDueAt: DocumentEntity['responseDueAt'];
115
+ recipients: DocumentRecipientResponseEntity[];
116
+ deliveries: DocumentDeliveryResponseEntity[];
117
+ replyTo: DocumentLinkEntity | null;
118
+ replies: DocumentLinkEntity[];
67
119
  documentType: DocumentTypeSummaryEntity;
68
120
  participants: DocumentParticipantResponseEntity[];
69
121
  attachments: {
@@ -85,6 +137,10 @@ export interface DocumentGetByIdResponseEntity {
85
137
  turn: Pick<DocumentParticipantResponseEntity, 'id' | 'role'> | null;
86
138
  canEdit: boolean;
87
139
  canDiscard: boolean;
140
+ canDerive: boolean;
141
+ canReply: boolean;
142
+ canReassign: boolean;
143
+ inbox: DocumentDeliveryResponseEntity[];
88
144
  };
89
145
  signatureRequiresOtp: boolean;
90
146
  }
@@ -98,6 +154,11 @@ export interface DocumentGetSummaryResponseEntity {
98
154
  rejected: number;
99
155
  finished: number;
100
156
  };
157
+ received: {
158
+ unread: number;
159
+ pending: number;
160
+ overdue: number;
161
+ };
101
162
  }
102
163
  export interface DocumentCreateResponseEntity {
103
164
  id: DocumentEntity['id'];
@@ -153,3 +214,16 @@ export interface DocumentPublicFileResponseEntity {
153
214
  fileId: string;
154
215
  fileName: string;
155
216
  }
217
+ export interface DocumentDeriveResponseEntity {
218
+ id: DocumentEntity['id'];
219
+ ok: boolean;
220
+ delivered: number;
221
+ }
222
+ export interface DocumentCloseDeliveryResponseEntity {
223
+ id: DocumentDeliveryEntity['id'];
224
+ ok: boolean;
225
+ }
226
+ export interface DocumentReassignResponseEntity {
227
+ id: DocumentEntity['id'];
228
+ ok: boolean;
229
+ }
@@ -1,4 +1,15 @@
1
- import { DocumentTypeEntity } from '../../base/entities';
1
+ import { DocumentTypeEntity, DocumentTypeFlowStepEntity } from '../../base/entities';
2
+ /** Paso del flujo sugerido de un tipo documental: quién visa o firma, en su orden. */
3
+ export interface DocumentTypeFlowStepResponseEntity {
4
+ id: DocumentTypeFlowStepEntity['id'];
5
+ role: DocumentTypeFlowStepEntity['role'];
6
+ order: DocumentTypeFlowStepEntity['order'];
7
+ type: DocumentTypeFlowStepEntity['type'];
8
+ employeeId: DocumentTypeFlowStepEntity['employeeId'];
9
+ directorateCodeReference: DocumentTypeFlowStepEntity['directorateCodeReference'];
10
+ name: DocumentTypeFlowStepEntity['name'];
11
+ position: DocumentTypeFlowStepEntity['position'];
12
+ }
2
13
  export interface DocumentTypeGetAllResponseEntity {
3
14
  id: DocumentTypeEntity['id'];
4
15
  name: DocumentTypeEntity['name'];
@@ -10,9 +21,14 @@ export interface DocumentTypeGetAllResponseEntity {
10
21
  resetsYearly: DocumentTypeEntity['resetsYearly'];
11
22
  directorateCodeReference: DocumentTypeEntity['directorateCodeReference'];
12
23
  enabled: DocumentTypeEntity['enabled'];
24
+ flow: {
25
+ visa: number;
26
+ signature: number;
27
+ };
13
28
  }
14
29
  export interface DocumentTypeGetByIdResponseEntity extends DocumentTypeGetAllResponseEntity {
15
30
  lastCorrelative: number | null;
31
+ flowSteps: DocumentTypeFlowStepResponseEntity[];
16
32
  }
17
33
  export interface DocumentTypeCreateResponseEntity {
18
34
  id: DocumentTypeEntity['id'];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@muni-sanfer/types-gestor-documental",
3
- "version": "0.0.1-beta.1",
3
+ "version": "0.0.1-beta.3",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "scripts": {
@@ -57,7 +57,10 @@ export type DocumentTrackingAction =
57
57
  | 'Discarded'
58
58
  | 'Numbered'
59
59
  | 'NumberAnnulled'
60
- | 'Annulled';
60
+ | 'Annulled'
61
+ | 'Delivered'
62
+ | 'Derived'
63
+ | 'Reassigned';
61
64
 
62
65
  export const DocumentTrackingAction = {
63
66
  Created: 'Created',
@@ -71,8 +74,18 @@ export const DocumentTrackingAction = {
71
74
  Numbered: 'Numbered',
72
75
  NumberAnnulled: 'NumberAnnulled',
73
76
  Annulled: 'Annulled',
77
+ Delivered: 'Delivered',
78
+ Derived: 'Derived',
79
+ Reassigned: 'Reassigned',
74
80
  } satisfies Record<string, DocumentTrackingAction>;
75
81
 
82
+ export type DocumentFlowStepType = 'Employee' | 'DirectorateHead';
83
+
84
+ export const DocumentFlowStepType = {
85
+ Employee: 'Employee',
86
+ DirectorateHead: 'DirectorateHead',
87
+ } satisfies Record<string, DocumentFlowStepType>;
88
+
76
89
  export type DocumentAttachmentType = 'File' | 'Link';
77
90
 
78
91
  export const DocumentAttachmentType = {
@@ -80,6 +93,30 @@ export const DocumentAttachmentType = {
80
93
  Link: 'Link',
81
94
  } satisfies Record<string, DocumentAttachmentType>;
82
95
 
96
+ export type DocumentRecipientType = 'Employee' | 'Directorate' | 'Department';
97
+
98
+ export const DocumentRecipientType = {
99
+ Employee: 'Employee',
100
+ Directorate: 'Directorate',
101
+ Department: 'Department',
102
+ } satisfies Record<string, DocumentRecipientType>;
103
+
104
+ export type DocumentDeliveryOrigin = 'Recipient' | 'Derivation';
105
+
106
+ export const DocumentDeliveryOrigin = {
107
+ Recipient: 'Recipient',
108
+ Derivation: 'Derivation',
109
+ } satisfies Record<string, DocumentDeliveryOrigin>;
110
+
111
+ export type DocumentInstruction = 'Knowledge' | 'Inform' | 'Respond' | 'Archive';
112
+
113
+ export const DocumentInstruction = {
114
+ Knowledge: 'Knowledge',
115
+ Inform: 'Inform',
116
+ Respond: 'Respond',
117
+ Archive: 'Archive',
118
+ } satisfies Record<string, DocumentInstruction>;
119
+
83
120
  export interface DocumentTypeEntity {
84
121
  id: string;
85
122
  name: string;
@@ -93,6 +130,7 @@ export interface DocumentTypeEntity {
93
130
  enabled: boolean;
94
131
  documents?: DocumentEntity[];
95
132
  annulledNumbers?: DocumentAnnulledNumberEntity[];
133
+ flowSteps?: DocumentTypeFlowStepEntity[];
96
134
  deleted: boolean;
97
135
  createdAt: string;
98
136
  updatedAt: string;
@@ -112,6 +150,10 @@ export interface DocumentEntity {
112
150
  signatureSheet: boolean;
113
151
  annulledAt?: string | null;
114
152
  annulmentReason?: string | null;
153
+ responseDueAt?: string | null;
154
+ replyTo?: DocumentEntity | null;
155
+ replyToDocumentId?: string | null;
156
+ replies?: DocumentEntity[];
115
157
  directorateCodeReference?: number | null;
116
158
  departmentId?: string | null;
117
159
  createdByEmployeeId: string;
@@ -128,6 +170,8 @@ export interface DocumentEntity {
128
170
  attachments?: DocumentAttachmentEntity[];
129
171
  trackings?: DocumentTrackingEntity[];
130
172
  annulledNumbers?: DocumentAnnulledNumberEntity[];
173
+ recipients?: DocumentRecipientEntity[];
174
+ deliveries?: DocumentDeliveryEntity[];
131
175
  deleted: boolean;
132
176
  createdAt: string;
133
177
  updatedAt: string;
@@ -186,3 +230,51 @@ export interface DocumentAnnulledNumberEntity {
186
230
  documentId: string;
187
231
  createdAt: string;
188
232
  }
233
+
234
+ export interface DocumentRecipientEntity {
235
+ id: string;
236
+ type: DocumentRecipientType;
237
+ employeeId?: string | null;
238
+ directorateCodeReference?: number | null;
239
+ departmentId?: string | null;
240
+ name: string;
241
+ position?: string | null;
242
+ document?: DocumentEntity;
243
+ documentId: string;
244
+ createdAt: string;
245
+ }
246
+
247
+ export interface DocumentDeliveryEntity {
248
+ id: string;
249
+ origin: DocumentDeliveryOrigin;
250
+ employeeId: string;
251
+ fullName: string;
252
+ position?: string | null;
253
+ areaName?: string | null;
254
+ sentByEmployeeId?: string | null;
255
+ sentByFullName?: string | null;
256
+ instruction?: DocumentInstruction | null;
257
+ note?: string | null;
258
+ dueAt?: string | null;
259
+ deliveredAt?: string | null;
260
+ readAt?: string | null;
261
+ closedAt?: string | null;
262
+ closingNote?: string | null;
263
+ document?: DocumentEntity;
264
+ documentId: string;
265
+ createdAt: string;
266
+ }
267
+
268
+ export interface DocumentTypeFlowStepEntity {
269
+ id: string;
270
+ role: DocumentParticipantRole;
271
+ order: number;
272
+ type: DocumentFlowStepType;
273
+ employeeId?: string | null;
274
+ directorateCodeReference?: number | null;
275
+ name: string;
276
+ position?: string | null;
277
+ documentType?: DocumentTypeEntity;
278
+ documentTypeId: string;
279
+ createdAt: string;
280
+ }
@@ -1,17 +1,24 @@
1
1
  import {
2
2
  type DocumentAccessLevel,
3
3
  type DocumentAttachmentEntity,
4
+ type DocumentDeliveryEntity,
4
5
  type DocumentEntity,
6
+ type DocumentInstruction,
7
+ type DocumentParticipantEntity,
5
8
  type DocumentStatus,
6
9
  } from '../base/entities';
7
10
  import {
8
11
  type DocumentAnnulResponseEntity,
12
+ type DocumentCloseDeliveryResponseEntity,
9
13
  type DocumentCreateResponseEntity,
14
+ type DocumentDeriveResponseEntity,
10
15
  type DocumentDiscardResponseEntity,
11
16
  type DocumentGetAllResponseEntity,
12
17
  type DocumentGetByIdResponseEntity,
13
18
  type DocumentGetSummaryResponseEntity,
19
+ type DocumentInboxItemEntity,
14
20
  type DocumentPublicFileResponseEntity,
21
+ type DocumentReassignResponseEntity,
15
22
  type DocumentReviewResponseEntity,
16
23
  type DocumentUpdateResponseEntity,
17
24
  type DocumentVerifyResponseEntity,
@@ -21,13 +28,17 @@ import { type RpcPage } from './contract';
21
28
  /** Patrones NATS de `document`: `<servicio>.<recurso>.<acción>`. */
22
29
  export const DocumentPatterns = {
23
30
  getAll: 'gestorDocumental.document.getAll',
31
+ getInbox: 'gestorDocumental.document.getInbox',
24
32
  getSummary: 'gestorDocumental.document.getSummary',
25
33
  getById: 'gestorDocumental.document.getById',
26
34
  create: 'gestorDocumental.document.create',
27
35
  update: 'gestorDocumental.document.update',
28
36
  review: 'gestorDocumental.document.review',
37
+ reassign: 'gestorDocumental.document.reassign',
29
38
  discard: 'gestorDocumental.document.discard',
30
39
  annul: 'gestorDocumental.document.annul',
40
+ derive: 'gestorDocumental.document.derive',
41
+ closeDelivery: 'gestorDocumental.document.closeDelivery',
31
42
  verify: 'gestorDocumental.document.verify',
32
43
  getPublicFile: 'gestorDocumental.document.getPublicFile',
33
44
  getFilesFolder: 'gestorDocumental.document.getFilesFolder',
@@ -46,11 +57,24 @@ export interface DocumentActor {
46
57
  /** Bandeja desde la que se lista. Todas son del funcionario (`actor`), salvo `all`. */
47
58
  export type DocumentBucket =
48
59
  | 'created' // los que redactó
60
+ | 'sent' // de los que redactó, los ya finalizados que tienen destinatarios
49
61
  | 'toVisa' // le toca visarlos
50
62
  | 'toSign' // le toca firmarlos
51
63
  | 'participated' // ya los visó, firmó o rechazó
52
64
  | 'all'; // todos los que están en tramitación o finalizados (historial)
53
65
 
66
+ /**
67
+ * Destinatario de un documento o de una derivación: una persona o un área completa. El gateway resuelve el nombre del
68
+ * área y quiénes la integran hoy; el navegador solo indica cuál es.
69
+ */
70
+ export type DocumentRecipientInput =
71
+ | { type: 'Employee'; employeeId: string }
72
+ | { type: 'Directorate'; directorateCodeReference: number; name: string; memberEmployeeIds: string[] }
73
+ | { type: 'Department'; departmentId: string; name: string; memberEmployeeIds: string[] };
74
+
75
+ /** Qué parte de la bandeja de recibidos se lista: lo que falta atender, lo ya atendido, o todo. */
76
+ export type DocumentInboxState = 'pending' | 'closed' | 'all';
77
+
54
78
  /** Qué hace con el documento quien tiene el turno. */
55
79
  export type DocumentReviewAction = 'Visa' | 'Sign' | 'Reject';
56
80
 
@@ -72,6 +96,12 @@ export interface DocumentWritePayload extends Pick<DocumentEntity, 'subject' | '
72
96
  signatureEmployeeIds: string[];
73
97
  // Firmas y visaciones en una hoja aparte al final, en vez de al pie de la última página.
74
98
  signatureSheet?: boolean;
99
+ // A quién va dirigido: le llega a su bandeja cuando el documento termina su tramitación.
100
+ recipients?: DocumentRecipientInput[];
101
+ // Plazo en que se espera respuesta de los destinatarios (ISO 8601).
102
+ responseDueAt?: string | null;
103
+ // Documento al que este responde.
104
+ replyToDocumentId?: string | null;
75
105
  action?: 'Submit';
76
106
  actor: DocumentActor;
77
107
  }
@@ -97,6 +127,15 @@ export interface DocumentContract {
97
127
  };
98
128
  response: RpcPage<DocumentGetAllResponseEntity[]>;
99
129
  };
130
+ /** Bandeja de recibidos de un funcionario: lo que le llegó como destinatario o por derivación. */
131
+ [DocumentPatterns.getInbox]: {
132
+ payload: {
133
+ pagination?: { page?: number; limit?: number };
134
+ filters?: { search?: string; state?: DocumentInboxState };
135
+ actor: DocumentActor;
136
+ };
137
+ response: RpcPage<DocumentInboxItemEntity[]>;
138
+ };
100
139
  [DocumentPatterns.getSummary]: {
101
140
  payload: { actor: DocumentActor };
102
141
  response: DocumentGetSummaryResponseEntity;
@@ -129,6 +168,21 @@ export interface DocumentContract {
129
168
  };
130
169
  response: DocumentReviewResponseEntity;
131
170
  };
171
+ /**
172
+ * Pasa un turno pendiente (de visación o de firma) a otro funcionario, por ausencia o por error, y lo deja en la
173
+ * trazabilidad con su motivo. Puede hacerlo quien redactó el documento; con `anyDocument`, quien lleva el registro.
174
+ */
175
+ [DocumentPatterns.reassign]: {
176
+ payload: Pick<DocumentEntity, 'id'> & {
177
+ participantId: DocumentParticipantEntity['id'];
178
+ // Funcionario que toma el turno.
179
+ employeeId: string;
180
+ reason: string;
181
+ actor: DocumentActor;
182
+ anyDocument?: boolean;
183
+ };
184
+ response: DocumentReassignResponseEntity;
185
+ };
132
186
  [DocumentPatterns.discard]: {
133
187
  payload: Pick<DocumentEntity, 'id'> & { actor: DocumentActor };
134
188
  response: DocumentDiscardResponseEntity;
@@ -138,6 +192,28 @@ export interface DocumentContract {
138
192
  payload: Pick<DocumentEntity, 'id'> & { reason: string; actor: DocumentActor };
139
193
  response: DocumentAnnulResponseEntity;
140
194
  };
195
+ /**
196
+ * Deriva un documento finalizado a otros funcionarios o áreas, con su providencia (qué se espera de ellos) y,
197
+ * si corresponde, un plazo. Puede hacerlo quien lo tiene a su alcance: su redactor, quien lo visó o firmó, quien lo
198
+ * recibió y, con `viewAll`, quien consulta el historial.
199
+ */
200
+ [DocumentPatterns.derive]: {
201
+ payload: Pick<DocumentEntity, 'id'> & {
202
+ recipients: DocumentRecipientInput[];
203
+ instruction: DocumentInstruction;
204
+ note?: string | null;
205
+ // Plazo para atenderlo (ISO 8601).
206
+ dueAt?: string | null;
207
+ actor: DocumentActor;
208
+ viewAll?: boolean;
209
+ };
210
+ response: DocumentDeriveResponseEntity;
211
+ };
212
+ /** Quien recibió un documento lo marca como atendido, con una nota opcional. */
213
+ [DocumentPatterns.closeDelivery]: {
214
+ payload: { deliveryId: DocumentDeliveryEntity['id']; note?: string | null; actor: DocumentActor };
215
+ response: DocumentCloseDeliveryResponseEntity;
216
+ };
141
217
  /** Comprobación pública de un documento con el código que lleva impreso. No exige sesión. */
142
218
  [DocumentPatterns.verify]: {
143
219
  payload: { code: string };
@@ -1,4 +1,4 @@
1
- import { type DocumentCategory, type DocumentTypeEntity } from '../base/entities';
1
+ import { type DocumentCategory, type DocumentParticipantRole, type DocumentTypeEntity } from '../base/entities';
2
2
  import {
3
3
  type DocumentTypeCreateResponseEntity,
4
4
  type DocumentTypeGetAllResponseEntity,
@@ -16,6 +16,15 @@ export const DocumentTypePatterns = {
16
16
  setEnabled: 'gestorDocumental.documentType.setEnabled',
17
17
  } as const;
18
18
 
19
+ /**
20
+ * Paso del flujo sugerido de un tipo documental: un funcionario en particular, o quien dirija una dirección al
21
+ * momento de redactar (su jefatura o, con subrogancia activa, el subrogante). El nombre de la dirección lo resuelve
22
+ * el gateway; el navegador solo indica cuál es.
23
+ */
24
+ export type DocumentFlowStepInput =
25
+ | { role: DocumentParticipantRole; type: 'Employee'; employeeId: string }
26
+ | { role: DocumentParticipantRole; type: 'DirectorateHead'; directorateCodeReference: number; name: string };
27
+
19
28
  /** Datos de un tipo documental al crearlo o editarlo. */
20
29
  export interface DocumentTypeWritePayload {
21
30
  name: string;
@@ -27,6 +36,8 @@ export interface DocumentTypeWritePayload {
27
36
  resetsYearly?: boolean;
28
37
  directorateCodeReference?: number | null;
29
38
  enabled?: boolean;
39
+ // Flujo sugerido, en el orden en que les toca dentro de cada rol. Al editar, si no viene, el flujo no cambia.
40
+ flowSteps?: DocumentFlowStepInput[];
30
41
  }
31
42
 
32
43
  /**
@@ -1,8 +1,10 @@
1
1
  import {
2
2
  DocumentAnnulledNumberEntity,
3
3
  DocumentAttachmentEntity,
4
+ DocumentDeliveryEntity,
4
5
  DocumentEntity,
5
6
  DocumentParticipantEntity,
7
+ DocumentRecipientEntity,
6
8
  DocumentTrackingEntity,
7
9
  DocumentTypeEntity,
8
10
  } from '../../base/entities';
@@ -27,6 +29,51 @@ export interface DocumentParticipantResponseEntity {
27
29
  resolvedAt: DocumentParticipantEntity['resolvedAt'];
28
30
  }
29
31
 
32
+ /** Destinatario de un documento, como lo eligió el redactor: una persona o un área completa. */
33
+ export interface DocumentRecipientResponseEntity {
34
+ id: DocumentRecipientEntity['id'];
35
+ type: DocumentRecipientEntity['type'];
36
+ employeeId: DocumentRecipientEntity['employeeId'];
37
+ directorateCodeReference: DocumentRecipientEntity['directorateCodeReference'];
38
+ departmentId: DocumentRecipientEntity['departmentId'];
39
+ name: DocumentRecipientEntity['name'];
40
+ position: DocumentRecipientEntity['position'];
41
+ }
42
+
43
+ /** Un documento en la bandeja de un funcionario: como destinatario o porque se lo derivaron. */
44
+ export interface DocumentDeliveryResponseEntity {
45
+ id: DocumentDeliveryEntity['id'];
46
+ origin: DocumentDeliveryEntity['origin'];
47
+ employeeId: DocumentDeliveryEntity['employeeId'];
48
+ fullName: DocumentDeliveryEntity['fullName'];
49
+ position: DocumentDeliveryEntity['position'];
50
+ // Área por la que le llegó, si el documento iba dirigido a un área.
51
+ areaName: DocumentDeliveryEntity['areaName'];
52
+ // Quién se lo derivó. Null si es uno de los destinatarios originales.
53
+ sentByEmployeeId: DocumentDeliveryEntity['sentByEmployeeId'];
54
+ sentByFullName: DocumentDeliveryEntity['sentByFullName'];
55
+ instruction: DocumentDeliveryEntity['instruction'];
56
+ note: DocumentDeliveryEntity['note'];
57
+ dueAt: DocumentDeliveryEntity['dueAt'];
58
+ // Null mientras el documento no termina su tramitación.
59
+ deliveredAt: DocumentDeliveryEntity['deliveredAt'];
60
+ readAt: DocumentDeliveryEntity['readAt'];
61
+ closedAt: DocumentDeliveryEntity['closedAt'];
62
+ closingNote: DocumentDeliveryEntity['closingNote'];
63
+ }
64
+
65
+ /** Lo necesario para citar otro documento y enlazarlo (el que se responde, o las respuestas). */
66
+ export interface DocumentLinkEntity {
67
+ id: DocumentEntity['id'];
68
+ subject: DocumentEntity['subject'];
69
+ status: DocumentEntity['status'];
70
+ correlative: DocumentEntity['correlative'];
71
+ correlativeYear: DocumentEntity['correlativeYear'];
72
+ createdByFullName: DocumentEntity['createdByFullName'];
73
+ finishedAt: DocumentEntity['finishedAt'];
74
+ documentType: DocumentTypeSummaryEntity;
75
+ }
76
+
30
77
  export interface DocumentGetAllResponseEntity {
31
78
  id: DocumentEntity['id'];
32
79
  subject: DocumentEntity['subject'];
@@ -42,6 +89,13 @@ export interface DocumentGetAllResponseEntity {
42
89
  documentType: DocumentTypeSummaryEntity;
43
90
  // A quién le toca visar o firmar (null si el documento no está en tramitación).
44
91
  currentParticipant: Pick<DocumentParticipantResponseEntity, 'role' | 'employeeId' | 'fullName'> | null;
92
+ // A cuántos funcionarios llegó y cuántos ya lo abrieron (null si aún no se distribuye a nadie).
93
+ distribution: { total: number; read: number } | null;
94
+ }
95
+
96
+ /** Una entrada de la bandeja de recibidos: la entrega y el documento al que corresponde. */
97
+ export interface DocumentInboxItemEntity extends DocumentDeliveryResponseEntity {
98
+ document: DocumentLinkEntity;
45
99
  }
46
100
 
47
101
  export interface DocumentGetByIdResponseEntity {
@@ -82,6 +136,15 @@ export interface DocumentGetByIdResponseEntity {
82
136
  employeeFullName: DocumentAnnulledNumberEntity['employeeFullName'];
83
137
  createdAt: DocumentAnnulledNumberEntity['createdAt'];
84
138
  }[];
139
+ // Plazo en que el redactor espera respuesta de los destinatarios.
140
+ responseDueAt: DocumentEntity['responseDueAt'];
141
+ // A quién va dirigido, como lo indicó el redactor (personas y áreas).
142
+ recipients: DocumentRecipientResponseEntity[];
143
+ // En la bandeja de quién está: destinatarios y derivaciones, con su lectura y atención.
144
+ deliveries: DocumentDeliveryResponseEntity[];
145
+ // Documento al que este responde, y los que le responden (solo los ya finalizados, más los propios de quien consulta).
146
+ replyTo: DocumentLinkEntity | null;
147
+ replies: DocumentLinkEntity[];
85
148
  documentType: DocumentTypeSummaryEntity;
86
149
  participants: DocumentParticipantResponseEntity[];
87
150
  attachments: {
@@ -105,6 +168,13 @@ export interface DocumentGetByIdResponseEntity {
105
168
  turn: Pick<DocumentParticipantResponseEntity, 'id' | 'role'> | null;
106
169
  canEdit: boolean;
107
170
  canDiscard: boolean;
171
+ // Puede derivarlo a otros funcionarios y responderlo: el documento ya es oficial y está a su alcance.
172
+ canDerive: boolean;
173
+ canReply: boolean;
174
+ // Es quien redactó un documento en tramitación: puede pasar un turno pendiente a otro funcionario.
175
+ canReassign: boolean;
176
+ // Sus propias entregas de este documento (puede tener más de una si además se lo derivaron).
177
+ inbox: DocumentDeliveryResponseEntity[];
108
178
  };
109
179
  // Firmar exige el código OTP de quien firma (firma atendida).
110
180
  signatureRequiresOtp: boolean;
@@ -120,6 +190,12 @@ export interface DocumentGetSummaryResponseEntity {
120
190
  rejected: number;
121
191
  finished: number;
122
192
  };
193
+ // Su bandeja de recibidos: sin abrir, sin atender y, de estos, con el plazo vencido.
194
+ received: {
195
+ unread: number;
196
+ pending: number;
197
+ overdue: number;
198
+ };
123
199
  }
124
200
 
125
201
  export interface DocumentCreateResponseEntity {
@@ -185,3 +261,20 @@ export interface DocumentPublicFileResponseEntity {
185
261
  fileId: string;
186
262
  fileName: string;
187
263
  }
264
+
265
+ export interface DocumentDeriveResponseEntity {
266
+ id: DocumentEntity['id'];
267
+ ok: boolean;
268
+ // A cuántos funcionarios llegó la derivación.
269
+ delivered: number;
270
+ }
271
+
272
+ export interface DocumentCloseDeliveryResponseEntity {
273
+ id: DocumentDeliveryEntity['id'];
274
+ ok: boolean;
275
+ }
276
+
277
+ export interface DocumentReassignResponseEntity {
278
+ id: DocumentEntity['id'];
279
+ ok: boolean;
280
+ }
@@ -1,4 +1,17 @@
1
- import { DocumentTypeEntity } from '../../base/entities';
1
+ import { DocumentTypeEntity, DocumentTypeFlowStepEntity } from '../../base/entities';
2
+
3
+ /** Paso del flujo sugerido de un tipo documental: quién visa o firma, en su orden. */
4
+ export interface DocumentTypeFlowStepResponseEntity {
5
+ id: DocumentTypeFlowStepEntity['id'];
6
+ role: DocumentTypeFlowStepEntity['role'];
7
+ order: DocumentTypeFlowStepEntity['order'];
8
+ type: DocumentTypeFlowStepEntity['type'];
9
+ employeeId: DocumentTypeFlowStepEntity['employeeId'];
10
+ directorateCodeReference: DocumentTypeFlowStepEntity['directorateCodeReference'];
11
+ // Nombre del funcionario o de la dirección, como estaba al definir el flujo.
12
+ name: DocumentTypeFlowStepEntity['name'];
13
+ position: DocumentTypeFlowStepEntity['position'];
14
+ }
2
15
 
3
16
  export interface DocumentTypeGetAllResponseEntity {
4
17
  id: DocumentTypeEntity['id'];
@@ -11,12 +24,16 @@ export interface DocumentTypeGetAllResponseEntity {
11
24
  resetsYearly: DocumentTypeEntity['resetsYearly'];
12
25
  directorateCodeReference: DocumentTypeEntity['directorateCodeReference'];
13
26
  enabled: DocumentTypeEntity['enabled'];
27
+ // Cuántos visadores y firmantes tiene su flujo sugerido.
28
+ flow: { visa: number; signature: number };
14
29
  }
15
30
 
16
31
  export interface DocumentTypeGetByIdResponseEntity extends DocumentTypeGetAllResponseEntity {
17
32
  // Último número ya asignado en el año vigente del correlativo (null si aún no se numera ninguno): el próximo
18
33
  // correlativo no puede quedar por debajo de él.
19
34
  lastCorrelative: number | null;
35
+ // Flujo sugerido: primero los visadores y después los firmantes, cada grupo en su orden.
36
+ flowSteps: DocumentTypeFlowStepResponseEntity[];
20
37
  }
21
38
 
22
39
  export interface DocumentTypeCreateResponseEntity {