@muni-sanfer/types-gestor-documental 0.0.1-beta.2 → 0.0.1-beta.4

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.
Files changed (37) hide show
  1. package/dist/base/entities.d.ts +215 -1
  2. package/dist/base/entities.js +60 -1
  3. package/dist/contracts/caseFile.contract.d.ts +149 -0
  4. package/dist/contracts/caseFile.contract.js +17 -0
  5. package/dist/contracts/document.contract.d.ts +17 -2
  6. package/dist/contracts/document.contract.js +1 -0
  7. package/dist/contracts/documentType.contract.d.ts +17 -1
  8. package/dist/contracts/index.d.ts +26 -1
  9. package/dist/contracts/index.js +6 -0
  10. package/dist/contracts/procedure.contract.d.ts +50 -0
  11. package/dist/contracts/procedure.contract.js +11 -0
  12. package/dist/entities/caseFile/caseFile.entity.d.ts +169 -0
  13. package/dist/entities/caseFile/caseFile.entity.js +2 -0
  14. package/dist/entities/caseFile/index.d.ts +1 -0
  15. package/dist/entities/caseFile/index.js +17 -0
  16. package/dist/entities/document/document.entity.d.ts +12 -0
  17. package/dist/entities/documentType/documentType.entity.d.ts +17 -1
  18. package/dist/entities/index.d.ts +2 -0
  19. package/dist/entities/index.js +2 -0
  20. package/dist/entities/procedure/index.d.ts +1 -0
  21. package/dist/entities/procedure/index.js +17 -0
  22. package/dist/entities/procedure/procedure.entity.d.ts +20 -0
  23. package/dist/entities/procedure/procedure.entity.js +2 -0
  24. package/package.json +1 -1
  25. package/src/base/entities.ts +261 -1
  26. package/src/contracts/caseFile.contract.ts +134 -0
  27. package/src/contracts/document.contract.ts +18 -0
  28. package/src/contracts/documentType.contract.ts +12 -1
  29. package/src/contracts/index.ts +7 -1
  30. package/src/contracts/procedure.contract.ts +53 -0
  31. package/src/entities/caseFile/caseFile.entity.ts +196 -0
  32. package/src/entities/caseFile/index.ts +1 -0
  33. package/src/entities/document/document.entity.ts +9 -0
  34. package/src/entities/documentType/documentType.entity.ts +18 -1
  35. package/src/entities/index.ts +2 -0
  36. package/src/entities/procedure/index.ts +1 -0
  37. package/src/entities/procedure/procedure.entity.ts +24 -0
@@ -59,7 +59,8 @@ export type DocumentTrackingAction =
59
59
  | 'NumberAnnulled'
60
60
  | 'Annulled'
61
61
  | 'Delivered'
62
- | 'Derived';
62
+ | 'Derived'
63
+ | 'Reassigned';
63
64
 
64
65
  export const DocumentTrackingAction = {
65
66
  Created: 'Created',
@@ -75,8 +76,16 @@ export const DocumentTrackingAction = {
75
76
  Annulled: 'Annulled',
76
77
  Delivered: 'Delivered',
77
78
  Derived: 'Derived',
79
+ Reassigned: 'Reassigned',
78
80
  } satisfies Record<string, DocumentTrackingAction>;
79
81
 
82
+ export type DocumentFlowStepType = 'Employee' | 'DirectorateHead';
83
+
84
+ export const DocumentFlowStepType = {
85
+ Employee: 'Employee',
86
+ DirectorateHead: 'DirectorateHead',
87
+ } satisfies Record<string, DocumentFlowStepType>;
88
+
80
89
  export type DocumentAttachmentType = 'File' | 'Link';
81
90
 
82
91
  export const DocumentAttachmentType = {
@@ -108,6 +117,101 @@ export const DocumentInstruction = {
108
117
  Archive: 'Archive',
109
118
  } satisfies Record<string, DocumentInstruction>;
110
119
 
120
+ export type CaseFileStatus = 'Open' | 'Closed';
121
+
122
+ export const CaseFileStatus = {
123
+ Open: 'Open',
124
+ Closed: 'Closed',
125
+ } satisfies Record<string, CaseFileStatus>;
126
+
127
+ export type CaseFileIncorporationMechanism =
128
+ 'Manual' | 'WebService' | 'Mixed' | 'CitizenRepository' | 'Interoperability';
129
+
130
+ export const CaseFileIncorporationMechanism = {
131
+ Manual: 'Manual',
132
+ WebService: 'WebService',
133
+ Mixed: 'Mixed',
134
+ CitizenRepository: 'CitizenRepository',
135
+ Interoperability: 'Interoperability',
136
+ } satisfies Record<string, CaseFileIncorporationMechanism>;
137
+
138
+ export type CaseFileActuationType =
139
+ | 'AdministrativeAct'
140
+ | 'Notification'
141
+ | 'OfficialCommunication'
142
+ | 'Interoperability'
143
+ | 'RequestReception'
144
+ | 'Subfolder'
145
+ | 'PowerRegistration';
146
+
147
+ export const CaseFileActuationType = {
148
+ AdministrativeAct: 'AdministrativeAct',
149
+ Notification: 'Notification',
150
+ OfficialCommunication: 'OfficialCommunication',
151
+ Interoperability: 'Interoperability',
152
+ RequestReception: 'RequestReception',
153
+ Subfolder: 'Subfolder',
154
+ PowerRegistration: 'PowerRegistration',
155
+ } satisfies Record<string, CaseFileActuationType>;
156
+
157
+ export type CaseFileEntryKind = 'Document' | 'File' | 'CaseFile';
158
+
159
+ export const CaseFileEntryKind = {
160
+ Document: 'Document',
161
+ File: 'File',
162
+ CaseFile: 'CaseFile',
163
+ } satisfies Record<string, CaseFileEntryKind>;
164
+
165
+ export type CaseFileActorRelation =
166
+ 'Responsible' | 'Interested' | 'Author' | 'Referred' | 'Recipient' | 'MinisterOfFaith';
167
+
168
+ export const CaseFileActorRelation = {
169
+ Responsible: 'Responsible',
170
+ Interested: 'Interested',
171
+ Author: 'Author',
172
+ Referred: 'Referred',
173
+ Recipient: 'Recipient',
174
+ MinisterOfFaith: 'MinisterOfFaith',
175
+ } satisfies Record<string, CaseFileActorRelation>;
176
+
177
+ export type CaseFileActorType = 'Citizen' | 'Foreigner' | 'PrivateInstitution' | 'Official';
178
+
179
+ export const CaseFileActorType = {
180
+ Citizen: 'Citizen',
181
+ Foreigner: 'Foreigner',
182
+ PrivateInstitution: 'PrivateInstitution',
183
+ Official: 'Official',
184
+ } satisfies Record<string, CaseFileActorType>;
185
+
186
+ export type CaseFileTrackingAction =
187
+ | 'Created'
188
+ | 'Updated'
189
+ | 'EntryAdded'
190
+ | 'EntryVoided'
191
+ | 'ParticipantAdded'
192
+ | 'ParticipantRemoved'
193
+ | 'Closed'
194
+ | 'Exported';
195
+
196
+ export const CaseFileTrackingAction = {
197
+ Created: 'Created',
198
+ Updated: 'Updated',
199
+ EntryAdded: 'EntryAdded',
200
+ EntryVoided: 'EntryVoided',
201
+ ParticipantAdded: 'ParticipantAdded',
202
+ ParticipantRemoved: 'ParticipantRemoved',
203
+ Closed: 'Closed',
204
+ Exported: 'Exported',
205
+ } satisfies Record<string, CaseFileTrackingAction>;
206
+
207
+ export type CaseFileAccessAction = 'Viewed' | 'FileDownloaded' | 'Exported';
208
+
209
+ export const CaseFileAccessAction = {
210
+ Viewed: 'Viewed',
211
+ FileDownloaded: 'FileDownloaded',
212
+ Exported: 'Exported',
213
+ } satisfies Record<string, CaseFileAccessAction>;
214
+
111
215
  export interface DocumentTypeEntity {
112
216
  id: string;
113
217
  name: string;
@@ -121,6 +225,7 @@ export interface DocumentTypeEntity {
121
225
  enabled: boolean;
122
226
  documents?: DocumentEntity[];
123
227
  annulledNumbers?: DocumentAnnulledNumberEntity[];
228
+ flowSteps?: DocumentTypeFlowStepEntity[];
124
229
  deleted: boolean;
125
230
  createdAt: string;
126
231
  updatedAt: string;
@@ -162,6 +267,7 @@ export interface DocumentEntity {
162
267
  annulledNumbers?: DocumentAnnulledNumberEntity[];
163
268
  recipients?: DocumentRecipientEntity[];
164
269
  deliveries?: DocumentDeliveryEntity[];
270
+ caseFileEntries?: CaseFileEntryEntity[];
165
271
  deleted: boolean;
166
272
  createdAt: string;
167
273
  updatedAt: string;
@@ -254,3 +360,157 @@ export interface DocumentDeliveryEntity {
254
360
  documentId: string;
255
361
  createdAt: string;
256
362
  }
363
+
364
+ export interface DocumentTypeFlowStepEntity {
365
+ id: string;
366
+ role: DocumentParticipantRole;
367
+ order: number;
368
+ type: DocumentFlowStepType;
369
+ employeeId?: string | null;
370
+ directorateCodeReference?: number | null;
371
+ name: string;
372
+ position?: string | null;
373
+ documentType?: DocumentTypeEntity;
374
+ documentTypeId: string;
375
+ createdAt: string;
376
+ }
377
+
378
+ export interface ProcedureEntity {
379
+ id: string;
380
+ name: string;
381
+ cpatId?: string | null;
382
+ cpatCode?: string | null;
383
+ description?: string | null;
384
+ enabled: boolean;
385
+ caseFiles?: CaseFileEntity[];
386
+ deleted: boolean;
387
+ createdAt: string;
388
+ updatedAt: string;
389
+ }
390
+
391
+ export interface CaseFileSequenceEntity {
392
+ year: number;
393
+ next: number;
394
+ }
395
+
396
+ export interface CaseFileEntity {
397
+ id: string;
398
+ code: string;
399
+ year: number;
400
+ number: number;
401
+ title: string;
402
+ subject: string;
403
+ summary?: string | null;
404
+ status: CaseFileStatus;
405
+ accessLevel: DocumentAccessLevel;
406
+ hasSensitiveData: boolean;
407
+ incorporationMechanism: CaseFileIncorporationMechanism;
408
+ schemaVersion: string;
409
+ procedure?: ProcedureEntity;
410
+ procedureId: string;
411
+ responsibleEmployeeId: string;
412
+ responsibleFullName: string;
413
+ responsiblePosition?: string | null;
414
+ closedAt?: string | null;
415
+ closedByEmployeeId?: string | null;
416
+ closedByFullName?: string | null;
417
+ closingNote?: string | null;
418
+ participants?: CaseFileParticipantEntity[];
419
+ actors?: CaseFileActorEntity[];
420
+ entries?: CaseFileEntryEntity[];
421
+ linkedFrom?: CaseFileEntryEntity[];
422
+ trackings?: CaseFileTrackingEntity[];
423
+ metadataChanges?: CaseFileMetadataChangeEntity[];
424
+ accesses?: CaseFileAccessEntity[];
425
+ createdAt: string;
426
+ updatedAt: string;
427
+ }
428
+
429
+ export interface CaseFileParticipantEntity {
430
+ id: string;
431
+ employeeId: string;
432
+ fullName: string;
433
+ position?: string | null;
434
+ addedByEmployeeId: string;
435
+ addedByFullName: string;
436
+ caseFile?: CaseFileEntity;
437
+ caseFileId: string;
438
+ createdAt: string;
439
+ }
440
+
441
+ export interface CaseFileActorEntity {
442
+ id: string;
443
+ relation: CaseFileActorRelation;
444
+ actorType: CaseFileActorType;
445
+ identifier?: string | null;
446
+ name: string;
447
+ caseFile?: CaseFileEntity;
448
+ caseFileId: string;
449
+ createdAt: string;
450
+ }
451
+
452
+ export interface CaseFileEntryEntity {
453
+ id: string;
454
+ sequence: number;
455
+ kind: CaseFileEntryKind;
456
+ actuationType: CaseFileActuationType;
457
+ title: string;
458
+ document?: DocumentEntity | null;
459
+ documentId?: string | null;
460
+ fileId?: string | null;
461
+ fileName?: string | null;
462
+ documentTypeName?: string | null;
463
+ originDate?: string | null;
464
+ author?: string | null;
465
+ keywords: string[];
466
+ accessLevel?: DocumentAccessLevel | null;
467
+ hasSensitiveData?: boolean | null;
468
+ linkedCaseFile?: CaseFileEntity | null;
469
+ linkedCaseFileId?: string | null;
470
+ sha256?: string | null;
471
+ size?: number | null;
472
+ hasAdvancedSignature: boolean;
473
+ incorporatedByEmployeeId: string;
474
+ incorporatedByFullName: string;
475
+ voidedAt?: string | null;
476
+ voidedByEmployeeId?: string | null;
477
+ voidedByFullName?: string | null;
478
+ voidReason?: string | null;
479
+ caseFile?: CaseFileEntity;
480
+ caseFileId: string;
481
+ createdAt: string;
482
+ }
483
+
484
+ export interface CaseFileTrackingEntity {
485
+ id: string;
486
+ action: CaseFileTrackingAction;
487
+ observation?: string | null;
488
+ employeeId?: string | null;
489
+ employeeFullName?: string | null;
490
+ caseFile?: CaseFileEntity;
491
+ caseFileId: string;
492
+ createdAt: string;
493
+ }
494
+
495
+ export interface CaseFileMetadataChangeEntity {
496
+ id: string;
497
+ field: string;
498
+ previousValue?: string | null;
499
+ newValue?: string | null;
500
+ employeeId: string;
501
+ employeeFullName: string;
502
+ caseFile?: CaseFileEntity;
503
+ caseFileId: string;
504
+ createdAt: string;
505
+ }
506
+
507
+ export interface CaseFileAccessEntity {
508
+ id: string;
509
+ action: CaseFileAccessAction;
510
+ entryId?: string | null;
511
+ employeeId: string;
512
+ employeeFullName: string;
513
+ caseFile?: CaseFileEntity;
514
+ caseFileId: string;
515
+ createdAt: string;
516
+ }
@@ -0,0 +1,134 @@
1
+ import {
2
+ type CaseFileActorRelation,
3
+ type CaseFileActorType,
4
+ type CaseFileActuationType,
5
+ type CaseFileEntity,
6
+ type CaseFileStatus,
7
+ type DocumentAccessLevel,
8
+ } from '../base/entities';
9
+ import {
10
+ type CaseFileAddEntryResponseEntity,
11
+ type CaseFileCreateResponseEntity,
12
+ type CaseFileEntryFileResponseEntity,
13
+ type CaseFileExportResponseEntity,
14
+ type CaseFileGetAllResponseEntity,
15
+ type CaseFileGetByIdResponseEntity,
16
+ type CaseFileUpdateResponseEntity,
17
+ } from '../entities';
18
+ import { type RpcPage } from './contract';
19
+ import { type DocumentActor } from './document.contract';
20
+
21
+ /** Patrones NATS de `caseFile`: `<servicio>.<recurso>.<acción>`. */
22
+ export const CaseFilePatterns = {
23
+ getAll: 'gestorDocumental.caseFile.getAll',
24
+ getById: 'gestorDocumental.caseFile.getById',
25
+ create: 'gestorDocumental.caseFile.create',
26
+ update: 'gestorDocumental.caseFile.update',
27
+ addEntry: 'gestorDocumental.caseFile.addEntry',
28
+ voidEntry: 'gestorDocumental.caseFile.voidEntry',
29
+ share: 'gestorDocumental.caseFile.share',
30
+ unshare: 'gestorDocumental.caseFile.unshare',
31
+ close: 'gestorDocumental.caseFile.close',
32
+ getEntryFile: 'gestorDocumental.caseFile.getEntryFile',
33
+ getExport: 'gestorDocumental.caseFile.getExport',
34
+ } as const;
35
+
36
+ /** Persona u organización relacionada con el expediente (MGDEE54). */
37
+ export interface CaseFileActorInput {
38
+ relation: CaseFileActorRelation;
39
+ actorType: CaseFileActorType;
40
+ identifier?: string | null;
41
+ name: string;
42
+ }
43
+
44
+ /** Metadatos del expediente que se ingresan a mano. */
45
+ export interface CaseFileWritePayload {
46
+ title: string;
47
+ subject: string;
48
+ summary?: string | null;
49
+ procedureId: string;
50
+ accessLevel: DocumentAccessLevel;
51
+ hasSensitiveData: boolean;
52
+ actors?: CaseFileActorInput[];
53
+ }
54
+
55
+ /** Actuación que se incorpora al índice: un documento del gestor, un archivo subido u otro expediente. */
56
+ export type CaseFileEntryInput =
57
+ | { kind: 'Document'; actuationType: CaseFileActuationType; documentId: string }
58
+ | {
59
+ kind: 'File';
60
+ actuationType: CaseFileActuationType;
61
+ fileId: string;
62
+ fileName: string;
63
+ title: string;
64
+ documentTypeName?: string | null;
65
+ originDate?: string | null;
66
+ author?: string | null;
67
+ keywords: string[];
68
+ accessLevel: DocumentAccessLevel;
69
+ hasSensitiveData: boolean;
70
+ }
71
+ | { kind: 'CaseFile'; actuationType: CaseFileActuationType; linkedCaseFileId: string };
72
+
73
+ /** Quién hace la operación (de la sesión) y si puede ver todos los expedientes. */
74
+ interface CaseFileActorPayload {
75
+ actor: DocumentActor;
76
+ viewAll?: boolean;
77
+ }
78
+
79
+ /** Ámbito del listado: los expedientes del funcionario (responsable o compartidos con él) o todos. */
80
+ export type CaseFileScope = 'mine' | 'all';
81
+
82
+ export interface CaseFileContract {
83
+ [CaseFilePatterns.getAll]: {
84
+ payload: {
85
+ pagination?: { page?: number; limit?: number };
86
+ filters?: { search?: string; status?: CaseFileStatus; procedureId?: string; scope?: CaseFileScope };
87
+ } & CaseFileActorPayload;
88
+ response: RpcPage<CaseFileGetAllResponseEntity[]>;
89
+ };
90
+ /** Por id o por su identificador (`EXP-2026-00001`), que es el del enlace persistente. Queda en el registro de accesos. */
91
+ [CaseFilePatterns.getById]: {
92
+ payload: { id: string } & CaseFileActorPayload;
93
+ response: CaseFileGetByIdResponseEntity;
94
+ };
95
+ [CaseFilePatterns.create]: {
96
+ payload: CaseFileWritePayload & { actor: DocumentActor };
97
+ response: CaseFileCreateResponseEntity;
98
+ };
99
+ [CaseFilePatterns.update]: {
100
+ payload: CaseFileWritePayload & Pick<CaseFileEntity, 'id'> & { actor: DocumentActor };
101
+ response: CaseFileUpdateResponseEntity;
102
+ };
103
+ [CaseFilePatterns.addEntry]: {
104
+ payload: Pick<CaseFileEntity, 'id'> & { entry: CaseFileEntryInput } & CaseFileActorPayload;
105
+ response: CaseFileAddEntryResponseEntity;
106
+ };
107
+ /** Deja una actuación sin efecto, con su motivo. No se elimina del índice. */
108
+ [CaseFilePatterns.voidEntry]: {
109
+ payload: Pick<CaseFileEntity, 'id'> & { entryId: string; reason: string; actor: DocumentActor };
110
+ response: CaseFileUpdateResponseEntity;
111
+ };
112
+ [CaseFilePatterns.share]: {
113
+ payload: Pick<CaseFileEntity, 'id'> & { employeeIds: string[]; actor: DocumentActor };
114
+ response: CaseFileUpdateResponseEntity;
115
+ };
116
+ [CaseFilePatterns.unshare]: {
117
+ payload: Pick<CaseFileEntity, 'id'> & { participantId: string; actor: DocumentActor };
118
+ response: CaseFileUpdateResponseEntity;
119
+ };
120
+ [CaseFilePatterns.close]: {
121
+ payload: Pick<CaseFileEntity, 'id'> & { note?: string | null; actor: DocumentActor };
122
+ response: CaseFileUpdateResponseEntity;
123
+ };
124
+ /** Archivo de una actuación del índice. Queda en el registro de accesos. */
125
+ [CaseFilePatterns.getEntryFile]: {
126
+ payload: Pick<CaseFileEntity, 'id'> & { entryId: string } & CaseFileActorPayload;
127
+ response: CaseFileEntryFileResponseEntity;
128
+ };
129
+ /** Metadatos y archivos para exportar el expediente completo. Queda en la trazabilidad y en el registro de accesos. */
130
+ [CaseFilePatterns.getExport]: {
131
+ payload: Pick<CaseFileEntity, 'id'> & CaseFileActorPayload;
132
+ response: CaseFileExportResponseEntity;
133
+ };
134
+ }
@@ -4,6 +4,7 @@ import {
4
4
  type DocumentDeliveryEntity,
5
5
  type DocumentEntity,
6
6
  type DocumentInstruction,
7
+ type DocumentParticipantEntity,
7
8
  type DocumentStatus,
8
9
  } from '../base/entities';
9
10
  import {
@@ -17,6 +18,7 @@ import {
17
18
  type DocumentGetSummaryResponseEntity,
18
19
  type DocumentInboxItemEntity,
19
20
  type DocumentPublicFileResponseEntity,
21
+ type DocumentReassignResponseEntity,
20
22
  type DocumentReviewResponseEntity,
21
23
  type DocumentUpdateResponseEntity,
22
24
  type DocumentVerifyResponseEntity,
@@ -32,6 +34,7 @@ export const DocumentPatterns = {
32
34
  create: 'gestorDocumental.document.create',
33
35
  update: 'gestorDocumental.document.update',
34
36
  review: 'gestorDocumental.document.review',
37
+ reassign: 'gestorDocumental.document.reassign',
35
38
  discard: 'gestorDocumental.document.discard',
36
39
  annul: 'gestorDocumental.document.annul',
37
40
  derive: 'gestorDocumental.document.derive',
@@ -165,6 +168,21 @@ export interface DocumentContract {
165
168
  };
166
169
  response: DocumentReviewResponseEntity;
167
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
+ };
168
186
  [DocumentPatterns.discard]: {
169
187
  payload: Pick<DocumentEntity, 'id'> & { actor: DocumentActor };
170
188
  response: DocumentDiscardResponseEntity;
@@ -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,15 +1,21 @@
1
+ import { CaseFilePatterns, type CaseFileContract } from './caseFile.contract';
1
2
  import { DocumentPatterns, type DocumentContract } from './document.contract';
2
3
  import { DocumentTypePatterns, type DocumentTypeContract } from './documentType.contract';
4
+ import { ProcedurePatterns, type ProcedureContract } from './procedure.contract';
3
5
 
4
6
  export * from './contract';
5
7
  export * from './document.contract';
6
8
  export * from './documentType.contract';
9
+ export * from './procedure.contract';
10
+ export * from './caseFile.contract';
7
11
 
8
12
  /** Patrones NATS de gestor-documental-ms, por recurso: `gestorDocumental.<recurso>.<acción>`. */
9
13
  export const GestorDocumentalPatterns = {
10
14
  documentType: DocumentTypePatterns,
11
15
  document: DocumentPatterns,
16
+ procedure: ProcedurePatterns,
17
+ caseFile: CaseFilePatterns,
12
18
  } as const;
13
19
 
14
20
  /** Contrato completo de gestor-documental-ms: la unión de los contratos de sus recursos. */
15
- export type GestorDocumentalContract = DocumentTypeContract & DocumentContract;
21
+ export type GestorDocumentalContract = DocumentTypeContract & DocumentContract & ProcedureContract & CaseFileContract;
@@ -0,0 +1,53 @@
1
+ import { type ProcedureEntity } from '../base/entities';
2
+ import {
3
+ type ProcedureCreateResponseEntity,
4
+ type ProcedureGetAllResponseEntity,
5
+ type ProcedureGetByIdResponseEntity,
6
+ type ProcedureUpdateResponseEntity,
7
+ } from '../entities';
8
+ import { type RpcPage } from './contract';
9
+
10
+ /** Patrones NATS de `procedure`: `<servicio>.<recurso>.<acción>`. */
11
+ export const ProcedurePatterns = {
12
+ getAll: 'gestorDocumental.procedure.getAll',
13
+ getById: 'gestorDocumental.procedure.getById',
14
+ create: 'gestorDocumental.procedure.create',
15
+ update: 'gestorDocumental.procedure.update',
16
+ setEnabled: 'gestorDocumental.procedure.setEnabled',
17
+ } as const;
18
+
19
+ /** Datos de un procedimiento administrativo al crearlo o editarlo. */
20
+ export interface ProcedureWritePayload {
21
+ name: string;
22
+ cpatId?: string | null;
23
+ cpatCode?: string | null;
24
+ description?: string | null;
25
+ enabled?: boolean;
26
+ }
27
+
28
+ export interface ProcedureContract {
29
+ [ProcedurePatterns.getAll]: {
30
+ // sin `page` y `limit` responde todos en una sola página
31
+ payload: {
32
+ pagination?: { page?: number; limit?: number };
33
+ filters?: { search?: string; enabled?: boolean };
34
+ };
35
+ response: RpcPage<ProcedureGetAllResponseEntity[]>;
36
+ };
37
+ [ProcedurePatterns.getById]: {
38
+ payload: Pick<ProcedureEntity, 'id'>;
39
+ response: ProcedureGetByIdResponseEntity;
40
+ };
41
+ [ProcedurePatterns.create]: {
42
+ payload: ProcedureWritePayload;
43
+ response: ProcedureCreateResponseEntity;
44
+ };
45
+ [ProcedurePatterns.update]: {
46
+ payload: ProcedureWritePayload & Pick<ProcedureEntity, 'id'>;
47
+ response: ProcedureUpdateResponseEntity;
48
+ };
49
+ [ProcedurePatterns.setEnabled]: {
50
+ payload: Pick<ProcedureEntity, 'id' | 'enabled'>;
51
+ response: ProcedureUpdateResponseEntity;
52
+ };
53
+ }