@hed-hog/operations 0.0.300 → 0.0.302
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/operations.controller.d.ts +713 -31
- package/dist/operations.controller.d.ts.map +1 -1
- package/dist/operations.controller.js +157 -0
- package/dist/operations.controller.js.map +1 -1
- package/dist/operations.module.d.ts.map +1 -1
- package/dist/operations.module.js +5 -1
- package/dist/operations.module.js.map +1 -1
- package/dist/operations.proposal.subscriber.d.ts +11 -0
- package/dist/operations.proposal.subscriber.d.ts.map +1 -0
- package/dist/operations.proposal.subscriber.js +80 -0
- package/dist/operations.proposal.subscriber.js.map +1 -0
- package/dist/operations.proposal.subscriber.spec.d.ts +2 -0
- package/dist/operations.proposal.subscriber.spec.d.ts.map +1 -0
- package/dist/operations.proposal.subscriber.spec.js +88 -0
- package/dist/operations.proposal.subscriber.spec.js.map +1 -0
- package/dist/operations.service.d.ts +491 -46
- package/dist/operations.service.d.ts.map +1 -1
- package/dist/operations.service.js +2484 -121
- package/dist/operations.service.js.map +1 -1
- package/dist/operations.service.spec.d.ts +2 -0
- package/dist/operations.service.spec.d.ts.map +1 -0
- package/dist/operations.service.spec.js +159 -0
- package/dist/operations.service.spec.js.map +1 -0
- package/hedhog/data/menu.yaml +35 -22
- package/hedhog/data/role_route.yaml +39 -0
- package/hedhog/data/route.yaml +130 -0
- package/hedhog/frontend/app/_components/collaborator-details-screen.tsx.ejs +8 -6
- package/hedhog/frontend/app/_components/collaborator-form-screen.tsx.ejs +1163 -327
- package/hedhog/frontend/app/_components/collaborator-select-with-create.tsx.ejs +256 -0
- package/hedhog/frontend/app/_components/contract-content-editor.tsx.ejs +258 -0
- package/hedhog/frontend/app/_components/contract-creation-wizard.tsx.ejs +631 -0
- package/hedhog/frontend/app/_components/contract-details-screen.tsx.ejs +353 -27
- package/hedhog/frontend/app/_components/contract-form-screen.tsx.ejs +1926 -87
- package/hedhog/frontend/app/_components/contract-template-form-screen.tsx.ejs +526 -0
- package/hedhog/frontend/app/_components/contract-template-select-with-create.tsx.ejs +247 -0
- package/hedhog/frontend/app/_components/contract-wizard-sheet.tsx.ejs +3520 -0
- package/hedhog/frontend/app/_components/department-select-with-create.tsx.ejs +370 -0
- package/hedhog/frontend/app/_components/person-select-with-create.tsx.ejs +826 -0
- package/hedhog/frontend/app/_components/project-form-screen.tsx.ejs +1251 -364
- package/hedhog/frontend/app/_components/section-card.tsx.ejs +48 -13
- package/hedhog/frontend/app/_lib/api.ts.ejs +2 -5
- package/hedhog/frontend/app/_lib/types.ts.ejs +76 -33
- package/hedhog/frontend/app/_lib/utils/format.ts.ejs +85 -8
- package/hedhog/frontend/app/approvals/page.tsx.ejs +90 -54
- package/hedhog/frontend/app/collaborators/[id]/edit/page.tsx.ejs +2 -2
- package/hedhog/frontend/app/collaborators/[id]/page.tsx.ejs +2 -2
- package/hedhog/frontend/app/collaborators/page.tsx.ejs +597 -140
- package/hedhog/frontend/app/contracts/[id]/edit/page.tsx.ejs +2 -2
- package/hedhog/frontend/app/contracts/[id]/page.tsx.ejs +2 -2
- package/hedhog/frontend/app/contracts/page.tsx.ejs +941 -262
- package/hedhog/frontend/app/contracts/templates/page.tsx.ejs +384 -0
- package/hedhog/frontend/app/departments/page.tsx.ejs +442 -0
- package/hedhog/frontend/app/page.tsx.ejs +3 -317
- package/hedhog/frontend/app/projects/[id]/edit/page.tsx.ejs +2 -2
- package/hedhog/frontend/app/projects/new/page.tsx.ejs +2 -2
- package/hedhog/frontend/app/projects/page.tsx.ejs +264 -102
- package/hedhog/frontend/app/schedule-adjustments/page.tsx.ejs +50 -28
- package/hedhog/frontend/app/time-off/page.tsx.ejs +57 -31
- package/hedhog/frontend/app/timesheets/page.tsx.ejs +85 -42
- package/hedhog/frontend/messages/en.json +473 -12
- package/hedhog/frontend/messages/pt.json +528 -66
- package/hedhog/table/operations_collaborator.yaml +20 -0
- package/hedhog/table/operations_contract.yaml +22 -1
- package/hedhog/table/operations_contract_document.yaml +33 -16
- package/hedhog/table/operations_contract_template.yaml +58 -0
- package/hedhog/table/operations_department.yaml +24 -0
- package/package.json +7 -5
- package/src/operations.controller.ts +122 -0
- package/src/operations.module.ts +6 -2
- package/src/operations.proposal.subscriber.spec.ts +121 -0
- package/src/operations.proposal.subscriber.ts +86 -0
- package/src/operations.service.spec.ts +210 -0
- package/src/operations.service.ts +4026 -241
|
@@ -1,11 +1,22 @@
|
|
|
1
1
|
import { PrismaService } from '@hed-hog/api-prisma';
|
|
2
|
-
import { IntegrationDeveloperApiService } from '@hed-hog/core';
|
|
2
|
+
import { AiService, FileService, IntegrationDeveloperApiService, SettingService } from '@hed-hog/core';
|
|
3
|
+
declare const CONTRACT_CATEGORY_VALUES: readonly ["employee", "contractor", "client", "supplier", "vendor", "partner", "internal", "other"];
|
|
4
|
+
declare const CONTRACT_TYPE_VALUES: readonly ["clt", "pj", "freelancer_agreement", "service_agreement", "fixed_term", "recurring_service", "nda", "amendment", "addendum", "other"];
|
|
5
|
+
declare const BILLING_MODEL_VALUES: readonly ["time_and_material", "monthly_retainer", "fixed_price"];
|
|
6
|
+
declare const SIGNATURE_STATUS_VALUES: readonly ["not_started", "pending", "partially_signed", "signed", "expired"];
|
|
7
|
+
declare const CONTRACT_STATUS_VALUES: readonly ["draft", "under_review", "active", "renewal", "expired", "closed", "archived"];
|
|
8
|
+
declare const CONTRACT_CREATION_MODE_VALUES: readonly ["blank", "template", "upload", "duplicate"];
|
|
9
|
+
declare const ORIGIN_TYPE_VALUES: readonly ["manual", "employee_hiring", "client_project", "crm_proposal"];
|
|
10
|
+
declare const CONTRACT_DOCUMENT_TYPE_VALUES: readonly ["source_upload", "generated_pdf", "attachment", "other"];
|
|
11
|
+
declare const CONTRACT_DOCUMENT_EXTRACTION_STATUS_VALUES: readonly ["pending", "processing", "completed", "failed", "skipped"];
|
|
3
12
|
type CollaboratorPayload = {
|
|
4
|
-
userId
|
|
5
|
-
|
|
6
|
-
|
|
13
|
+
userId?: number | null;
|
|
14
|
+
personId?: number | null;
|
|
15
|
+
code?: string | null;
|
|
16
|
+
displayName?: string | null;
|
|
7
17
|
collaboratorType?: 'clt' | 'pj' | 'freelancer' | 'intern' | 'other';
|
|
8
18
|
department?: string | null;
|
|
19
|
+
departmentId?: number | null;
|
|
9
20
|
title?: string | null;
|
|
10
21
|
levelLabel?: string | null;
|
|
11
22
|
supervisorCollaboratorId?: number | null;
|
|
@@ -25,10 +36,16 @@ type CollaboratorPayload = {
|
|
|
25
36
|
}>;
|
|
26
37
|
notes?: string | null;
|
|
27
38
|
};
|
|
39
|
+
type DepartmentPayload = {
|
|
40
|
+
code?: string | null;
|
|
41
|
+
name?: string | null;
|
|
42
|
+
description?: string | null;
|
|
43
|
+
status?: 'active' | 'inactive';
|
|
44
|
+
};
|
|
28
45
|
type ContractPayload = {
|
|
29
|
-
code
|
|
30
|
-
name
|
|
31
|
-
clientName
|
|
46
|
+
code?: string | null;
|
|
47
|
+
name?: string | null;
|
|
48
|
+
clientName?: string | null;
|
|
32
49
|
contractCategory?: 'employee' | 'contractor' | 'client' | 'supplier' | 'vendor' | 'partner' | 'internal' | 'other';
|
|
33
50
|
contractType?: 'clt' | 'pj' | 'freelancer_agreement' | 'service_agreement' | 'fixed_term' | 'recurring_service' | 'nda' | 'amendment' | 'addendum' | 'other';
|
|
34
51
|
billingModel?: 'time_and_material' | 'monthly_retainer' | 'fixed_price';
|
|
@@ -36,15 +53,18 @@ type ContractPayload = {
|
|
|
36
53
|
isActive?: boolean;
|
|
37
54
|
accountManagerCollaboratorId?: number | null;
|
|
38
55
|
relatedCollaboratorId?: number | null;
|
|
39
|
-
|
|
56
|
+
contractTemplateId?: number | null;
|
|
57
|
+
originType?: 'manual' | 'employee_hiring' | 'client_project' | 'crm_proposal';
|
|
40
58
|
originId?: number | null;
|
|
41
|
-
startDate
|
|
59
|
+
startDate?: string | null;
|
|
42
60
|
endDate?: string | null;
|
|
43
61
|
signedAt?: string | null;
|
|
44
62
|
effectiveDate?: string | null;
|
|
45
63
|
budgetAmount?: number | null;
|
|
46
64
|
monthlyHourCap?: number | null;
|
|
47
65
|
status?: 'draft' | 'under_review' | 'active' | 'renewal' | 'expired' | 'closed' | 'archived';
|
|
66
|
+
creationMode?: 'blank' | 'template' | 'upload' | 'duplicate';
|
|
67
|
+
wizardStep?: number | null;
|
|
48
68
|
description?: string | null;
|
|
49
69
|
contentHtml?: string | null;
|
|
50
70
|
parties?: Array<{
|
|
@@ -79,14 +99,206 @@ type ContractPayload = {
|
|
|
79
99
|
summary?: string | null;
|
|
80
100
|
}>;
|
|
81
101
|
replaceUploadedPdfDocument?: {
|
|
102
|
+
fileId?: number | null;
|
|
82
103
|
fileName: string;
|
|
83
104
|
mimeType: string;
|
|
84
|
-
fileContentBase64
|
|
105
|
+
fileContentBase64?: string | null;
|
|
106
|
+
notes?: string | null;
|
|
107
|
+
extractionStatus?: 'pending' | 'processing' | 'completed' | 'failed' | 'skipped';
|
|
108
|
+
extractionSummary?: string | null;
|
|
109
|
+
} | null;
|
|
110
|
+
};
|
|
111
|
+
type ContractDraftPayload = {
|
|
112
|
+
creationMode?: 'blank' | 'template' | 'upload' | 'duplicate' | null;
|
|
113
|
+
templateId?: number | null;
|
|
114
|
+
duplicateFromId?: number | null;
|
|
115
|
+
sourceFileId?: number | null;
|
|
116
|
+
sourceFileName?: string | null;
|
|
117
|
+
sourceMimeType?: string | null;
|
|
118
|
+
};
|
|
119
|
+
type ProposalApprovedEventPayload = {
|
|
120
|
+
proposalId?: number;
|
|
121
|
+
proposalRevisionId?: number | null;
|
|
122
|
+
personId?: number | null;
|
|
123
|
+
approvedByUserId?: number | null;
|
|
124
|
+
approvedAt?: string | null;
|
|
125
|
+
correlationId?: string | null;
|
|
126
|
+
sourceModule?: string | null;
|
|
127
|
+
sourceEntity?: string | null;
|
|
128
|
+
sourceId?: string | null;
|
|
129
|
+
source_module?: string | null;
|
|
130
|
+
source_entity?: string | null;
|
|
131
|
+
source_id?: string | null;
|
|
132
|
+
code?: string | null;
|
|
133
|
+
title?: string | null;
|
|
134
|
+
version?: number | null;
|
|
135
|
+
total?: number | null;
|
|
136
|
+
currency?: string | null;
|
|
137
|
+
locale?: string | null;
|
|
138
|
+
validFrom?: string | null;
|
|
139
|
+
validUntil?: string | null;
|
|
140
|
+
commercialTerms?: {
|
|
141
|
+
contractCategory?: ContractPayload['contractCategory'];
|
|
142
|
+
contractType?: ContractPayload['contractType'];
|
|
143
|
+
billingModel?: ContractPayload['billingModel'];
|
|
144
|
+
validFrom?: string | null;
|
|
145
|
+
validUntil?: string | null;
|
|
146
|
+
notes?: string | null;
|
|
147
|
+
} | null;
|
|
148
|
+
proposal?: {
|
|
149
|
+
code?: string | null;
|
|
150
|
+
title?: string | null;
|
|
151
|
+
contractCategory?: ContractPayload['contractCategory'];
|
|
152
|
+
contractType?: ContractPayload['contractType'];
|
|
153
|
+
billingModel?: ContractPayload['billingModel'];
|
|
154
|
+
validFrom?: string | null;
|
|
155
|
+
validUntil?: string | null;
|
|
156
|
+
totalAmount?: number | null;
|
|
157
|
+
totalAmountCents?: number | null;
|
|
85
158
|
notes?: string | null;
|
|
159
|
+
};
|
|
160
|
+
person?: {
|
|
161
|
+
id?: number | null;
|
|
162
|
+
name?: string | null;
|
|
163
|
+
tradeName?: string | null;
|
|
164
|
+
email?: string | null;
|
|
165
|
+
phone?: string | null;
|
|
166
|
+
document?: string | null;
|
|
86
167
|
} | null;
|
|
168
|
+
revision?: {
|
|
169
|
+
id?: number | null;
|
|
170
|
+
revisionNumber?: number | null;
|
|
171
|
+
title?: string | null;
|
|
172
|
+
summary?: string | null;
|
|
173
|
+
contentHtml?: string | null;
|
|
174
|
+
} | null;
|
|
175
|
+
items?: Array<{
|
|
176
|
+
name?: string | null;
|
|
177
|
+
description?: string | null;
|
|
178
|
+
termType?: ContractPayload['financialTerms'][number]['termType'];
|
|
179
|
+
recurrence?: ContractPayload['financialTerms'][number]['recurrence'];
|
|
180
|
+
dueDay?: number | null;
|
|
181
|
+
amount?: number | null;
|
|
182
|
+
totalAmountCents?: number | null;
|
|
183
|
+
}>;
|
|
184
|
+
};
|
|
185
|
+
type ContractTemplatePayload = {
|
|
186
|
+
code?: string | null;
|
|
187
|
+
name?: string | null;
|
|
188
|
+
description?: string | null;
|
|
189
|
+
contractCategory?: 'employee' | 'contractor' | 'client' | 'supplier' | 'vendor' | 'partner' | 'internal' | 'other';
|
|
190
|
+
contractType?: 'clt' | 'pj' | 'freelancer_agreement' | 'service_agreement' | 'fixed_term' | 'recurring_service' | 'nda' | 'amendment' | 'addendum' | 'other';
|
|
191
|
+
billingModel?: 'time_and_material' | 'monthly_retainer' | 'fixed_price';
|
|
192
|
+
signatureStatus?: 'not_started' | 'pending' | 'partially_signed' | 'signed' | 'expired';
|
|
193
|
+
isActive?: boolean;
|
|
194
|
+
status?: 'draft' | 'active' | 'inactive' | 'archived';
|
|
195
|
+
contentHtml?: string | null;
|
|
196
|
+
};
|
|
197
|
+
type ContractExtractDraftPayload = {
|
|
198
|
+
contractId?: number | null;
|
|
199
|
+
fileName?: string | null;
|
|
200
|
+
mimeType?: string | null;
|
|
201
|
+
fileContentBase64?: string | null;
|
|
202
|
+
provider?: 'openai' | 'gemini' | null;
|
|
203
|
+
promptMessage?: string | null;
|
|
204
|
+
};
|
|
205
|
+
type ContractGenerateContentPayload = {
|
|
206
|
+
provider?: 'openai' | 'gemini' | null;
|
|
207
|
+
promptMessage?: string | null;
|
|
208
|
+
overwrite?: boolean;
|
|
209
|
+
};
|
|
210
|
+
type ContractLegalReviewPayload = {
|
|
211
|
+
provider?: 'openai' | 'gemini' | null;
|
|
212
|
+
promptMessage?: string | null;
|
|
213
|
+
};
|
|
214
|
+
type ContractLegalReviewResult = {
|
|
215
|
+
summary: string;
|
|
216
|
+
missingFields: string[];
|
|
217
|
+
warnings: string[];
|
|
218
|
+
checklist: string[];
|
|
219
|
+
status: 'ready_for_revision' | 'attention_required';
|
|
220
|
+
reviewedAt: string;
|
|
221
|
+
};
|
|
222
|
+
type ContractProjectSummary = {
|
|
223
|
+
id: number;
|
|
224
|
+
code: string;
|
|
225
|
+
name: string;
|
|
226
|
+
status: string;
|
|
227
|
+
};
|
|
228
|
+
type ContractScheduleDay = {
|
|
229
|
+
weekday: string;
|
|
230
|
+
isWorkingDay: boolean;
|
|
231
|
+
startTime: string | null;
|
|
232
|
+
endTime: string | null;
|
|
233
|
+
breakMinutes: number | null;
|
|
234
|
+
};
|
|
235
|
+
type ContractDocumentRecord = {
|
|
236
|
+
id: number;
|
|
237
|
+
documentType: (typeof CONTRACT_DOCUMENT_TYPE_VALUES)[number];
|
|
238
|
+
fileId: number | null;
|
|
239
|
+
fileName: string;
|
|
240
|
+
mimeType: string;
|
|
241
|
+
fileContentBase64: string | null;
|
|
242
|
+
isCurrent: boolean;
|
|
243
|
+
extractionStatus: (typeof CONTRACT_DOCUMENT_EXTRACTION_STATUS_VALUES)[number] | null;
|
|
244
|
+
extractionSummary: string | null;
|
|
245
|
+
notes: string | null;
|
|
246
|
+
createdAt: string;
|
|
247
|
+
};
|
|
248
|
+
type ContractHistoryRecord = {
|
|
249
|
+
id: number;
|
|
250
|
+
actorUserId: number | null;
|
|
251
|
+
action: string;
|
|
252
|
+
note: string | null;
|
|
253
|
+
metadataJson: string | null;
|
|
254
|
+
createdAt: string;
|
|
255
|
+
};
|
|
256
|
+
type ContractDetailRecord = {
|
|
257
|
+
id: number;
|
|
258
|
+
code: string;
|
|
259
|
+
name: string | null;
|
|
260
|
+
contractCategory: (typeof CONTRACT_CATEGORY_VALUES)[number];
|
|
261
|
+
contractType: (typeof CONTRACT_TYPE_VALUES)[number];
|
|
262
|
+
clientName: string | null;
|
|
263
|
+
signatureStatus: (typeof SIGNATURE_STATUS_VALUES)[number];
|
|
264
|
+
isActive: boolean;
|
|
265
|
+
billingModel: (typeof BILLING_MODEL_VALUES)[number];
|
|
266
|
+
accountManagerCollaboratorId: number | null;
|
|
267
|
+
relatedCollaboratorId: number | null;
|
|
268
|
+
contractTemplateId: number | null;
|
|
269
|
+
contractTemplateName: string | null;
|
|
270
|
+
contractTemplateSlug: string | null;
|
|
271
|
+
contractTemplateCode: string | null;
|
|
272
|
+
originType: (typeof ORIGIN_TYPE_VALUES)[number];
|
|
273
|
+
originId: number | null;
|
|
274
|
+
startDate: string | null;
|
|
275
|
+
endDate: string | null;
|
|
276
|
+
signedAt: string | null;
|
|
277
|
+
effectiveDate: string | null;
|
|
278
|
+
budgetAmount: number | null;
|
|
279
|
+
monthlyHourCap: number | null;
|
|
280
|
+
status: (typeof CONTRACT_STATUS_VALUES)[number];
|
|
281
|
+
creationMode: (typeof CONTRACT_CREATION_MODE_VALUES)[number] | null;
|
|
282
|
+
wizardStep: number | null;
|
|
283
|
+
description: string | null;
|
|
284
|
+
contentHtml: string | null;
|
|
285
|
+
accountManagerName: string | null;
|
|
286
|
+
relatedCollaboratorName: string | null;
|
|
287
|
+
};
|
|
288
|
+
type ContractDetailsRecord = ContractDetailRecord & {
|
|
289
|
+
mainRelatedPartyName: string | null;
|
|
290
|
+
projects: ContractProjectSummary[];
|
|
291
|
+
scheduleSummary: ContractScheduleDay[];
|
|
292
|
+
parties: NonNullable<ContractPayload['parties']>;
|
|
293
|
+
signatures: NonNullable<ContractPayload['signatures']>;
|
|
294
|
+
financialTerms: NonNullable<ContractPayload['financialTerms']>;
|
|
295
|
+
documents: ContractDocumentRecord[];
|
|
296
|
+
revisions: NonNullable<ContractPayload['revisions']>;
|
|
297
|
+
history: ContractHistoryRecord[];
|
|
87
298
|
};
|
|
88
299
|
type ProjectPayload = {
|
|
89
300
|
contractId?: number | null;
|
|
301
|
+
contractTemplateId?: number | null;
|
|
90
302
|
managerCollaboratorId?: number | null;
|
|
91
303
|
code: string;
|
|
92
304
|
name: string;
|
|
@@ -170,8 +382,12 @@ type PublishAccountsPayableReferencePayload = {
|
|
|
170
382
|
};
|
|
171
383
|
export declare class OperationsService {
|
|
172
384
|
private readonly prisma;
|
|
385
|
+
private readonly aiService;
|
|
173
386
|
private readonly integrationApi;
|
|
174
|
-
|
|
387
|
+
private readonly fileService;
|
|
388
|
+
private readonly settingService;
|
|
389
|
+
private readonly logger;
|
|
390
|
+
constructor(prisma: PrismaService, aiService: AiService, integrationApi: IntegrationDeveloperApiService, fileService: FileService, settingService: SettingService);
|
|
175
391
|
getDashboard(userId: number): Promise<{
|
|
176
392
|
actor: {
|
|
177
393
|
roleScope: string;
|
|
@@ -214,10 +430,14 @@ export declare class OperationsService {
|
|
|
214
430
|
};
|
|
215
431
|
scheduleAdjustmentRequests: Record<string, unknown>[];
|
|
216
432
|
id: number;
|
|
217
|
-
userId: number;
|
|
433
|
+
userId: number | null;
|
|
434
|
+
personId: number | null;
|
|
435
|
+
personName: string | null;
|
|
436
|
+
personAvatarId: number | null;
|
|
218
437
|
code: string;
|
|
219
438
|
collaboratorType: string;
|
|
220
439
|
displayName: string;
|
|
440
|
+
departmentId: number | null;
|
|
221
441
|
department: string | null;
|
|
222
442
|
title: string | null;
|
|
223
443
|
levelLabel: string | null;
|
|
@@ -248,10 +468,14 @@ export declare class OperationsService {
|
|
|
248
468
|
};
|
|
249
469
|
scheduleAdjustmentRequests: Record<string, unknown>[];
|
|
250
470
|
id: number;
|
|
251
|
-
userId: number;
|
|
471
|
+
userId: number | null;
|
|
472
|
+
personId: number | null;
|
|
473
|
+
personName: string | null;
|
|
474
|
+
personAvatarId: number | null;
|
|
252
475
|
code: string;
|
|
253
476
|
collaboratorType: string;
|
|
254
477
|
displayName: string;
|
|
478
|
+
departmentId: number | null;
|
|
255
479
|
department: string | null;
|
|
256
480
|
title: string | null;
|
|
257
481
|
levelLabel: string | null;
|
|
@@ -296,10 +520,14 @@ export declare class OperationsService {
|
|
|
296
520
|
};
|
|
297
521
|
scheduleAdjustmentRequests: Record<string, unknown>[];
|
|
298
522
|
id: number;
|
|
299
|
-
userId: number;
|
|
523
|
+
userId: number | null;
|
|
524
|
+
personId: number | null;
|
|
525
|
+
personName: string | null;
|
|
526
|
+
personAvatarId: number | null;
|
|
300
527
|
code: string;
|
|
301
528
|
collaboratorType: string;
|
|
302
529
|
displayName: string;
|
|
530
|
+
departmentId: number | null;
|
|
303
531
|
department: string | null;
|
|
304
532
|
title: string | null;
|
|
305
533
|
levelLabel: string | null;
|
|
@@ -330,10 +558,14 @@ export declare class OperationsService {
|
|
|
330
558
|
};
|
|
331
559
|
scheduleAdjustmentRequests: Record<string, unknown>[];
|
|
332
560
|
id: number;
|
|
333
|
-
userId: number;
|
|
561
|
+
userId: number | null;
|
|
562
|
+
personId: number | null;
|
|
563
|
+
personName: string | null;
|
|
564
|
+
personAvatarId: number | null;
|
|
334
565
|
code: string;
|
|
335
566
|
collaboratorType: string;
|
|
336
567
|
displayName: string;
|
|
568
|
+
departmentId: number | null;
|
|
337
569
|
department: string | null;
|
|
338
570
|
title: string | null;
|
|
339
571
|
levelLabel: string | null;
|
|
@@ -348,6 +580,29 @@ export declare class OperationsService {
|
|
|
348
580
|
contractStatus: string | null;
|
|
349
581
|
activeAssignments: number;
|
|
350
582
|
}>;
|
|
583
|
+
listDepartments(userId: number): Promise<Record<string, unknown>[]>;
|
|
584
|
+
createDepartment(userId: number, data: DepartmentPayload): Promise<{
|
|
585
|
+
id: number;
|
|
586
|
+
slug: string;
|
|
587
|
+
code: string | null;
|
|
588
|
+
name: string;
|
|
589
|
+
description: string | null;
|
|
590
|
+
createdAt: string | null;
|
|
591
|
+
updatedAt: string | null;
|
|
592
|
+
deletedAt: string | null;
|
|
593
|
+
status: "active" | "inactive";
|
|
594
|
+
}>;
|
|
595
|
+
updateDepartment(userId: number, departmentId: number, data: Partial<DepartmentPayload>): Promise<{
|
|
596
|
+
id: number;
|
|
597
|
+
slug: string;
|
|
598
|
+
code: string | null;
|
|
599
|
+
name: string;
|
|
600
|
+
description: string | null;
|
|
601
|
+
createdAt: string | null;
|
|
602
|
+
updatedAt: string | null;
|
|
603
|
+
deletedAt: string | null;
|
|
604
|
+
status: "active" | "inactive";
|
|
605
|
+
}>;
|
|
351
606
|
listProjects(userId: number): Promise<Record<string, unknown>[]>;
|
|
352
607
|
getProjectById(userId: number, projectId: number): Promise<{
|
|
353
608
|
assignments: {
|
|
@@ -487,39 +742,191 @@ export declare class OperationsService {
|
|
|
487
742
|
myRoleLabel: string | null;
|
|
488
743
|
teamSize: number;
|
|
489
744
|
}>;
|
|
745
|
+
listContractTemplates(userId: number): Promise<Record<string, unknown>[]>;
|
|
746
|
+
getContractTemplateById(userId: number, templateId: number): Promise<{
|
|
747
|
+
id: number;
|
|
748
|
+
slug: string;
|
|
749
|
+
code: string | null;
|
|
750
|
+
name: string;
|
|
751
|
+
description: string | null;
|
|
752
|
+
contractCategory: string | null;
|
|
753
|
+
contractType: string | null;
|
|
754
|
+
billingModel: string | null;
|
|
755
|
+
signatureStatus: string | null;
|
|
756
|
+
isActive: boolean;
|
|
757
|
+
status: string | null;
|
|
758
|
+
contentHtml: string | null;
|
|
759
|
+
usageCount: number;
|
|
760
|
+
createdAt: Date;
|
|
761
|
+
updatedAt: Date;
|
|
762
|
+
}>;
|
|
763
|
+
createContractTemplate(userId: number, data: ContractTemplatePayload): Promise<{
|
|
764
|
+
id: number;
|
|
765
|
+
slug: string;
|
|
766
|
+
code: string | null;
|
|
767
|
+
name: string;
|
|
768
|
+
description: string | null;
|
|
769
|
+
contractCategory: string | null;
|
|
770
|
+
contractType: string | null;
|
|
771
|
+
billingModel: string | null;
|
|
772
|
+
signatureStatus: string | null;
|
|
773
|
+
isActive: boolean;
|
|
774
|
+
status: string | null;
|
|
775
|
+
contentHtml: string | null;
|
|
776
|
+
usageCount: number;
|
|
777
|
+
createdAt: Date;
|
|
778
|
+
updatedAt: Date;
|
|
779
|
+
}>;
|
|
780
|
+
updateContractTemplate(userId: number, templateId: number, data: Partial<ContractTemplatePayload>): Promise<{
|
|
781
|
+
id: number;
|
|
782
|
+
slug: string;
|
|
783
|
+
code: string | null;
|
|
784
|
+
name: string;
|
|
785
|
+
description: string | null;
|
|
786
|
+
contractCategory: string | null;
|
|
787
|
+
contractType: string | null;
|
|
788
|
+
billingModel: string | null;
|
|
789
|
+
signatureStatus: string | null;
|
|
790
|
+
isActive: boolean;
|
|
791
|
+
status: string | null;
|
|
792
|
+
contentHtml: string | null;
|
|
793
|
+
usageCount: number;
|
|
794
|
+
createdAt: Date;
|
|
795
|
+
updatedAt: Date;
|
|
796
|
+
}>;
|
|
490
797
|
listContracts(userId: number): Promise<Record<string, unknown>[]>;
|
|
491
|
-
getContractById(userId: number, contractId: number): Promise<
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
798
|
+
getContractById(userId: number, contractId: number): Promise<ContractDetailsRecord>;
|
|
799
|
+
createContract(userId: number, data: ContractPayload): Promise<ContractDetailsRecord>;
|
|
800
|
+
createContractDraft(userId: number, data: ContractDraftPayload): Promise<ContractDetailsRecord>;
|
|
801
|
+
extractContractSource(userId: number, contractId: number, data: Omit<ContractExtractDraftPayload, 'fileName' | 'mimeType' | 'fileContentBase64' | 'contractId'>): Promise<{
|
|
802
|
+
warnings: string[];
|
|
803
|
+
summary: string;
|
|
804
|
+
missingFields: string[];
|
|
805
|
+
code: string;
|
|
806
|
+
name: string;
|
|
807
|
+
clientName: string;
|
|
808
|
+
contractCategory: "other" | "client" | "internal" | "employee" | "contractor" | "supplier" | "vendor" | "partner";
|
|
809
|
+
contractType: "other" | "clt" | "pj" | "freelancer_agreement" | "service_agreement" | "fixed_term" | "recurring_service" | "nda" | "amendment" | "addendum";
|
|
810
|
+
signatureStatus: "pending" | "expired" | "not_started" | "partially_signed" | "signed";
|
|
811
|
+
isActive: boolean;
|
|
812
|
+
billingModel: "time_and_material" | "monthly_retainer" | "fixed_price";
|
|
813
|
+
originType: "manual" | "employee_hiring" | "client_project" | "crm_proposal";
|
|
814
|
+
originId: string;
|
|
815
|
+
startDate: string;
|
|
816
|
+
endDate: string;
|
|
817
|
+
signedAt: string;
|
|
818
|
+
effectiveDate: string;
|
|
819
|
+
budgetAmount: string | number;
|
|
820
|
+
monthlyHourCap: string | number;
|
|
821
|
+
status: "active" | "draft" | "expired" | "archived" | "closed" | "under_review" | "renewal";
|
|
822
|
+
description: string;
|
|
823
|
+
contentHtml: string;
|
|
824
|
+
parties: {
|
|
825
|
+
displayName: string;
|
|
826
|
+
partyRole: "other" | "client" | "employee" | "supplier" | "vendor" | "partner" | "employer" | "witness" | "internal_owner";
|
|
827
|
+
partyType: "other" | "individual" | "company" | "internal_team";
|
|
828
|
+
documentNumber: string;
|
|
829
|
+
email: string;
|
|
830
|
+
phone: string;
|
|
831
|
+
isPrimary: boolean;
|
|
832
|
+
}[];
|
|
833
|
+
signatures: {
|
|
834
|
+
signerName: string;
|
|
835
|
+
signerRole: string;
|
|
836
|
+
signerEmail: string;
|
|
837
|
+
status: "rejected" | "pending" | "signed";
|
|
838
|
+
signedAt: string;
|
|
839
|
+
}[];
|
|
840
|
+
financialTerms: {
|
|
841
|
+
label: string;
|
|
842
|
+
termType: "value" | "other" | "revenue" | "payment" | "fine";
|
|
843
|
+
amount: string | number;
|
|
844
|
+
recurrence: "other" | "one_time" | "monthly" | "quarterly" | "yearly";
|
|
845
|
+
dueDay: string | number;
|
|
846
|
+
notes: string;
|
|
847
|
+
}[];
|
|
848
|
+
revisions: {
|
|
849
|
+
title: string;
|
|
850
|
+
revisionType: "other" | "amendment" | "addendum" | "renewal" | "revision";
|
|
851
|
+
effectiveDate: string;
|
|
852
|
+
status: "active" | "draft" | "completed" | "cancelled";
|
|
853
|
+
summary: string;
|
|
854
|
+
}[];
|
|
855
|
+
}>;
|
|
856
|
+
generateContractContent(userId: number, contractId: number, data?: ContractGenerateContentPayload): Promise<ContractDetailsRecord>;
|
|
857
|
+
reviewContractLegally(userId: number, contractId: number, data?: ContractLegalReviewPayload): Promise<ContractLegalReviewResult>;
|
|
858
|
+
generateContractPdf(userId: number, contractId: number): Promise<{
|
|
859
|
+
contractId: number;
|
|
860
|
+
fileId: number;
|
|
861
|
+
fileName: string;
|
|
862
|
+
mimeType: string;
|
|
863
|
+
documentType: string;
|
|
864
|
+
downloadUrl: string;
|
|
501
865
|
}>;
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
866
|
+
extractContractDraft(userId: number, data: ContractExtractDraftPayload): Promise<{
|
|
867
|
+
warnings: string[];
|
|
868
|
+
summary: string;
|
|
869
|
+
missingFields: string[];
|
|
870
|
+
code: string;
|
|
871
|
+
name: string;
|
|
872
|
+
clientName: string;
|
|
873
|
+
contractCategory: "other" | "client" | "internal" | "employee" | "contractor" | "supplier" | "vendor" | "partner";
|
|
874
|
+
contractType: "other" | "clt" | "pj" | "freelancer_agreement" | "service_agreement" | "fixed_term" | "recurring_service" | "nda" | "amendment" | "addendum";
|
|
875
|
+
signatureStatus: "pending" | "expired" | "not_started" | "partially_signed" | "signed";
|
|
876
|
+
isActive: boolean;
|
|
877
|
+
billingModel: "time_and_material" | "monthly_retainer" | "fixed_price";
|
|
878
|
+
originType: "manual" | "employee_hiring" | "client_project" | "crm_proposal";
|
|
879
|
+
originId: string;
|
|
880
|
+
startDate: string;
|
|
881
|
+
endDate: string;
|
|
882
|
+
signedAt: string;
|
|
883
|
+
effectiveDate: string;
|
|
884
|
+
budgetAmount: string | number;
|
|
885
|
+
monthlyHourCap: string | number;
|
|
886
|
+
status: "active" | "draft" | "expired" | "archived" | "closed" | "under_review" | "renewal";
|
|
887
|
+
description: string;
|
|
888
|
+
contentHtml: string;
|
|
889
|
+
parties: {
|
|
890
|
+
displayName: string;
|
|
891
|
+
partyRole: "other" | "client" | "employee" | "supplier" | "vendor" | "partner" | "employer" | "witness" | "internal_owner";
|
|
892
|
+
partyType: "other" | "individual" | "company" | "internal_team";
|
|
893
|
+
documentNumber: string;
|
|
894
|
+
email: string;
|
|
895
|
+
phone: string;
|
|
896
|
+
isPrimary: boolean;
|
|
897
|
+
}[];
|
|
898
|
+
signatures: {
|
|
899
|
+
signerName: string;
|
|
900
|
+
signerRole: string;
|
|
901
|
+
signerEmail: string;
|
|
902
|
+
status: "rejected" | "pending" | "signed";
|
|
903
|
+
signedAt: string;
|
|
904
|
+
}[];
|
|
905
|
+
financialTerms: {
|
|
906
|
+
label: string;
|
|
907
|
+
termType: "value" | "other" | "revenue" | "payment" | "fine";
|
|
908
|
+
amount: string | number;
|
|
909
|
+
recurrence: "other" | "one_time" | "monthly" | "quarterly" | "yearly";
|
|
910
|
+
dueDay: string | number;
|
|
911
|
+
notes: string;
|
|
912
|
+
}[];
|
|
913
|
+
revisions: {
|
|
914
|
+
title: string;
|
|
915
|
+
revisionType: "other" | "amendment" | "addendum" | "renewal" | "revision";
|
|
916
|
+
effectiveDate: string;
|
|
917
|
+
status: "active" | "draft" | "completed" | "cancelled";
|
|
918
|
+
summary: string;
|
|
919
|
+
}[];
|
|
920
|
+
}>;
|
|
921
|
+
createContractFromProposalIntegration(payload: ProposalApprovedEventPayload): Promise<{
|
|
922
|
+
id: number;
|
|
923
|
+
code: string;
|
|
512
924
|
}>;
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
signatures: Record<string, unknown>[];
|
|
519
|
-
financialTerms: Record<string, unknown>[];
|
|
520
|
-
documents: Record<string, unknown>[];
|
|
521
|
-
revisions: Record<string, unknown>[];
|
|
522
|
-
history: Record<string, unknown>[];
|
|
925
|
+
private buildContractCreatedEventPayload;
|
|
926
|
+
private buildContractActivatedEventPayload;
|
|
927
|
+
updateContract(userId: number, contractId: number, data: Partial<ContractPayload>): Promise<ContractDetailsRecord>;
|
|
928
|
+
removeContract(userId: number, contractId: number): Promise<{
|
|
929
|
+
success: boolean;
|
|
523
930
|
}>;
|
|
524
931
|
listTimesheets(userId: number): Promise<{
|
|
525
932
|
id: number;
|
|
@@ -571,6 +978,18 @@ export declare class OperationsService {
|
|
|
571
978
|
private getActorContext;
|
|
572
979
|
private getCollaboratorByUserId;
|
|
573
980
|
private getCollaboratorById;
|
|
981
|
+
private getPersonById;
|
|
982
|
+
private getDepartmentById;
|
|
983
|
+
private assertDepartmentNameAvailable;
|
|
984
|
+
private assertDepartmentCodeAvailable;
|
|
985
|
+
private resolveDepartmentReference;
|
|
986
|
+
private generateUniqueDepartmentSlug;
|
|
987
|
+
private getContractTemplateRecord;
|
|
988
|
+
private assertContractTemplateNameAvailable;
|
|
989
|
+
private assertContractTemplateCodeAvailable;
|
|
990
|
+
private generateUniqueContractTemplateSlug;
|
|
991
|
+
private slugifyValue;
|
|
992
|
+
private normalizeOptionalText;
|
|
574
993
|
private getProjectDetails;
|
|
575
994
|
private getCollaboratorDetails;
|
|
576
995
|
private getDirectReportIds;
|
|
@@ -598,8 +1017,34 @@ export declare class OperationsService {
|
|
|
598
1017
|
private replaceContractSignatures;
|
|
599
1018
|
private replaceContractFinancialTerms;
|
|
600
1019
|
private replaceContractRevisions;
|
|
601
|
-
private
|
|
1020
|
+
private replaceContractDocument;
|
|
1021
|
+
private resolveContractExtractionFile;
|
|
1022
|
+
private buildContractExtractionFile;
|
|
1023
|
+
private renderContractPdfBuffer;
|
|
1024
|
+
private buildContractPdfHtml;
|
|
1025
|
+
private resolveContractPdfLogoUrl;
|
|
1026
|
+
private buildContractPdfFileName;
|
|
1027
|
+
private humanizeEnumLabel;
|
|
1028
|
+
private escapeHtml;
|
|
602
1029
|
private insertContractHistory;
|
|
1030
|
+
private generateCollaboratorCode;
|
|
1031
|
+
private generateContractCode;
|
|
1032
|
+
private generateContractContentHtml;
|
|
1033
|
+
private buildFallbackContractContent;
|
|
1034
|
+
private buildContractLegalReview;
|
|
1035
|
+
private buildHeuristicContractLegalReview;
|
|
1036
|
+
private buildContractExtractionSystemPrompt;
|
|
1037
|
+
private parseAiJsonPayload;
|
|
1038
|
+
private normalizeContractExtractDraft;
|
|
1039
|
+
private normalizeExtractionString;
|
|
1040
|
+
private normalizeExtractionBoolean;
|
|
1041
|
+
private normalizeExtractionNumber;
|
|
1042
|
+
private normalizeExtractionDate;
|
|
1043
|
+
private normalizeStringList;
|
|
1044
|
+
private normalizeObjectList;
|
|
1045
|
+
private normalizeEnumValue;
|
|
1046
|
+
private normalizeContractExtractionMimeType;
|
|
1047
|
+
private isAllowedContractExtractionMimeType;
|
|
603
1048
|
private requireFields;
|
|
604
1049
|
private buildIdFilter;
|
|
605
1050
|
private uniqueNumbers;
|