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

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' | 'Delivered' | 'Derived' | 'Reassigned';
36
+ export type DocumentTrackingAction = 'Created' | 'Updated' | 'Submitted' | 'Visaed' | 'Signed' | 'Rejected' | 'Finished' | 'Discarded' | 'Numbered' | 'NumberAnnulled' | 'Annulled' | 'Delivered' | 'Derived' | 'Reassigned' | 'Dispatched' | 'DispatchReturned' | 'Received';
37
37
  export declare const DocumentTrackingAction: {
38
38
  Created: "Created";
39
39
  Updated: "Updated";
@@ -49,6 +49,26 @@ export declare const DocumentTrackingAction: {
49
49
  Delivered: "Delivered";
50
50
  Derived: "Derived";
51
51
  Reassigned: "Reassigned";
52
+ Dispatched: "Dispatched";
53
+ DispatchReturned: "DispatchReturned";
54
+ Received: "Received";
55
+ };
56
+ export type DocumentOrigin = 'Internal' | 'DocDigital';
57
+ export declare const DocumentOrigin: {
58
+ Internal: "Internal";
59
+ DocDigital: "DocDigital";
60
+ };
61
+ export type DocumentDispatchStatus = 'Pending' | 'Dispatched' | 'Returned';
62
+ export declare const DocumentDispatchStatus: {
63
+ Pending: "Pending";
64
+ Dispatched: "Dispatched";
65
+ Returned: "Returned";
66
+ };
67
+ export type DocDigitalInboundStatus = 'Pending' | 'Registered' | 'Returned';
68
+ export declare const DocDigitalInboundStatus: {
69
+ Pending: "Pending";
70
+ Registered: "Registered";
71
+ Returned: "Returned";
52
72
  };
53
73
  export type DocumentFlowStepType = 'Employee' | 'DirectorateHead';
54
74
  export declare const DocumentFlowStepType: {
@@ -173,6 +193,12 @@ export interface DocumentEntity {
173
193
  annulledAt?: string | null;
174
194
  annulmentReason?: string | null;
175
195
  responseDueAt?: string | null;
196
+ origin: DocumentOrigin;
197
+ intakeNumber?: number | null;
198
+ intakeYear?: number | null;
199
+ externalFolio?: string | null;
200
+ externalSender?: string | null;
201
+ externalDate?: string | null;
176
202
  replyTo?: DocumentEntity | null;
177
203
  replyToDocumentId?: string | null;
178
204
  replies?: DocumentEntity[];
@@ -195,6 +221,9 @@ export interface DocumentEntity {
195
221
  recipients?: DocumentRecipientEntity[];
196
222
  deliveries?: DocumentDeliveryEntity[];
197
223
  caseFileEntries?: CaseFileEntryEntity[];
224
+ externalRecipients?: DocumentExternalRecipientEntity[];
225
+ dispatch?: DocumentDispatchEntity | null;
226
+ docDigitalInbound?: DocDigitalInboundEntity | null;
198
227
  deleted: boolean;
199
228
  createdAt: string;
200
229
  updatedAt: string;
@@ -425,3 +454,74 @@ export interface CaseFileAccessEntity {
425
454
  caseFileId: string;
426
455
  createdAt: string;
427
456
  }
457
+ export interface DocumentExternalRecipientEntity {
458
+ id: string;
459
+ entityId: number;
460
+ entityName: string;
461
+ userId?: number | null;
462
+ userName?: string | null;
463
+ userPosition?: string | null;
464
+ document?: DocumentEntity;
465
+ documentId: string;
466
+ createdAt: string;
467
+ }
468
+ export interface DocumentDispatchEntity {
469
+ id: string;
470
+ status: DocumentDispatchStatus;
471
+ folio?: string | null;
472
+ docDigitalTypeId?: number | null;
473
+ docDigitalTypeName?: string | null;
474
+ docDigitalDocumentId?: string | null;
475
+ docDigitalRequestId?: string | null;
476
+ dispatchedAt?: string | null;
477
+ dispatchedByEmployeeId?: string | null;
478
+ dispatchedByFullName?: string | null;
479
+ returnedAt?: string | null;
480
+ returnedByEmployeeId?: string | null;
481
+ returnedByFullName?: string | null;
482
+ returnReason?: string | null;
483
+ document?: DocumentEntity;
484
+ documentId: string;
485
+ createdAt: string;
486
+ updatedAt: string;
487
+ }
488
+ export interface DocDigitalInboundEntity {
489
+ id: string;
490
+ docDigitalDocumentId: string;
491
+ docDigitalRequestId?: string | null;
492
+ status: DocDigitalInboundStatus;
493
+ subject: string;
494
+ description?: string | null;
495
+ folio?: string | null;
496
+ folioDate?: string | null;
497
+ typeName?: string | null;
498
+ reserved: boolean;
499
+ senderEntityId?: number | null;
500
+ senderEntityName?: string | null;
501
+ senderName?: string | null;
502
+ senderPosition?: string | null;
503
+ fileId?: string | null;
504
+ fileName?: string | null;
505
+ attachments: JsonValue;
506
+ registeredAt?: string | null;
507
+ registeredByEmployeeId?: string | null;
508
+ registeredByFullName?: string | null;
509
+ acknowledgedAt?: string | null;
510
+ acknowledgeError?: string | null;
511
+ returnedAt?: string | null;
512
+ returnedByEmployeeId?: string | null;
513
+ returnedByFullName?: string | null;
514
+ returnReason?: string | null;
515
+ document?: DocumentEntity | null;
516
+ documentId?: string | null;
517
+ createdAt: string;
518
+ updatedAt: string;
519
+ }
520
+ export interface IntakeSequenceEntity {
521
+ year: number;
522
+ next: number;
523
+ }
524
+ type JsonValue = string | number | boolean | {
525
+ [key in string]?: JsonValue;
526
+ } | Array<JsonValue> | null;
527
+ export {};
@@ -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.CaseFileAccessAction = exports.CaseFileTrackingAction = exports.CaseFileActorType = exports.CaseFileActorRelation = exports.CaseFileEntryKind = exports.CaseFileActuationType = exports.CaseFileIncorporationMechanism = exports.CaseFileStatus = exports.DocumentInstruction = exports.DocumentDeliveryOrigin = exports.DocumentRecipientType = exports.DocumentAttachmentType = exports.DocumentFlowStepType = exports.DocumentTrackingAction = exports.DocumentParticipantStatus = exports.DocumentParticipantRole = exports.DocumentAccessLevel = exports.DocumentStatus = exports.DocumentCategory = void 0;
4
+ exports.CaseFileAccessAction = exports.CaseFileTrackingAction = exports.CaseFileActorType = exports.CaseFileActorRelation = exports.CaseFileEntryKind = exports.CaseFileActuationType = exports.CaseFileIncorporationMechanism = exports.CaseFileStatus = exports.DocumentInstruction = exports.DocumentDeliveryOrigin = exports.DocumentRecipientType = exports.DocumentAttachmentType = exports.DocumentFlowStepType = exports.DocDigitalInboundStatus = exports.DocumentDispatchStatus = exports.DocumentOrigin = 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',
@@ -47,6 +47,23 @@ exports.DocumentTrackingAction = {
47
47
  Delivered: 'Delivered',
48
48
  Derived: 'Derived',
49
49
  Reassigned: 'Reassigned',
50
+ Dispatched: 'Dispatched',
51
+ DispatchReturned: 'DispatchReturned',
52
+ Received: 'Received',
53
+ };
54
+ exports.DocumentOrigin = {
55
+ Internal: 'Internal',
56
+ DocDigital: 'DocDigital',
57
+ };
58
+ exports.DocumentDispatchStatus = {
59
+ Pending: 'Pending',
60
+ Dispatched: 'Dispatched',
61
+ Returned: 'Returned',
62
+ };
63
+ exports.DocDigitalInboundStatus = {
64
+ Pending: 'Pending',
65
+ Registered: 'Registered',
66
+ Returned: 'Returned',
50
67
  };
51
68
  exports.DocumentFlowStepType = {
52
69
  Employee: 'Employee',
@@ -73,9 +73,15 @@ export interface DocumentWritePayload extends Pick<DocumentEntity, 'subject' | '
73
73
  recipients?: DocumentRecipientInput[];
74
74
  responseDueAt?: string | null;
75
75
  replyToDocumentId?: string | null;
76
+ externalRecipients?: DocumentExternalRecipientInput[];
76
77
  action?: 'Submit';
77
78
  actor: DocumentActor;
78
79
  }
80
+ /** Destinatario externo: una institución de DocDigital y, si se indica, uno de sus usuarios. */
81
+ export interface DocumentExternalRecipientInput {
82
+ entityId: number;
83
+ userId?: number | null;
84
+ }
79
85
  /**
80
86
  * Qué se envía y qué se responde en cada patrón. Generado desde los handlers y los DTO del microservicio.
81
87
  */
@@ -1,12 +1,14 @@
1
1
  import { type CaseFileContract } from './caseFile.contract';
2
2
  import { type DocumentContract } from './document.contract';
3
3
  import { type DocumentTypeContract } from './documentType.contract';
4
+ import { type PartsOfficeContract } from './partsOffice.contract';
4
5
  import { type ProcedureContract } from './procedure.contract';
5
6
  export * from './contract';
6
7
  export * from './document.contract';
7
8
  export * from './documentType.contract';
8
9
  export * from './procedure.contract';
9
10
  export * from './caseFile.contract';
11
+ export * from './partsOffice.contract';
10
12
  /** Patrones NATS de gestor-documental-ms, por recurso: `gestorDocumental.<recurso>.<acción>`. */
11
13
  export declare const GestorDocumentalPatterns: {
12
14
  readonly documentType: {
@@ -53,6 +55,24 @@ export declare const GestorDocumentalPatterns: {
53
55
  readonly getEntryFile: "gestorDocumental.caseFile.getEntryFile";
54
56
  readonly getExport: "gestorDocumental.caseFile.getExport";
55
57
  };
58
+ readonly partsOffice: {
59
+ readonly getStatus: "gestorDocumental.partsOffice.getStatus";
60
+ readonly getSummary: "gestorDocumental.partsOffice.getSummary";
61
+ readonly getEntities: "gestorDocumental.partsOffice.getEntities";
62
+ readonly getUsers: "gestorDocumental.partsOffice.getUsers";
63
+ readonly getDocumentTypes: "gestorDocumental.partsOffice.getDocumentTypes";
64
+ readonly getDispatches: "gestorDocumental.partsOffice.getDispatches";
65
+ readonly dispatch: "gestorDocumental.partsOffice.dispatch";
66
+ readonly returnDispatch: "gestorDocumental.partsOffice.returnDispatch";
67
+ readonly resendDispatch: "gestorDocumental.partsOffice.resendDispatch";
68
+ readonly getDispatchFile: "gestorDocumental.partsOffice.getDispatchFile";
69
+ readonly getInbound: "gestorDocumental.partsOffice.getInbound";
70
+ readonly syncInbound: "gestorDocumental.partsOffice.syncInbound";
71
+ readonly registerInbound: "gestorDocumental.partsOffice.registerInbound";
72
+ readonly acknowledgeInbound: "gestorDocumental.partsOffice.acknowledgeInbound";
73
+ readonly returnInbound: "gestorDocumental.partsOffice.returnInbound";
74
+ readonly getInboundFile: "gestorDocumental.partsOffice.getInboundFile";
75
+ };
56
76
  };
57
77
  /** Contrato completo de gestor-documental-ms: la unión de los contratos de sus recursos. */
58
- export type GestorDocumentalContract = DocumentTypeContract & DocumentContract & ProcedureContract & CaseFileContract;
78
+ export type GestorDocumentalContract = DocumentTypeContract & DocumentContract & ProcedureContract & CaseFileContract & PartsOfficeContract;
@@ -18,16 +18,19 @@ exports.GestorDocumentalPatterns = void 0;
18
18
  const caseFile_contract_1 = require("./caseFile.contract");
19
19
  const document_contract_1 = require("./document.contract");
20
20
  const documentType_contract_1 = require("./documentType.contract");
21
+ const partsOffice_contract_1 = require("./partsOffice.contract");
21
22
  const procedure_contract_1 = require("./procedure.contract");
22
23
  __exportStar(require("./contract"), exports);
23
24
  __exportStar(require("./document.contract"), exports);
24
25
  __exportStar(require("./documentType.contract"), exports);
25
26
  __exportStar(require("./procedure.contract"), exports);
26
27
  __exportStar(require("./caseFile.contract"), exports);
28
+ __exportStar(require("./partsOffice.contract"), exports);
27
29
  /** Patrones NATS de gestor-documental-ms, por recurso: `gestorDocumental.<recurso>.<acción>`. */
28
30
  exports.GestorDocumentalPatterns = {
29
31
  documentType: documentType_contract_1.DocumentTypePatterns,
30
32
  document: document_contract_1.DocumentPatterns,
31
33
  procedure: procedure_contract_1.ProcedurePatterns,
32
34
  caseFile: caseFile_contract_1.CaseFilePatterns,
35
+ partsOffice: partsOffice_contract_1.PartsOfficePatterns,
33
36
  };
@@ -0,0 +1,171 @@
1
+ import { type DocumentAccessLevel, type DocumentInstruction } from '../base/entities';
2
+ import { type DocDigitalDocumentTypeEntity, type DocDigitalEntityEntity, type PartsOfficeInboundEntity, type DocDigitalUserEntity, type PartsOfficeDispatchEntity, type PartsOfficeFileEntity, type PartsOfficeOkResponseEntity, type PartsOfficeRegisterResponseEntity, type PartsOfficeStatusEntity, type PartsOfficeSummaryEntity, type PartsOfficeSyncResponseEntity } from '../entities';
3
+ import { type RpcPage } from './contract';
4
+ import { type DocumentActor, type DocumentExternalRecipientInput } from './document.contract';
5
+ /** Patrones NATS de `partsOffice` (Oficina de Partes y DocDigital): `<servicio>.<recurso>.<acción>`. */
6
+ export declare const PartsOfficePatterns: {
7
+ readonly getStatus: "gestorDocumental.partsOffice.getStatus";
8
+ readonly getSummary: "gestorDocumental.partsOffice.getSummary";
9
+ readonly getEntities: "gestorDocumental.partsOffice.getEntities";
10
+ readonly getUsers: "gestorDocumental.partsOffice.getUsers";
11
+ readonly getDocumentTypes: "gestorDocumental.partsOffice.getDocumentTypes";
12
+ readonly getDispatches: "gestorDocumental.partsOffice.getDispatches";
13
+ readonly dispatch: "gestorDocumental.partsOffice.dispatch";
14
+ readonly returnDispatch: "gestorDocumental.partsOffice.returnDispatch";
15
+ readonly resendDispatch: "gestorDocumental.partsOffice.resendDispatch";
16
+ readonly getDispatchFile: "gestorDocumental.partsOffice.getDispatchFile";
17
+ readonly getInbound: "gestorDocumental.partsOffice.getInbound";
18
+ readonly syncInbound: "gestorDocumental.partsOffice.syncInbound";
19
+ readonly registerInbound: "gestorDocumental.partsOffice.registerInbound";
20
+ readonly acknowledgeInbound: "gestorDocumental.partsOffice.acknowledgeInbound";
21
+ readonly returnInbound: "gestorDocumental.partsOffice.returnInbound";
22
+ readonly getInboundFile: "gestorDocumental.partsOffice.getInboundFile";
23
+ };
24
+ /** Destinatario interno de un ingreso, ya resuelto por el gateway (las áreas con sus integrantes). */
25
+ export type PartsOfficeRecipientInput = {
26
+ type: 'Employee';
27
+ employeeId: string;
28
+ } | {
29
+ type: 'Directorate';
30
+ directorateCodeReference: number;
31
+ name: string;
32
+ memberEmployeeIds: string[];
33
+ } | {
34
+ type: 'Department';
35
+ departmentId: string;
36
+ name: string;
37
+ memberEmployeeIds: string[];
38
+ };
39
+ interface IListPayload<S> {
40
+ pagination?: {
41
+ page?: number;
42
+ limit?: number;
43
+ };
44
+ filters?: {
45
+ search?: string;
46
+ status?: S;
47
+ };
48
+ }
49
+ export interface PartsOfficeContract {
50
+ [PartsOfficePatterns.getStatus]: {
51
+ payload: Record<string, never>;
52
+ response: PartsOfficeStatusEntity;
53
+ };
54
+ [PartsOfficePatterns.getSummary]: {
55
+ payload: Record<string, never>;
56
+ response: PartsOfficeSummaryEntity;
57
+ };
58
+ /** Directorio de DocDigital: instituciones por nombre. */
59
+ [PartsOfficePatterns.getEntities]: {
60
+ payload: {
61
+ search?: string;
62
+ };
63
+ response: DocDigitalEntityEntity[];
64
+ };
65
+ [PartsOfficePatterns.getUsers]: {
66
+ payload: {
67
+ entityId: number;
68
+ search?: string;
69
+ };
70
+ response: DocDigitalUserEntity[];
71
+ };
72
+ [PartsOfficePatterns.getDocumentTypes]: {
73
+ payload: Record<string, never>;
74
+ response: DocDigitalDocumentTypeEntity[];
75
+ };
76
+ [PartsOfficePatterns.getDispatches]: {
77
+ payload: IListPayload<'Pending' | 'Dispatched' | 'Returned'>;
78
+ response: RpcPage<PartsOfficeDispatchEntity[]>;
79
+ };
80
+ /** Despacha por DocDigital, con el número del documento como folio. `operatorRun`: RUN de quien despacha. */
81
+ [PartsOfficePatterns.dispatch]: {
82
+ payload: {
83
+ id: string;
84
+ docDigitalTypeId: number;
85
+ operatorRun?: string | null;
86
+ actor: DocumentActor;
87
+ };
88
+ response: PartsOfficeOkResponseEntity & {
89
+ docDigitalDocumentId: string;
90
+ };
91
+ };
92
+ /** Devuelve el despacho al redactor, con el motivo (por ejemplo, un destinatario equivocado). */
93
+ [PartsOfficePatterns.returnDispatch]: {
94
+ payload: {
95
+ id: string;
96
+ reason: string;
97
+ actor: DocumentActor;
98
+ };
99
+ response: PartsOfficeOkResponseEntity;
100
+ };
101
+ /** El redactor corrige las instituciones de destino de un despacho devuelto y lo envía de nuevo a Partes. */
102
+ [PartsOfficePatterns.resendDispatch]: {
103
+ payload: {
104
+ id: string;
105
+ externalRecipients: DocumentExternalRecipientInput[];
106
+ actor: DocumentActor;
107
+ };
108
+ response: PartsOfficeOkResponseEntity;
109
+ };
110
+ /** PDF firmado de un documento por despachar, para que Oficina de Partes lo revise. */
111
+ [PartsOfficePatterns.getDispatchFile]: {
112
+ payload: {
113
+ id: string;
114
+ };
115
+ response: PartsOfficeFileEntity;
116
+ };
117
+ [PartsOfficePatterns.getInbound]: {
118
+ payload: IListPayload<'Pending' | 'Registered' | 'Returned'>;
119
+ response: RpcPage<PartsOfficeInboundEntity[]>;
120
+ };
121
+ /** Trae de DocDigital lo recibido que aún no tiene acuse de recibo. */
122
+ [PartsOfficePatterns.syncInbound]: {
123
+ payload: Record<string, never>;
124
+ response: PartsOfficeSyncResponseEntity;
125
+ };
126
+ /**
127
+ * Ingresa un recibido al gestor: le da folio de ingreso, lo deriva a quienes corresponda y da el acuse de recibo
128
+ * en DocDigital.
129
+ */
130
+ [PartsOfficePatterns.registerInbound]: {
131
+ payload: {
132
+ id: string;
133
+ documentTypeId: string;
134
+ keywords: string[];
135
+ accessLevel: DocumentAccessLevel;
136
+ hasSensitiveData: boolean;
137
+ recipients: PartsOfficeRecipientInput[];
138
+ instruction: DocumentInstruction;
139
+ note?: string | null;
140
+ dueAt?: string | null;
141
+ actor: DocumentActor;
142
+ };
143
+ response: PartsOfficeRegisterResponseEntity;
144
+ };
145
+ /** Reintenta el acuse de recibo de un recibido ya ingresado. */
146
+ [PartsOfficePatterns.acknowledgeInbound]: {
147
+ payload: {
148
+ id: string;
149
+ actor: DocumentActor;
150
+ };
151
+ response: PartsOfficeOkResponseEntity;
152
+ };
153
+ /** Devuelve el recibido a la institución que lo envió, con el motivo (entre 3 y 255 caracteres). */
154
+ [PartsOfficePatterns.returnInbound]: {
155
+ payload: {
156
+ id: string;
157
+ reason: string;
158
+ actor: DocumentActor;
159
+ };
160
+ response: PartsOfficeOkResponseEntity;
161
+ };
162
+ /** Archivo de un recibido: el principal o, con `attachment`, uno de sus anexos (por su posición). */
163
+ [PartsOfficePatterns.getInboundFile]: {
164
+ payload: {
165
+ id: string;
166
+ attachment?: number;
167
+ };
168
+ response: PartsOfficeFileEntity;
169
+ };
170
+ }
171
+ export {};
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PartsOfficePatterns = void 0;
4
+ /** Patrones NATS de `partsOffice` (Oficina de Partes y DocDigital): `<servicio>.<recurso>.<acción>`. */
5
+ exports.PartsOfficePatterns = {
6
+ getStatus: 'gestorDocumental.partsOffice.getStatus',
7
+ getSummary: 'gestorDocumental.partsOffice.getSummary',
8
+ getEntities: 'gestorDocumental.partsOffice.getEntities',
9
+ getUsers: 'gestorDocumental.partsOffice.getUsers',
10
+ getDocumentTypes: 'gestorDocumental.partsOffice.getDocumentTypes',
11
+ getDispatches: 'gestorDocumental.partsOffice.getDispatches',
12
+ dispatch: 'gestorDocumental.partsOffice.dispatch',
13
+ returnDispatch: 'gestorDocumental.partsOffice.returnDispatch',
14
+ resendDispatch: 'gestorDocumental.partsOffice.resendDispatch',
15
+ getDispatchFile: 'gestorDocumental.partsOffice.getDispatchFile',
16
+ getInbound: 'gestorDocumental.partsOffice.getInbound',
17
+ syncInbound: 'gestorDocumental.partsOffice.syncInbound',
18
+ registerInbound: 'gestorDocumental.partsOffice.registerInbound',
19
+ acknowledgeInbound: 'gestorDocumental.partsOffice.acknowledgeInbound',
20
+ returnInbound: 'gestorDocumental.partsOffice.returnInbound',
21
+ getInboundFile: 'gestorDocumental.partsOffice.getInboundFile',
22
+ };
@@ -55,6 +55,31 @@ export interface DocumentLinkEntity {
55
55
  createdByFullName: DocumentEntity['createdByFullName'];
56
56
  finishedAt: DocumentEntity['finishedAt'];
57
57
  documentType: DocumentTypeSummaryEntity;
58
+ /** Folio de ingreso de Oficina de Partes, si llegó por DocDigital. */
59
+ intakeNumber: DocumentEntity['intakeNumber'];
60
+ intakeYear: DocumentEntity['intakeYear'];
61
+ }
62
+ /** Institución (y usuario) de DocDigital a la que va dirigido un documento. */
63
+ export interface DocumentExternalRecipientResponseEntity {
64
+ id: string;
65
+ entityId: number;
66
+ entityName: string;
67
+ userId: number | null;
68
+ userName: string | null;
69
+ userPosition: string | null;
70
+ }
71
+ /** Despacho de un documento por DocDigital. */
72
+ export interface DocumentDispatchResponseEntity {
73
+ id: string;
74
+ status: 'Pending' | 'Dispatched' | 'Returned';
75
+ folio: string | null;
76
+ docDigitalTypeName: string | null;
77
+ docDigitalDocumentId: string | null;
78
+ dispatchedAt: string | null;
79
+ dispatchedByFullName: string | null;
80
+ returnedAt: string | null;
81
+ returnedByFullName: string | null;
82
+ returnReason: string | null;
58
83
  }
59
84
  export interface DocumentGetAllResponseEntity {
60
85
  id: DocumentEntity['id'];
@@ -69,6 +94,9 @@ export interface DocumentGetAllResponseEntity {
69
94
  createdByEmployeeId: DocumentEntity['createdByEmployeeId'];
70
95
  createdByFullName: DocumentEntity['createdByFullName'];
71
96
  documentType: DocumentTypeSummaryEntity;
97
+ intakeNumber: DocumentEntity['intakeNumber'];
98
+ intakeYear: DocumentEntity['intakeYear'];
99
+ origin: DocumentEntity['origin'];
72
100
  currentParticipant: Pick<DocumentParticipantResponseEntity, 'role' | 'employeeId' | 'fullName'> | null;
73
101
  distribution: {
74
102
  total: number;
@@ -123,6 +151,16 @@ export interface DocumentGetByIdResponseEntity {
123
151
  title: string;
124
152
  status: 'Open' | 'Closed';
125
153
  }[];
154
+ /** De dónde viene: del gestor o recibido por DocDigital, con su folio de ingreso y los datos de quien lo envió. */
155
+ origin: DocumentEntity['origin'];
156
+ intakeNumber: DocumentEntity['intakeNumber'];
157
+ intakeYear: DocumentEntity['intakeYear'];
158
+ externalFolio: DocumentEntity['externalFolio'];
159
+ externalSender: DocumentEntity['externalSender'];
160
+ externalDate: DocumentEntity['externalDate'];
161
+ /** Instituciones de DocDigital a quienes va dirigido, y su despacho por Oficina de Partes. */
162
+ externalRecipients: DocumentExternalRecipientResponseEntity[];
163
+ dispatch: DocumentDispatchResponseEntity | null;
126
164
  documentType: DocumentTypeSummaryEntity;
127
165
  participants: DocumentParticipantResponseEntity[];
128
166
  attachments: {
@@ -147,6 +185,8 @@ export interface DocumentGetByIdResponseEntity {
147
185
  canDerive: boolean;
148
186
  canReply: boolean;
149
187
  canReassign: boolean;
188
+ /** Quien consulta redactó el documento (o lo ingresó, si llegó por DocDigital). */
189
+ isAuthor: boolean;
150
190
  inbox: DocumentDeliveryResponseEntity[];
151
191
  };
152
192
  signatureRequiresOtp: boolean;
@@ -2,3 +2,4 @@ export * from './documentType';
2
2
  export * from './document';
3
3
  export * from './procedure';
4
4
  export * from './caseFile';
5
+ export * from './partsOffice';
@@ -18,3 +18,4 @@ __exportStar(require("./documentType"), exports);
18
18
  __exportStar(require("./document"), exports);
19
19
  __exportStar(require("./procedure"), exports);
20
20
  __exportStar(require("./caseFile"), exports);
21
+ __exportStar(require("./partsOffice"), exports);
@@ -0,0 +1 @@
1
+ export * from './partsOffice.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("./partsOffice.entity"), exports);
@@ -0,0 +1,98 @@
1
+ import { type DocumentDispatchResponseEntity, type DocumentExternalRecipientResponseEntity, type DocumentLinkEntity } from '../document';
2
+ /** Institución del Estado en DocDigital. */
3
+ export interface DocDigitalEntityEntity {
4
+ id: number;
5
+ name: string;
6
+ /** Organismo al que pertenece (la entidad padre). */
7
+ organism: string | null;
8
+ }
9
+ /** Usuario habilitado de una institución en DocDigital. */
10
+ export interface DocDigitalUserEntity {
11
+ id: number;
12
+ name: string;
13
+ position: string | null;
14
+ }
15
+ export interface DocDigitalDocumentTypeEntity {
16
+ id: number;
17
+ name: string;
18
+ }
19
+ /** Si DocDigital está configurado en el gestor y cada cuánto se revisa lo recibido. */
20
+ export interface PartsOfficeStatusEntity {
21
+ configured: boolean;
22
+ syncMinutes: number;
23
+ }
24
+ /** Totales del Panel de Partes. */
25
+ export interface PartsOfficeSummaryEntity {
26
+ toDispatch: number;
27
+ received: number;
28
+ }
29
+ /** Documento firmado que va a otras instituciones: lo despacha Oficina de Partes. */
30
+ export interface PartsOfficeDispatchEntity extends DocumentDispatchResponseEntity {
31
+ document: DocumentLinkEntity & {
32
+ accessLevel: string;
33
+ };
34
+ externalRecipients: DocumentExternalRecipientResponseEntity[];
35
+ createdAt: string;
36
+ }
37
+ /** Documento que llegó por DocDigital. */
38
+ export interface PartsOfficeInboundEntity {
39
+ id: string;
40
+ docDigitalDocumentId: string;
41
+ status: 'Pending' | 'Registered' | 'Returned';
42
+ subject: string;
43
+ description: string | null;
44
+ folio: string | null;
45
+ folioDate: string | null;
46
+ typeName: string | null;
47
+ reserved: boolean;
48
+ senderEntityName: string | null;
49
+ senderName: string | null;
50
+ senderPosition: string | null;
51
+ fileName: string | null;
52
+ hasFile: boolean;
53
+ attachments: {
54
+ name: string;
55
+ url: string | null;
56
+ hasFile: boolean;
57
+ }[];
58
+ createdAt: string;
59
+ registeredAt: string | null;
60
+ registeredByFullName: string | null;
61
+ acknowledgedAt: string | null;
62
+ acknowledgeError: string | null;
63
+ returnedAt: string | null;
64
+ returnedByFullName: string | null;
65
+ returnReason: string | null;
66
+ /** El documento con que quedó ingresado al gestor. */
67
+ document: {
68
+ id: string;
69
+ intakeNumber: number | null;
70
+ intakeYear: number | null;
71
+ } | null;
72
+ }
73
+ export interface PartsOfficeOkResponseEntity {
74
+ id: string;
75
+ ok: boolean;
76
+ /** Documento al que corresponde el despacho (al despachar o devolver). */
77
+ documentId?: string;
78
+ }
79
+ export interface PartsOfficeSyncResponseEntity {
80
+ /** Recibidos nuevos que se trajeron. */
81
+ created: number;
82
+ /** Los que no se pudieron traer (se reintentan en la próxima revisión). */
83
+ failed: number;
84
+ }
85
+ export interface PartsOfficeRegisterResponseEntity {
86
+ id: string;
87
+ documentId: string;
88
+ intakeNumber: number;
89
+ intakeYear: number;
90
+ /** `false` si DocDigital no aceptó el acuse de recibo: se puede reintentar. */
91
+ acknowledged: boolean;
92
+ ok: boolean;
93
+ }
94
+ /** Archivo de un recibido, ya copiado al gestor. */
95
+ export interface PartsOfficeFileEntity {
96
+ fileId: string;
97
+ fileName: string;
98
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@muni-sanfer/types-gestor-documental",
3
- "version": "0.0.1-beta.4",
3
+ "version": "0.0.1-beta.5",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "scripts": {
@@ -60,7 +60,10 @@ export type DocumentTrackingAction =
60
60
  | 'Annulled'
61
61
  | 'Delivered'
62
62
  | 'Derived'
63
- | 'Reassigned';
63
+ | 'Reassigned'
64
+ | 'Dispatched'
65
+ | 'DispatchReturned'
66
+ | 'Received';
64
67
 
65
68
  export const DocumentTrackingAction = {
66
69
  Created: 'Created',
@@ -77,8 +80,34 @@ export const DocumentTrackingAction = {
77
80
  Delivered: 'Delivered',
78
81
  Derived: 'Derived',
79
82
  Reassigned: 'Reassigned',
83
+ Dispatched: 'Dispatched',
84
+ DispatchReturned: 'DispatchReturned',
85
+ Received: 'Received',
80
86
  } satisfies Record<string, DocumentTrackingAction>;
81
87
 
88
+ export type DocumentOrigin = 'Internal' | 'DocDigital';
89
+
90
+ export const DocumentOrigin = {
91
+ Internal: 'Internal',
92
+ DocDigital: 'DocDigital',
93
+ } satisfies Record<string, DocumentOrigin>;
94
+
95
+ export type DocumentDispatchStatus = 'Pending' | 'Dispatched' | 'Returned';
96
+
97
+ export const DocumentDispatchStatus = {
98
+ Pending: 'Pending',
99
+ Dispatched: 'Dispatched',
100
+ Returned: 'Returned',
101
+ } satisfies Record<string, DocumentDispatchStatus>;
102
+
103
+ export type DocDigitalInboundStatus = 'Pending' | 'Registered' | 'Returned';
104
+
105
+ export const DocDigitalInboundStatus = {
106
+ Pending: 'Pending',
107
+ Registered: 'Registered',
108
+ Returned: 'Returned',
109
+ } satisfies Record<string, DocDigitalInboundStatus>;
110
+
82
111
  export type DocumentFlowStepType = 'Employee' | 'DirectorateHead';
83
112
 
84
113
  export const DocumentFlowStepType = {
@@ -246,6 +275,12 @@ export interface DocumentEntity {
246
275
  annulledAt?: string | null;
247
276
  annulmentReason?: string | null;
248
277
  responseDueAt?: string | null;
278
+ origin: DocumentOrigin;
279
+ intakeNumber?: number | null;
280
+ intakeYear?: number | null;
281
+ externalFolio?: string | null;
282
+ externalSender?: string | null;
283
+ externalDate?: string | null;
249
284
  replyTo?: DocumentEntity | null;
250
285
  replyToDocumentId?: string | null;
251
286
  replies?: DocumentEntity[];
@@ -268,6 +303,9 @@ export interface DocumentEntity {
268
303
  recipients?: DocumentRecipientEntity[];
269
304
  deliveries?: DocumentDeliveryEntity[];
270
305
  caseFileEntries?: CaseFileEntryEntity[];
306
+ externalRecipients?: DocumentExternalRecipientEntity[];
307
+ dispatch?: DocumentDispatchEntity | null;
308
+ docDigitalInbound?: DocDigitalInboundEntity | null;
271
309
  deleted: boolean;
272
310
  createdAt: string;
273
311
  updatedAt: string;
@@ -514,3 +552,76 @@ export interface CaseFileAccessEntity {
514
552
  caseFileId: string;
515
553
  createdAt: string;
516
554
  }
555
+
556
+ export interface DocumentExternalRecipientEntity {
557
+ id: string;
558
+ entityId: number;
559
+ entityName: string;
560
+ userId?: number | null;
561
+ userName?: string | null;
562
+ userPosition?: string | null;
563
+ document?: DocumentEntity;
564
+ documentId: string;
565
+ createdAt: string;
566
+ }
567
+
568
+ export interface DocumentDispatchEntity {
569
+ id: string;
570
+ status: DocumentDispatchStatus;
571
+ folio?: string | null;
572
+ docDigitalTypeId?: number | null;
573
+ docDigitalTypeName?: string | null;
574
+ docDigitalDocumentId?: string | null;
575
+ docDigitalRequestId?: string | null;
576
+ dispatchedAt?: string | null;
577
+ dispatchedByEmployeeId?: string | null;
578
+ dispatchedByFullName?: string | null;
579
+ returnedAt?: string | null;
580
+ returnedByEmployeeId?: string | null;
581
+ returnedByFullName?: string | null;
582
+ returnReason?: string | null;
583
+ document?: DocumentEntity;
584
+ documentId: string;
585
+ createdAt: string;
586
+ updatedAt: string;
587
+ }
588
+
589
+ export interface DocDigitalInboundEntity {
590
+ id: string;
591
+ docDigitalDocumentId: string;
592
+ docDigitalRequestId?: string | null;
593
+ status: DocDigitalInboundStatus;
594
+ subject: string;
595
+ description?: string | null;
596
+ folio?: string | null;
597
+ folioDate?: string | null;
598
+ typeName?: string | null;
599
+ reserved: boolean;
600
+ senderEntityId?: number | null;
601
+ senderEntityName?: string | null;
602
+ senderName?: string | null;
603
+ senderPosition?: string | null;
604
+ fileId?: string | null;
605
+ fileName?: string | null;
606
+ attachments: JsonValue;
607
+ registeredAt?: string | null;
608
+ registeredByEmployeeId?: string | null;
609
+ registeredByFullName?: string | null;
610
+ acknowledgedAt?: string | null;
611
+ acknowledgeError?: string | null;
612
+ returnedAt?: string | null;
613
+ returnedByEmployeeId?: string | null;
614
+ returnedByFullName?: string | null;
615
+ returnReason?: string | null;
616
+ document?: DocumentEntity | null;
617
+ documentId?: string | null;
618
+ createdAt: string;
619
+ updatedAt: string;
620
+ }
621
+
622
+ export interface IntakeSequenceEntity {
623
+ year: number;
624
+ next: number;
625
+ }
626
+
627
+ type JsonValue = string | number | boolean | { [key in string]?: JsonValue } | Array<JsonValue> | null;
@@ -102,10 +102,18 @@ export interface DocumentWritePayload extends Pick<DocumentEntity, 'subject' | '
102
102
  responseDueAt?: string | null;
103
103
  // Documento al que este responde.
104
104
  replyToDocumentId?: string | null;
105
+ // Instituciones (y usuarios) de DocDigital a quienes va: al terminar la firma pasa a Oficina de Partes.
106
+ externalRecipients?: DocumentExternalRecipientInput[];
105
107
  action?: 'Submit';
106
108
  actor: DocumentActor;
107
109
  }
108
110
 
111
+ /** Destinatario externo: una institución de DocDigital y, si se indica, uno de sus usuarios. */
112
+ export interface DocumentExternalRecipientInput {
113
+ entityId: number;
114
+ userId?: number | null;
115
+ }
116
+
109
117
  /**
110
118
  * Qué se envía y qué se responde en cada patrón. Generado desde los handlers y los DTO del microservicio.
111
119
  */
@@ -1,6 +1,7 @@
1
1
  import { CaseFilePatterns, type CaseFileContract } from './caseFile.contract';
2
2
  import { DocumentPatterns, type DocumentContract } from './document.contract';
3
3
  import { DocumentTypePatterns, type DocumentTypeContract } from './documentType.contract';
4
+ import { PartsOfficePatterns, type PartsOfficeContract } from './partsOffice.contract';
4
5
  import { ProcedurePatterns, type ProcedureContract } from './procedure.contract';
5
6
 
6
7
  export * from './contract';
@@ -8,6 +9,7 @@ export * from './document.contract';
8
9
  export * from './documentType.contract';
9
10
  export * from './procedure.contract';
10
11
  export * from './caseFile.contract';
12
+ export * from './partsOffice.contract';
11
13
 
12
14
  /** Patrones NATS de gestor-documental-ms, por recurso: `gestorDocumental.<recurso>.<acción>`. */
13
15
  export const GestorDocumentalPatterns = {
@@ -15,7 +17,12 @@ export const GestorDocumentalPatterns = {
15
17
  document: DocumentPatterns,
16
18
  procedure: ProcedurePatterns,
17
19
  caseFile: CaseFilePatterns,
20
+ partsOffice: PartsOfficePatterns,
18
21
  } as const;
19
22
 
20
23
  /** Contrato completo de gestor-documental-ms: la unión de los contratos de sus recursos. */
21
- export type GestorDocumentalContract = DocumentTypeContract & DocumentContract & ProcedureContract & CaseFileContract;
24
+ export type GestorDocumentalContract = DocumentTypeContract &
25
+ DocumentContract &
26
+ ProcedureContract &
27
+ CaseFileContract &
28
+ PartsOfficeContract;
@@ -0,0 +1,120 @@
1
+ import { type DocumentAccessLevel, type DocumentInstruction } from '../base/entities';
2
+ import {
3
+ type DocDigitalDocumentTypeEntity,
4
+ type DocDigitalEntityEntity,
5
+ type PartsOfficeInboundEntity,
6
+ type DocDigitalUserEntity,
7
+ type PartsOfficeDispatchEntity,
8
+ type PartsOfficeFileEntity,
9
+ type PartsOfficeOkResponseEntity,
10
+ type PartsOfficeRegisterResponseEntity,
11
+ type PartsOfficeStatusEntity,
12
+ type PartsOfficeSummaryEntity,
13
+ type PartsOfficeSyncResponseEntity,
14
+ } from '../entities';
15
+ import { type RpcPage } from './contract';
16
+ import { type DocumentActor, type DocumentExternalRecipientInput } from './document.contract';
17
+
18
+ /** Patrones NATS de `partsOffice` (Oficina de Partes y DocDigital): `<servicio>.<recurso>.<acción>`. */
19
+ export const PartsOfficePatterns = {
20
+ getStatus: 'gestorDocumental.partsOffice.getStatus',
21
+ getSummary: 'gestorDocumental.partsOffice.getSummary',
22
+ getEntities: 'gestorDocumental.partsOffice.getEntities',
23
+ getUsers: 'gestorDocumental.partsOffice.getUsers',
24
+ getDocumentTypes: 'gestorDocumental.partsOffice.getDocumentTypes',
25
+ getDispatches: 'gestorDocumental.partsOffice.getDispatches',
26
+ dispatch: 'gestorDocumental.partsOffice.dispatch',
27
+ returnDispatch: 'gestorDocumental.partsOffice.returnDispatch',
28
+ resendDispatch: 'gestorDocumental.partsOffice.resendDispatch',
29
+ getDispatchFile: 'gestorDocumental.partsOffice.getDispatchFile',
30
+ getInbound: 'gestorDocumental.partsOffice.getInbound',
31
+ syncInbound: 'gestorDocumental.partsOffice.syncInbound',
32
+ registerInbound: 'gestorDocumental.partsOffice.registerInbound',
33
+ acknowledgeInbound: 'gestorDocumental.partsOffice.acknowledgeInbound',
34
+ returnInbound: 'gestorDocumental.partsOffice.returnInbound',
35
+ getInboundFile: 'gestorDocumental.partsOffice.getInboundFile',
36
+ } as const;
37
+
38
+ /** Destinatario interno de un ingreso, ya resuelto por el gateway (las áreas con sus integrantes). */
39
+ export type PartsOfficeRecipientInput =
40
+ | { type: 'Employee'; employeeId: string }
41
+ | { type: 'Directorate'; directorateCodeReference: number; name: string; memberEmployeeIds: string[] }
42
+ | { type: 'Department'; departmentId: string; name: string; memberEmployeeIds: string[] };
43
+
44
+ interface IListPayload<S> {
45
+ pagination?: { page?: number; limit?: number };
46
+ filters?: { search?: string; status?: S };
47
+ }
48
+
49
+ export interface PartsOfficeContract {
50
+ [PartsOfficePatterns.getStatus]: { payload: Record<string, never>; response: PartsOfficeStatusEntity };
51
+ [PartsOfficePatterns.getSummary]: { payload: Record<string, never>; response: PartsOfficeSummaryEntity };
52
+ /** Directorio de DocDigital: instituciones por nombre. */
53
+ [PartsOfficePatterns.getEntities]: { payload: { search?: string }; response: DocDigitalEntityEntity[] };
54
+ [PartsOfficePatterns.getUsers]: {
55
+ payload: { entityId: number; search?: string };
56
+ response: DocDigitalUserEntity[];
57
+ };
58
+ [PartsOfficePatterns.getDocumentTypes]: { payload: Record<string, never>; response: DocDigitalDocumentTypeEntity[] };
59
+ [PartsOfficePatterns.getDispatches]: {
60
+ payload: IListPayload<'Pending' | 'Dispatched' | 'Returned'>;
61
+ response: RpcPage<PartsOfficeDispatchEntity[]>;
62
+ };
63
+ /** Despacha por DocDigital, con el número del documento como folio. `operatorRun`: RUN de quien despacha. */
64
+ [PartsOfficePatterns.dispatch]: {
65
+ payload: { id: string; docDigitalTypeId: number; operatorRun?: string | null; actor: DocumentActor };
66
+ response: PartsOfficeOkResponseEntity & { docDigitalDocumentId: string };
67
+ };
68
+ /** Devuelve el despacho al redactor, con el motivo (por ejemplo, un destinatario equivocado). */
69
+ [PartsOfficePatterns.returnDispatch]: {
70
+ payload: { id: string; reason: string; actor: DocumentActor };
71
+ response: PartsOfficeOkResponseEntity;
72
+ };
73
+ /** El redactor corrige las instituciones de destino de un despacho devuelto y lo envía de nuevo a Partes. */
74
+ [PartsOfficePatterns.resendDispatch]: {
75
+ payload: { id: string; externalRecipients: DocumentExternalRecipientInput[]; actor: DocumentActor };
76
+ response: PartsOfficeOkResponseEntity;
77
+ };
78
+ /** PDF firmado de un documento por despachar, para que Oficina de Partes lo revise. */
79
+ [PartsOfficePatterns.getDispatchFile]: { payload: { id: string }; response: PartsOfficeFileEntity };
80
+ [PartsOfficePatterns.getInbound]: {
81
+ payload: IListPayload<'Pending' | 'Registered' | 'Returned'>;
82
+ response: RpcPage<PartsOfficeInboundEntity[]>;
83
+ };
84
+ /** Trae de DocDigital lo recibido que aún no tiene acuse de recibo. */
85
+ [PartsOfficePatterns.syncInbound]: { payload: Record<string, never>; response: PartsOfficeSyncResponseEntity };
86
+ /**
87
+ * Ingresa un recibido al gestor: le da folio de ingreso, lo deriva a quienes corresponda y da el acuse de recibo
88
+ * en DocDigital.
89
+ */
90
+ [PartsOfficePatterns.registerInbound]: {
91
+ payload: {
92
+ id: string;
93
+ documentTypeId: string;
94
+ keywords: string[];
95
+ accessLevel: DocumentAccessLevel;
96
+ hasSensitiveData: boolean;
97
+ recipients: PartsOfficeRecipientInput[];
98
+ instruction: DocumentInstruction;
99
+ note?: string | null;
100
+ dueAt?: string | null;
101
+ actor: DocumentActor;
102
+ };
103
+ response: PartsOfficeRegisterResponseEntity;
104
+ };
105
+ /** Reintenta el acuse de recibo de un recibido ya ingresado. */
106
+ [PartsOfficePatterns.acknowledgeInbound]: {
107
+ payload: { id: string; actor: DocumentActor };
108
+ response: PartsOfficeOkResponseEntity;
109
+ };
110
+ /** Devuelve el recibido a la institución que lo envió, con el motivo (entre 3 y 255 caracteres). */
111
+ [PartsOfficePatterns.returnInbound]: {
112
+ payload: { id: string; reason: string; actor: DocumentActor };
113
+ response: PartsOfficeOkResponseEntity;
114
+ };
115
+ /** Archivo de un recibido: el principal o, con `attachment`, uno de sus anexos (por su posición). */
116
+ [PartsOfficePatterns.getInboundFile]: {
117
+ payload: { id: string; attachment?: number };
118
+ response: PartsOfficeFileEntity;
119
+ };
120
+ }
@@ -72,6 +72,33 @@ export interface DocumentLinkEntity {
72
72
  createdByFullName: DocumentEntity['createdByFullName'];
73
73
  finishedAt: DocumentEntity['finishedAt'];
74
74
  documentType: DocumentTypeSummaryEntity;
75
+ /** Folio de ingreso de Oficina de Partes, si llegó por DocDigital. */
76
+ intakeNumber: DocumentEntity['intakeNumber'];
77
+ intakeYear: DocumentEntity['intakeYear'];
78
+ }
79
+
80
+ /** Institución (y usuario) de DocDigital a la que va dirigido un documento. */
81
+ export interface DocumentExternalRecipientResponseEntity {
82
+ id: string;
83
+ entityId: number;
84
+ entityName: string;
85
+ userId: number | null;
86
+ userName: string | null;
87
+ userPosition: string | null;
88
+ }
89
+
90
+ /** Despacho de un documento por DocDigital. */
91
+ export interface DocumentDispatchResponseEntity {
92
+ id: string;
93
+ status: 'Pending' | 'Dispatched' | 'Returned';
94
+ folio: string | null;
95
+ docDigitalTypeName: string | null;
96
+ docDigitalDocumentId: string | null;
97
+ dispatchedAt: string | null;
98
+ dispatchedByFullName: string | null;
99
+ returnedAt: string | null;
100
+ returnedByFullName: string | null;
101
+ returnReason: string | null;
75
102
  }
76
103
 
77
104
  export interface DocumentGetAllResponseEntity {
@@ -87,6 +114,9 @@ export interface DocumentGetAllResponseEntity {
87
114
  createdByEmployeeId: DocumentEntity['createdByEmployeeId'];
88
115
  createdByFullName: DocumentEntity['createdByFullName'];
89
116
  documentType: DocumentTypeSummaryEntity;
117
+ intakeNumber: DocumentEntity['intakeNumber'];
118
+ intakeYear: DocumentEntity['intakeYear'];
119
+ origin: DocumentEntity['origin'];
90
120
  // A quién le toca visar o firmar (null si el documento no está en tramitación).
91
121
  currentParticipant: Pick<DocumentParticipantResponseEntity, 'role' | 'employeeId' | 'fullName'> | null;
92
122
  // A cuántos funcionarios llegó y cuántos ya lo abrieron (null si aún no se distribuye a nadie).
@@ -147,6 +177,16 @@ export interface DocumentGetByIdResponseEntity {
147
177
  replies: DocumentLinkEntity[];
148
178
  /** Expedientes en que está incorporado y que quien consulta puede ver. */
149
179
  caseFiles: { id: string; code: string; title: string; status: 'Open' | 'Closed' }[];
180
+ /** De dónde viene: del gestor o recibido por DocDigital, con su folio de ingreso y los datos de quien lo envió. */
181
+ origin: DocumentEntity['origin'];
182
+ intakeNumber: DocumentEntity['intakeNumber'];
183
+ intakeYear: DocumentEntity['intakeYear'];
184
+ externalFolio: DocumentEntity['externalFolio'];
185
+ externalSender: DocumentEntity['externalSender'];
186
+ externalDate: DocumentEntity['externalDate'];
187
+ /** Instituciones de DocDigital a quienes va dirigido, y su despacho por Oficina de Partes. */
188
+ externalRecipients: DocumentExternalRecipientResponseEntity[];
189
+ dispatch: DocumentDispatchResponseEntity | null;
150
190
  documentType: DocumentTypeSummaryEntity;
151
191
  participants: DocumentParticipantResponseEntity[];
152
192
  attachments: {
@@ -175,6 +215,8 @@ export interface DocumentGetByIdResponseEntity {
175
215
  canReply: boolean;
176
216
  // Es quien redactó un documento en tramitación: puede pasar un turno pendiente a otro funcionario.
177
217
  canReassign: boolean;
218
+ /** Quien consulta redactó el documento (o lo ingresó, si llegó por DocDigital). */
219
+ isAuthor: boolean;
178
220
  // Sus propias entregas de este documento (puede tener más de una si además se lo derivaron).
179
221
  inbox: DocumentDeliveryResponseEntity[];
180
222
  };
@@ -2,3 +2,4 @@ export * from './documentType';
2
2
  export * from './document';
3
3
  export * from './procedure';
4
4
  export * from './caseFile';
5
+ export * from './partsOffice';
@@ -0,0 +1 @@
1
+ export * from './partsOffice.entity';
@@ -0,0 +1,103 @@
1
+ import {
2
+ type DocumentDispatchResponseEntity,
3
+ type DocumentExternalRecipientResponseEntity,
4
+ type DocumentLinkEntity,
5
+ } from '../document';
6
+
7
+ /** Institución del Estado en DocDigital. */
8
+ export interface DocDigitalEntityEntity {
9
+ id: number;
10
+ name: string;
11
+ /** Organismo al que pertenece (la entidad padre). */
12
+ organism: string | null;
13
+ }
14
+
15
+ /** Usuario habilitado de una institución en DocDigital. */
16
+ export interface DocDigitalUserEntity {
17
+ id: number;
18
+ name: string;
19
+ position: string | null;
20
+ }
21
+
22
+ export interface DocDigitalDocumentTypeEntity {
23
+ id: number;
24
+ name: string;
25
+ }
26
+
27
+ /** Si DocDigital está configurado en el gestor y cada cuánto se revisa lo recibido. */
28
+ export interface PartsOfficeStatusEntity {
29
+ configured: boolean;
30
+ syncMinutes: number;
31
+ }
32
+
33
+ /** Totales del Panel de Partes. */
34
+ export interface PartsOfficeSummaryEntity {
35
+ toDispatch: number;
36
+ received: number;
37
+ }
38
+
39
+ /** Documento firmado que va a otras instituciones: lo despacha Oficina de Partes. */
40
+ export interface PartsOfficeDispatchEntity extends DocumentDispatchResponseEntity {
41
+ document: DocumentLinkEntity & { accessLevel: string };
42
+ externalRecipients: DocumentExternalRecipientResponseEntity[];
43
+ createdAt: string;
44
+ }
45
+
46
+ /** Documento que llegó por DocDigital. */
47
+ export interface PartsOfficeInboundEntity {
48
+ id: string;
49
+ docDigitalDocumentId: string;
50
+ status: 'Pending' | 'Registered' | 'Returned';
51
+ subject: string;
52
+ description: string | null;
53
+ folio: string | null;
54
+ folioDate: string | null;
55
+ typeName: string | null;
56
+ reserved: boolean;
57
+ senderEntityName: string | null;
58
+ senderName: string | null;
59
+ senderPosition: string | null;
60
+ fileName: string | null;
61
+ hasFile: boolean;
62
+ attachments: { name: string; url: string | null; hasFile: boolean }[];
63
+ createdAt: string;
64
+ registeredAt: string | null;
65
+ registeredByFullName: string | null;
66
+ acknowledgedAt: string | null;
67
+ acknowledgeError: string | null;
68
+ returnedAt: string | null;
69
+ returnedByFullName: string | null;
70
+ returnReason: string | null;
71
+ /** El documento con que quedó ingresado al gestor. */
72
+ document: { id: string; intakeNumber: number | null; intakeYear: number | null } | null;
73
+ }
74
+
75
+ export interface PartsOfficeOkResponseEntity {
76
+ id: string;
77
+ ok: boolean;
78
+ /** Documento al que corresponde el despacho (al despachar o devolver). */
79
+ documentId?: string;
80
+ }
81
+
82
+ export interface PartsOfficeSyncResponseEntity {
83
+ /** Recibidos nuevos que se trajeron. */
84
+ created: number;
85
+ /** Los que no se pudieron traer (se reintentan en la próxima revisión). */
86
+ failed: number;
87
+ }
88
+
89
+ export interface PartsOfficeRegisterResponseEntity {
90
+ id: string;
91
+ documentId: string;
92
+ intakeNumber: number;
93
+ intakeYear: number;
94
+ /** `false` si DocDigital no aceptó el acuse de recibo: se puede reintentar. */
95
+ acknowledged: boolean;
96
+ ok: boolean;
97
+ }
98
+
99
+ /** Archivo de un recibido, ya copiado al gestor. */
100
+ export interface PartsOfficeFileEntity {
101
+ fileId: string;
102
+ fileName: string;
103
+ }