@hed-hog/operations 0.0.300 → 0.0.301
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 +490 -46
- package/dist/operations.service.d.ts.map +1 -1
- package/dist/operations.service.js +2442 -119
- 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 +34 -0
- 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 +36 -12
- 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 +6 -4
- 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 +3934 -212
|
@@ -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,11 @@ 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
|
+
constructor(prisma: PrismaService, aiService: AiService, integrationApi: IntegrationDeveloperApiService, fileService: FileService, settingService: SettingService);
|
|
175
390
|
getDashboard(userId: number): Promise<{
|
|
176
391
|
actor: {
|
|
177
392
|
roleScope: string;
|
|
@@ -214,10 +429,14 @@ export declare class OperationsService {
|
|
|
214
429
|
};
|
|
215
430
|
scheduleAdjustmentRequests: Record<string, unknown>[];
|
|
216
431
|
id: number;
|
|
217
|
-
userId: number;
|
|
432
|
+
userId: number | null;
|
|
433
|
+
personId: number | null;
|
|
434
|
+
personName: string | null;
|
|
435
|
+
personAvatarId: number | null;
|
|
218
436
|
code: string;
|
|
219
437
|
collaboratorType: string;
|
|
220
438
|
displayName: string;
|
|
439
|
+
departmentId: number | null;
|
|
221
440
|
department: string | null;
|
|
222
441
|
title: string | null;
|
|
223
442
|
levelLabel: string | null;
|
|
@@ -248,10 +467,14 @@ export declare class OperationsService {
|
|
|
248
467
|
};
|
|
249
468
|
scheduleAdjustmentRequests: Record<string, unknown>[];
|
|
250
469
|
id: number;
|
|
251
|
-
userId: number;
|
|
470
|
+
userId: number | null;
|
|
471
|
+
personId: number | null;
|
|
472
|
+
personName: string | null;
|
|
473
|
+
personAvatarId: number | null;
|
|
252
474
|
code: string;
|
|
253
475
|
collaboratorType: string;
|
|
254
476
|
displayName: string;
|
|
477
|
+
departmentId: number | null;
|
|
255
478
|
department: string | null;
|
|
256
479
|
title: string | null;
|
|
257
480
|
levelLabel: string | null;
|
|
@@ -296,10 +519,14 @@ export declare class OperationsService {
|
|
|
296
519
|
};
|
|
297
520
|
scheduleAdjustmentRequests: Record<string, unknown>[];
|
|
298
521
|
id: number;
|
|
299
|
-
userId: number;
|
|
522
|
+
userId: number | null;
|
|
523
|
+
personId: number | null;
|
|
524
|
+
personName: string | null;
|
|
525
|
+
personAvatarId: number | null;
|
|
300
526
|
code: string;
|
|
301
527
|
collaboratorType: string;
|
|
302
528
|
displayName: string;
|
|
529
|
+
departmentId: number | null;
|
|
303
530
|
department: string | null;
|
|
304
531
|
title: string | null;
|
|
305
532
|
levelLabel: string | null;
|
|
@@ -330,10 +557,14 @@ export declare class OperationsService {
|
|
|
330
557
|
};
|
|
331
558
|
scheduleAdjustmentRequests: Record<string, unknown>[];
|
|
332
559
|
id: number;
|
|
333
|
-
userId: number;
|
|
560
|
+
userId: number | null;
|
|
561
|
+
personId: number | null;
|
|
562
|
+
personName: string | null;
|
|
563
|
+
personAvatarId: number | null;
|
|
334
564
|
code: string;
|
|
335
565
|
collaboratorType: string;
|
|
336
566
|
displayName: string;
|
|
567
|
+
departmentId: number | null;
|
|
337
568
|
department: string | null;
|
|
338
569
|
title: string | null;
|
|
339
570
|
levelLabel: string | null;
|
|
@@ -348,6 +579,29 @@ export declare class OperationsService {
|
|
|
348
579
|
contractStatus: string | null;
|
|
349
580
|
activeAssignments: number;
|
|
350
581
|
}>;
|
|
582
|
+
listDepartments(userId: number): Promise<Record<string, unknown>[]>;
|
|
583
|
+
createDepartment(userId: number, data: DepartmentPayload): Promise<{
|
|
584
|
+
id: number;
|
|
585
|
+
slug: string;
|
|
586
|
+
code: string | null;
|
|
587
|
+
name: string;
|
|
588
|
+
description: string | null;
|
|
589
|
+
createdAt: string | null;
|
|
590
|
+
updatedAt: string | null;
|
|
591
|
+
deletedAt: string | null;
|
|
592
|
+
status: "active" | "inactive";
|
|
593
|
+
}>;
|
|
594
|
+
updateDepartment(userId: number, departmentId: number, data: Partial<DepartmentPayload>): Promise<{
|
|
595
|
+
id: number;
|
|
596
|
+
slug: string;
|
|
597
|
+
code: string | null;
|
|
598
|
+
name: string;
|
|
599
|
+
description: string | null;
|
|
600
|
+
createdAt: string | null;
|
|
601
|
+
updatedAt: string | null;
|
|
602
|
+
deletedAt: string | null;
|
|
603
|
+
status: "active" | "inactive";
|
|
604
|
+
}>;
|
|
351
605
|
listProjects(userId: number): Promise<Record<string, unknown>[]>;
|
|
352
606
|
getProjectById(userId: number, projectId: number): Promise<{
|
|
353
607
|
assignments: {
|
|
@@ -487,39 +741,191 @@ export declare class OperationsService {
|
|
|
487
741
|
myRoleLabel: string | null;
|
|
488
742
|
teamSize: number;
|
|
489
743
|
}>;
|
|
744
|
+
listContractTemplates(userId: number): Promise<Record<string, unknown>[]>;
|
|
745
|
+
getContractTemplateById(userId: number, templateId: number): Promise<{
|
|
746
|
+
id: number;
|
|
747
|
+
slug: string;
|
|
748
|
+
code: string | null;
|
|
749
|
+
name: string;
|
|
750
|
+
description: string | null;
|
|
751
|
+
contractCategory: string | null;
|
|
752
|
+
contractType: string | null;
|
|
753
|
+
billingModel: string | null;
|
|
754
|
+
signatureStatus: string | null;
|
|
755
|
+
isActive: boolean;
|
|
756
|
+
status: string | null;
|
|
757
|
+
contentHtml: string | null;
|
|
758
|
+
usageCount: number;
|
|
759
|
+
createdAt: Date;
|
|
760
|
+
updatedAt: Date;
|
|
761
|
+
}>;
|
|
762
|
+
createContractTemplate(userId: number, data: ContractTemplatePayload): Promise<{
|
|
763
|
+
id: number;
|
|
764
|
+
slug: string;
|
|
765
|
+
code: string | null;
|
|
766
|
+
name: string;
|
|
767
|
+
description: string | null;
|
|
768
|
+
contractCategory: string | null;
|
|
769
|
+
contractType: string | null;
|
|
770
|
+
billingModel: string | null;
|
|
771
|
+
signatureStatus: string | null;
|
|
772
|
+
isActive: boolean;
|
|
773
|
+
status: string | null;
|
|
774
|
+
contentHtml: string | null;
|
|
775
|
+
usageCount: number;
|
|
776
|
+
createdAt: Date;
|
|
777
|
+
updatedAt: Date;
|
|
778
|
+
}>;
|
|
779
|
+
updateContractTemplate(userId: number, templateId: number, data: Partial<ContractTemplatePayload>): Promise<{
|
|
780
|
+
id: number;
|
|
781
|
+
slug: string;
|
|
782
|
+
code: string | null;
|
|
783
|
+
name: string;
|
|
784
|
+
description: string | null;
|
|
785
|
+
contractCategory: string | null;
|
|
786
|
+
contractType: string | null;
|
|
787
|
+
billingModel: string | null;
|
|
788
|
+
signatureStatus: string | null;
|
|
789
|
+
isActive: boolean;
|
|
790
|
+
status: string | null;
|
|
791
|
+
contentHtml: string | null;
|
|
792
|
+
usageCount: number;
|
|
793
|
+
createdAt: Date;
|
|
794
|
+
updatedAt: Date;
|
|
795
|
+
}>;
|
|
490
796
|
listContracts(userId: number): Promise<Record<string, unknown>[]>;
|
|
491
|
-
getContractById(userId: number, contractId: number): Promise<
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
797
|
+
getContractById(userId: number, contractId: number): Promise<ContractDetailsRecord>;
|
|
798
|
+
createContract(userId: number, data: ContractPayload): Promise<ContractDetailsRecord>;
|
|
799
|
+
createContractDraft(userId: number, data: ContractDraftPayload): Promise<ContractDetailsRecord>;
|
|
800
|
+
extractContractSource(userId: number, contractId: number, data: Omit<ContractExtractDraftPayload, 'fileName' | 'mimeType' | 'fileContentBase64' | 'contractId'>): Promise<{
|
|
801
|
+
warnings: string[];
|
|
802
|
+
summary: string;
|
|
803
|
+
missingFields: string[];
|
|
804
|
+
code: string;
|
|
805
|
+
name: string;
|
|
806
|
+
clientName: string;
|
|
807
|
+
contractCategory: "other" | "client" | "internal" | "employee" | "contractor" | "supplier" | "vendor" | "partner";
|
|
808
|
+
contractType: "other" | "clt" | "pj" | "freelancer_agreement" | "service_agreement" | "fixed_term" | "recurring_service" | "nda" | "amendment" | "addendum";
|
|
809
|
+
signatureStatus: "pending" | "expired" | "not_started" | "partially_signed" | "signed";
|
|
810
|
+
isActive: boolean;
|
|
811
|
+
billingModel: "time_and_material" | "monthly_retainer" | "fixed_price";
|
|
812
|
+
originType: "manual" | "employee_hiring" | "client_project" | "crm_proposal";
|
|
813
|
+
originId: string;
|
|
814
|
+
startDate: string;
|
|
815
|
+
endDate: string;
|
|
816
|
+
signedAt: string;
|
|
817
|
+
effectiveDate: string;
|
|
818
|
+
budgetAmount: string | number;
|
|
819
|
+
monthlyHourCap: string | number;
|
|
820
|
+
status: "active" | "draft" | "expired" | "archived" | "closed" | "under_review" | "renewal";
|
|
821
|
+
description: string;
|
|
822
|
+
contentHtml: string;
|
|
823
|
+
parties: {
|
|
824
|
+
displayName: string;
|
|
825
|
+
partyRole: "other" | "client" | "employee" | "supplier" | "vendor" | "partner" | "employer" | "witness" | "internal_owner";
|
|
826
|
+
partyType: "other" | "individual" | "company" | "internal_team";
|
|
827
|
+
documentNumber: string;
|
|
828
|
+
email: string;
|
|
829
|
+
phone: string;
|
|
830
|
+
isPrimary: boolean;
|
|
831
|
+
}[];
|
|
832
|
+
signatures: {
|
|
833
|
+
signerName: string;
|
|
834
|
+
signerRole: string;
|
|
835
|
+
signerEmail: string;
|
|
836
|
+
status: "rejected" | "pending" | "signed";
|
|
837
|
+
signedAt: string;
|
|
838
|
+
}[];
|
|
839
|
+
financialTerms: {
|
|
840
|
+
label: string;
|
|
841
|
+
termType: "value" | "other" | "revenue" | "payment" | "fine";
|
|
842
|
+
amount: string | number;
|
|
843
|
+
recurrence: "other" | "one_time" | "monthly" | "quarterly" | "yearly";
|
|
844
|
+
dueDay: string | number;
|
|
845
|
+
notes: string;
|
|
846
|
+
}[];
|
|
847
|
+
revisions: {
|
|
848
|
+
title: string;
|
|
849
|
+
revisionType: "other" | "amendment" | "addendum" | "renewal" | "revision";
|
|
850
|
+
effectiveDate: string;
|
|
851
|
+
status: "active" | "draft" | "completed" | "cancelled";
|
|
852
|
+
summary: string;
|
|
853
|
+
}[];
|
|
854
|
+
}>;
|
|
855
|
+
generateContractContent(userId: number, contractId: number, data?: ContractGenerateContentPayload): Promise<ContractDetailsRecord>;
|
|
856
|
+
reviewContractLegally(userId: number, contractId: number, data?: ContractLegalReviewPayload): Promise<ContractLegalReviewResult>;
|
|
857
|
+
generateContractPdf(userId: number, contractId: number): Promise<{
|
|
858
|
+
contractId: number;
|
|
859
|
+
fileId: number;
|
|
860
|
+
fileName: string;
|
|
861
|
+
mimeType: string;
|
|
862
|
+
documentType: string;
|
|
863
|
+
downloadUrl: string;
|
|
501
864
|
}>;
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
865
|
+
extractContractDraft(userId: number, data: ContractExtractDraftPayload): Promise<{
|
|
866
|
+
warnings: string[];
|
|
867
|
+
summary: string;
|
|
868
|
+
missingFields: string[];
|
|
869
|
+
code: string;
|
|
870
|
+
name: string;
|
|
871
|
+
clientName: string;
|
|
872
|
+
contractCategory: "other" | "client" | "internal" | "employee" | "contractor" | "supplier" | "vendor" | "partner";
|
|
873
|
+
contractType: "other" | "clt" | "pj" | "freelancer_agreement" | "service_agreement" | "fixed_term" | "recurring_service" | "nda" | "amendment" | "addendum";
|
|
874
|
+
signatureStatus: "pending" | "expired" | "not_started" | "partially_signed" | "signed";
|
|
875
|
+
isActive: boolean;
|
|
876
|
+
billingModel: "time_and_material" | "monthly_retainer" | "fixed_price";
|
|
877
|
+
originType: "manual" | "employee_hiring" | "client_project" | "crm_proposal";
|
|
878
|
+
originId: string;
|
|
879
|
+
startDate: string;
|
|
880
|
+
endDate: string;
|
|
881
|
+
signedAt: string;
|
|
882
|
+
effectiveDate: string;
|
|
883
|
+
budgetAmount: string | number;
|
|
884
|
+
monthlyHourCap: string | number;
|
|
885
|
+
status: "active" | "draft" | "expired" | "archived" | "closed" | "under_review" | "renewal";
|
|
886
|
+
description: string;
|
|
887
|
+
contentHtml: string;
|
|
888
|
+
parties: {
|
|
889
|
+
displayName: string;
|
|
890
|
+
partyRole: "other" | "client" | "employee" | "supplier" | "vendor" | "partner" | "employer" | "witness" | "internal_owner";
|
|
891
|
+
partyType: "other" | "individual" | "company" | "internal_team";
|
|
892
|
+
documentNumber: string;
|
|
893
|
+
email: string;
|
|
894
|
+
phone: string;
|
|
895
|
+
isPrimary: boolean;
|
|
896
|
+
}[];
|
|
897
|
+
signatures: {
|
|
898
|
+
signerName: string;
|
|
899
|
+
signerRole: string;
|
|
900
|
+
signerEmail: string;
|
|
901
|
+
status: "rejected" | "pending" | "signed";
|
|
902
|
+
signedAt: string;
|
|
903
|
+
}[];
|
|
904
|
+
financialTerms: {
|
|
905
|
+
label: string;
|
|
906
|
+
termType: "value" | "other" | "revenue" | "payment" | "fine";
|
|
907
|
+
amount: string | number;
|
|
908
|
+
recurrence: "other" | "one_time" | "monthly" | "quarterly" | "yearly";
|
|
909
|
+
dueDay: string | number;
|
|
910
|
+
notes: string;
|
|
911
|
+
}[];
|
|
912
|
+
revisions: {
|
|
913
|
+
title: string;
|
|
914
|
+
revisionType: "other" | "amendment" | "addendum" | "renewal" | "revision";
|
|
915
|
+
effectiveDate: string;
|
|
916
|
+
status: "active" | "draft" | "completed" | "cancelled";
|
|
917
|
+
summary: string;
|
|
918
|
+
}[];
|
|
919
|
+
}>;
|
|
920
|
+
createContractFromProposalIntegration(payload: ProposalApprovedEventPayload): Promise<{
|
|
921
|
+
id: number;
|
|
922
|
+
code: string;
|
|
512
923
|
}>;
|
|
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>[];
|
|
924
|
+
private buildContractCreatedEventPayload;
|
|
925
|
+
private buildContractActivatedEventPayload;
|
|
926
|
+
updateContract(userId: number, contractId: number, data: Partial<ContractPayload>): Promise<ContractDetailsRecord>;
|
|
927
|
+
removeContract(userId: number, contractId: number): Promise<{
|
|
928
|
+
success: boolean;
|
|
523
929
|
}>;
|
|
524
930
|
listTimesheets(userId: number): Promise<{
|
|
525
931
|
id: number;
|
|
@@ -571,6 +977,18 @@ export declare class OperationsService {
|
|
|
571
977
|
private getActorContext;
|
|
572
978
|
private getCollaboratorByUserId;
|
|
573
979
|
private getCollaboratorById;
|
|
980
|
+
private getPersonById;
|
|
981
|
+
private getDepartmentById;
|
|
982
|
+
private assertDepartmentNameAvailable;
|
|
983
|
+
private assertDepartmentCodeAvailable;
|
|
984
|
+
private resolveDepartmentReference;
|
|
985
|
+
private generateUniqueDepartmentSlug;
|
|
986
|
+
private getContractTemplateRecord;
|
|
987
|
+
private assertContractTemplateNameAvailable;
|
|
988
|
+
private assertContractTemplateCodeAvailable;
|
|
989
|
+
private generateUniqueContractTemplateSlug;
|
|
990
|
+
private slugifyValue;
|
|
991
|
+
private normalizeOptionalText;
|
|
574
992
|
private getProjectDetails;
|
|
575
993
|
private getCollaboratorDetails;
|
|
576
994
|
private getDirectReportIds;
|
|
@@ -598,8 +1016,34 @@ export declare class OperationsService {
|
|
|
598
1016
|
private replaceContractSignatures;
|
|
599
1017
|
private replaceContractFinancialTerms;
|
|
600
1018
|
private replaceContractRevisions;
|
|
601
|
-
private
|
|
1019
|
+
private replaceContractDocument;
|
|
1020
|
+
private resolveContractExtractionFile;
|
|
1021
|
+
private buildContractExtractionFile;
|
|
1022
|
+
private renderContractPdfBuffer;
|
|
1023
|
+
private buildContractPdfHtml;
|
|
1024
|
+
private resolveContractPdfLogoUrl;
|
|
1025
|
+
private buildContractPdfFileName;
|
|
1026
|
+
private humanizeEnumLabel;
|
|
1027
|
+
private escapeHtml;
|
|
602
1028
|
private insertContractHistory;
|
|
1029
|
+
private generateCollaboratorCode;
|
|
1030
|
+
private generateContractCode;
|
|
1031
|
+
private generateContractContentHtml;
|
|
1032
|
+
private buildFallbackContractContent;
|
|
1033
|
+
private buildContractLegalReview;
|
|
1034
|
+
private buildHeuristicContractLegalReview;
|
|
1035
|
+
private buildContractExtractionSystemPrompt;
|
|
1036
|
+
private parseAiJsonPayload;
|
|
1037
|
+
private normalizeContractExtractDraft;
|
|
1038
|
+
private normalizeExtractionString;
|
|
1039
|
+
private normalizeExtractionBoolean;
|
|
1040
|
+
private normalizeExtractionNumber;
|
|
1041
|
+
private normalizeExtractionDate;
|
|
1042
|
+
private normalizeStringList;
|
|
1043
|
+
private normalizeObjectList;
|
|
1044
|
+
private normalizeEnumValue;
|
|
1045
|
+
private normalizeContractExtractionMimeType;
|
|
1046
|
+
private isAllowedContractExtractionMimeType;
|
|
603
1047
|
private requireFields;
|
|
604
1048
|
private buildIdFilter;
|
|
605
1049
|
private uniqueNumbers;
|