@seniorsistemas/hcm-clocking-event-rule-nodejs 0.35.0
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/.github/copilot-instructions.md +11 -0
- package/.github/workflows/release.yaml +10 -0
- package/.gitlab-ci.yml +68 -0
- package/CHANGELOG.md +274 -0
- package/README.doc.md +658 -0
- package/README.md +117 -0
- package/assets/favicon.ico +0 -0
- package/catalog-info.yaml +19 -0
- package/jest.config.js +17 -0
- package/package.json +48 -0
- package/prompt.md +15 -0
- package/run_build_win.bat +1 -0
- package/run_link.bat +3 -0
- package/run_test.bat +1 -0
- package/sonar-project.properties +21 -0
- package/src/data/changes/changes.ts +92 -0
- package/src/data/context/context.ts +251 -0
- package/src/data/context/contextReference.ts +376 -0
- package/src/data/contract/contract.ts +272 -0
- package/src/data/dataset/database.ts +130 -0
- package/src/data/dataset/dataset.ts +275 -0
- package/src/data/definition/timeEvaluationSituationDefinitionHistory.ts +1425 -0
- package/src/data/employee/employee.ts +434 -0
- package/src/data/foundation/companyBranch.ts +66 -0
- package/src/data/foundation/costCenter.ts +47 -0
- package/src/data/foundation/employer.ts +35 -0
- package/src/data/foundation/employmentRelationship.ts +63 -0
- package/src/data/foundation/holiday.ts +84 -0
- package/src/data/foundation/holidayGroup.ts +47 -0
- package/src/data/foundation/jobPosition.ts +73 -0
- package/src/data/foundation/person.ts +35 -0
- package/src/data/foundation/situation.ts +301 -0
- package/src/data/foundation/syndicate.ts +244 -0
- package/src/data/foundation/workschedule.ts +688 -0
- package/src/data/foundation/workshift.ts +647 -0
- package/src/data/foundation/workshiftBase.ts +113 -0
- package/src/data/histories/companyBranchHistory.ts +128 -0
- package/src/data/histories/costCenterHistory.ts +114 -0
- package/src/data/histories/employmentRelationshipHistory.ts +116 -0
- package/src/data/histories/histories.ts +419 -0
- package/src/data/histories/jobPositionHistory.ts +117 -0
- package/src/data/histories/leaveHistory.ts +227 -0
- package/src/data/histories/timeEvaluationHistory.ts +191 -0
- package/src/data/histories/workshiftHistory.ts +66 -0
- package/src/data/hourBank/hourBank.ts +43 -0
- package/src/data/hourBank/hourBankAccount.ts +77 -0
- package/src/data/log/log.ts +38 -0
- package/src/data/schedules/bridge.ts +84 -0
- package/src/data/schedules/compensation.ts +332 -0
- package/src/data/schedules/overtimeAuthorization.ts +174 -0
- package/src/data/schedules/readiness.ts +150 -0
- package/src/data/schedules/schedules.ts +398 -0
- package/src/data/schedules/workscheduleChange.ts +91 -0
- package/src/data/schedules/workshiftChange.ts +76 -0
- package/src/data/timeEvaluation/adjustmentReason.ts +46 -0
- package/src/data/timeEvaluation/clockingEvent.ts +198 -0
- package/src/data/timeEvaluation/estimatedHours.ts +245 -0
- package/src/data/timeEvaluation/interval.ts +568 -0
- package/src/data/timeEvaluation/separatedHours.ts +134 -0
- package/src/data/timeEvaluation/timeEvaluation.ts +1540 -0
- package/src/data/timeEvaluation/timeEvaluationSituation.ts +154 -0
- package/src/data/user/user.ts +44 -0
- package/src/index.ts +60 -0
- package/src/test/builder/bridgeBuilder.builder.ts +28 -0
- package/src/test/builder/clockingEvent.builder.ts +49 -0
- package/src/test/builder/companyBranchHistoryBuilder.ts +29 -0
- package/src/test/builder/compensation.builder.ts +84 -0
- package/src/test/builder/contextReference.builder.ts +69 -0
- package/src/test/builder/costCenterHistoryBuilder.ts +29 -0
- package/src/test/builder/database.builder.ts +21 -0
- package/src/test/builder/datasetBuilder.ts +111 -0
- package/src/test/builder/dateIntervalBuilder.ts +25 -0
- package/src/test/builder/employee.builder.ts +91 -0
- package/src/test/builder/employmentRelationshipBuilder.ts +35 -0
- package/src/test/builder/employmentRelationshipHistoryBuilder.ts +29 -0
- package/src/test/builder/historiesBuilder.ts +56 -0
- package/src/test/builder/holiday.builder.ts +44 -0
- package/src/test/builder/hourBankAccountBuilder.ts +77 -0
- package/src/test/builder/hourBankBuilder.ts +32 -0
- package/src/test/builder/interval.builder.ts +113 -0
- package/src/test/builder/jobPositionHistoryBuilder.ts +29 -0
- package/src/test/builder/overtimeAuthorization.builder.ts +42 -0
- package/src/test/builder/readinessBuilder.builder.ts +57 -0
- package/src/test/builder/schedules.builder.ts +126 -0
- package/src/test/builder/situation.builder.ts +59 -0
- package/src/test/builder/syndicate.builder.ts +96 -0
- package/src/test/builder/syndicateHistoryBuilder.ts +33 -0
- package/src/test/builder/timeEvaluation.builder.ts +138 -0
- package/src/test/builder/timeEvaluationHistory.builder.ts +49 -0
- package/src/test/builder/timeEvaluationSituation.builder.ts +34 -0
- package/src/test/builder/workschedule.builder.ts +96 -0
- package/src/test/builder/workshift.builder.ts +179 -0
- package/src/test/builder/workshiftBuilder.ts +55 -0
- package/src/test/data/clockingEvent.spec.ts +56 -0
- package/src/test/data/context.spec.ts +176 -0
- package/src/test/data/currentUser.spec.ts +11 -0
- package/src/test/data/dataset.spec.ts +144 -0
- package/src/test/data/employee/employee.spec.ts +20 -0
- package/src/test/data/employmentRelationship/employmentRelationship.spec.ts +48 -0
- package/src/test/data/estimatedHours/estimatedHours.spec.ts +96 -0
- package/src/test/data/histories/costCenterHistory.spec.ts +32 -0
- package/src/test/data/histories/histories.spec.ts +306 -0
- package/src/test/data/holyday.spec.ts +89 -0
- package/src/test/data/hourBank/hourBank.spec.ts +48 -0
- package/src/test/data/hourBank/hourBankAccount.spec.ts +32 -0
- package/src/test/data/schedules/bridge.spec.ts +13 -0
- package/src/test/data/schedules/compesation.spect.ts +89 -0
- package/src/test/data/schedules/overtimeAuthorization.spec.ts +52 -0
- package/src/test/data/schedules/readiness.spec.ts +64 -0
- package/src/test/data/schedules/schedules.spec.ts +134 -0
- package/src/test/data/schedules/workscheduleChange.spec.ts +21 -0
- package/src/test/data/syndicate/syndicate.spec.ts +51 -0
- package/src/test/data/timeEvaluation.spec.ts +1057 -0
- package/src/test/data/timeEvaluationDefinition.spec.ts +144 -0
- package/src/test/data/workschedule/workschedule.spec.ts +194 -0
- package/src/test/data/workshift/workshift.spec.ts +79 -0
- package/src/test/utils/date.utils.spec.ts +198 -0
- package/src/test/utils/dateIntervalUtils.spec.ts +210 -0
- package/src/test/utils/object.utils.spec.ts +83 -0
- package/src/utils/dateIntervalUtils.ts +284 -0
- package/src/utils/dateUtils.ts +456 -0
- package/src/utils/decompressGzipLambda.ts +15 -0
- package/src/utils/object.utils.ts +156 -0
- package/trivy/vulnerabilities_scan.json +1160 -0
- package/tsconfig.json +32 -0
- package/tsconfig.spec.json +21 -0
- package/tslint.json +92 -0
- package/typedoc.json +22 -0
|
@@ -0,0 +1,434 @@
|
|
|
1
|
+
import { ObjectUtils } from "../../utils/object.utils";
|
|
2
|
+
import { Employer } from "../foundation/employer";
|
|
3
|
+
import { EmploymentRelationship } from "../foundation/employmentRelationship";
|
|
4
|
+
import { Person } from "../foundation/person";
|
|
5
|
+
import { ContextReference } from "../context/contextReference";
|
|
6
|
+
import { JobPosition } from "../foundation/jobPosition";
|
|
7
|
+
import { Workshift, WorkshiftGroup } from "../foundation/workshift";
|
|
8
|
+
import { CompanyBranch } from "../foundation/companyBranch";
|
|
9
|
+
import { CostCenter } from "../foundation/costCenter";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @hidden
|
|
13
|
+
* Interface para os parâmetros do construtor de Employee.
|
|
14
|
+
*/
|
|
15
|
+
interface EmployeeParams {
|
|
16
|
+
/**
|
|
17
|
+
* Identificador único do colaborador.
|
|
18
|
+
*/
|
|
19
|
+
id: string;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Código do colaborador.
|
|
23
|
+
*/
|
|
24
|
+
code: number;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Pessoa do colaborador.
|
|
28
|
+
*/
|
|
29
|
+
person: Person;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Data de admissão do colaborador.
|
|
33
|
+
*/
|
|
34
|
+
hireDate: Date;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Data de demissão do funcionário (opcional).
|
|
38
|
+
*/
|
|
39
|
+
dismissalDate: Date | null;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* ID do vínculo do colaborador.
|
|
43
|
+
*/
|
|
44
|
+
employmentRelationshipId: string;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Empregador do colaborador.
|
|
48
|
+
*/
|
|
49
|
+
employer: Employer;
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Código do centro de custo do colaborador (opcional).
|
|
53
|
+
*/
|
|
54
|
+
costCenterKey: string;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Código da filial do colaborador.
|
|
58
|
+
*/
|
|
59
|
+
companyBranchKey: string;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Código da escala do colaborador.
|
|
63
|
+
*/
|
|
64
|
+
workshiftId: string;
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Código do turno da escala do colaborador.
|
|
68
|
+
*/
|
|
69
|
+
workshiftGroupId: string;
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Código do cargo do colaborador.
|
|
73
|
+
*/
|
|
74
|
+
jobPositionKey: string;
|
|
75
|
+
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Representa um colaborador.
|
|
80
|
+
* Um colaborador é uma pessoa que trabalha para um empregador, com um vínculo de emprego definido.
|
|
81
|
+
* Ele possui informações como código, pessoa associada, data de admissão, data de demissão (opcional),
|
|
82
|
+
* vínculo de emprego, empregador, centro de custo (opcional), filial, escala, turno e cargo.
|
|
83
|
+
* No colaborador pode se encontrado a pessoa e seu nome.
|
|
84
|
+
*
|
|
85
|
+
* Exemplo de uso:
|
|
86
|
+
* ```typescript
|
|
87
|
+
* employee.hireDate; // Retorna a data de admissão do colaborador.
|
|
88
|
+
* employee.employer.name; // Retorna o nome do empregador do colaborador.
|
|
89
|
+
* employee.employmentRelationship.code; // Retorna o código do vínculo de emprego do colaborador.
|
|
90
|
+
* ```
|
|
91
|
+
* @see {@link Person}
|
|
92
|
+
* @see {@link Employer}
|
|
93
|
+
* @see {@link EmploymentRelationship}
|
|
94
|
+
* @see {@link JobPosition}
|
|
95
|
+
* @see {@link Workshift}
|
|
96
|
+
* @see {@link WorkshiftGroup}
|
|
97
|
+
* @see {@link CompanyBranch}
|
|
98
|
+
* @see {@link CostCenter}
|
|
99
|
+
*
|
|
100
|
+
*/
|
|
101
|
+
export class Employee {
|
|
102
|
+
/**
|
|
103
|
+
* Identificador único do colaborador.
|
|
104
|
+
*/
|
|
105
|
+
private readonly _id: string;
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Código do colaborador.
|
|
109
|
+
*/
|
|
110
|
+
private readonly _code: number;
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Pessoa do colaborador.
|
|
114
|
+
*/
|
|
115
|
+
private readonly _person: Person;
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Data de admissão do colaborador.
|
|
119
|
+
*/
|
|
120
|
+
private readonly _hireDate: Date;
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Data de demissão do colaborador (opcional).
|
|
124
|
+
*/
|
|
125
|
+
private readonly _dismissalDate: Date | null;
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Vínculo do colaborador.
|
|
129
|
+
*/
|
|
130
|
+
private readonly _employmentRelationshipId: string;
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Empregador do colaborador.
|
|
134
|
+
*/
|
|
135
|
+
private readonly _employer: Employer;
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Código do centro de custo do colaborador (opcional).
|
|
139
|
+
*/
|
|
140
|
+
private readonly _costCenterKey: string;
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Código da filial do colaborador.
|
|
144
|
+
*/
|
|
145
|
+
private readonly _companyBranchKey: string;
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Código da escala do colaborador.
|
|
149
|
+
*/
|
|
150
|
+
private readonly _workshiftId: string;
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Código do turno da escala do colaborador.
|
|
154
|
+
*/
|
|
155
|
+
private readonly _workshiftGroupId: string;
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Código do cargo do colaborador.
|
|
159
|
+
*/
|
|
160
|
+
private readonly _jobPositionKey: string;
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* @hidden
|
|
164
|
+
* Construtor da classe Employee.
|
|
165
|
+
* @param params Parâmetros para inicializar o colaborador.
|
|
166
|
+
*/
|
|
167
|
+
constructor(params: EmployeeParams) {
|
|
168
|
+
this._id = params.id;
|
|
169
|
+
this._code = params.code;
|
|
170
|
+
this._person = params.person;
|
|
171
|
+
this._hireDate = ObjectUtils.toDateOrThrow(params.hireDate, "Employee.hireDate");
|
|
172
|
+
this._dismissalDate = ObjectUtils.toDateOrNull(params.dismissalDate);
|
|
173
|
+
this._employmentRelationshipId = params.employmentRelationshipId;
|
|
174
|
+
this._employer = params.employer;
|
|
175
|
+
this._costCenterKey = params.costCenterKey;
|
|
176
|
+
this._companyBranchKey = params.companyBranchKey;
|
|
177
|
+
this._workshiftId = params.workshiftId;
|
|
178
|
+
this._workshiftGroupId = params.workshiftGroupId;
|
|
179
|
+
this._jobPositionKey = params.jobPositionKey;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* @hidden
|
|
184
|
+
* Retorna o identificador único do colaborador.
|
|
185
|
+
*/
|
|
186
|
+
private get id(): string {
|
|
187
|
+
return this._id;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* Retorna o código do colaborador.
|
|
192
|
+
* @example
|
|
193
|
+
* ```typescript
|
|
194
|
+
* employee.code; // Retorna o código do colaborador.
|
|
195
|
+
* ```
|
|
196
|
+
* @returns Código do colaborador.
|
|
197
|
+
*
|
|
198
|
+
*/
|
|
199
|
+
get code(): number {
|
|
200
|
+
return this._code;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* Pessoa do colaborador, com informações pessoais como nome.
|
|
205
|
+
*
|
|
206
|
+
* @example
|
|
207
|
+
* ```typescript
|
|
208
|
+
* employee.person.name; // Retorna o nome do colaborador.
|
|
209
|
+
* ```
|
|
210
|
+
* @return Pessoa do colaborador.
|
|
211
|
+
* @see {@link Person}
|
|
212
|
+
*/
|
|
213
|
+
get person(): Person {
|
|
214
|
+
return this._person;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* Retorna a data de admissão do colaborador.
|
|
219
|
+
*
|
|
220
|
+
* @example
|
|
221
|
+
* ```typescript
|
|
222
|
+
* employee.hireDate; // Retorna a data de admissão do colaborador.
|
|
223
|
+
* ```
|
|
224
|
+
* @return Data de admissão do colaborador.
|
|
225
|
+
* @see {@link DateUtils}
|
|
226
|
+
*/
|
|
227
|
+
get hireDate(): Date {
|
|
228
|
+
return this._hireDate;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* Retorna a data de demissão do colaborador ou null se não houver.
|
|
233
|
+
* @example
|
|
234
|
+
* ```typescript
|
|
235
|
+
* employee.dismissalDate; // Retorna a data de demissão do colaborador, ou null se não houver.
|
|
236
|
+
* ```
|
|
237
|
+
* @return Data de demissão do colaborador ou null se não houver.
|
|
238
|
+
* @see {@link DateUtils}
|
|
239
|
+
*/
|
|
240
|
+
get dismissalDate(): Date | null {
|
|
241
|
+
return this._dismissalDate;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* @hidden
|
|
246
|
+
* Retorna o ID do vínculo do colaborador.
|
|
247
|
+
*/
|
|
248
|
+
private get employmentRelationshipId(): string {
|
|
249
|
+
return this._employmentRelationshipId;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* Retorna o vínculo do colaborador.
|
|
254
|
+
*
|
|
255
|
+
* @example
|
|
256
|
+
* ```typescript
|
|
257
|
+
* employee.employmentRelationship; // Retorna o vínculo do colaborador.
|
|
258
|
+
* ```
|
|
259
|
+
* @return Vínculo do colaborador.
|
|
260
|
+
* @see {@link EmploymentRelationship}
|
|
261
|
+
*
|
|
262
|
+
*/
|
|
263
|
+
get employmentRelationship(): EmploymentRelationship {
|
|
264
|
+
const employmentRelationship = ContextReference.getGlobalInstance().getEmploymentRelationship(this._employmentRelationshipId);
|
|
265
|
+
if (!employmentRelationship) {
|
|
266
|
+
throw new Error(`Employment relationship not found for key: ${this._employmentRelationshipId}`);
|
|
267
|
+
}
|
|
268
|
+
return employmentRelationship;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
/**
|
|
272
|
+
* Retorna a empresa do colaborador.
|
|
273
|
+
* @example
|
|
274
|
+
* ```typescript
|
|
275
|
+
* const employeer = employee.employer; // Retorna a empresa do colaborador.
|
|
276
|
+
* employer.code; // Retorna o código da empresa.
|
|
277
|
+
* ```
|
|
278
|
+
* @return Empresa do colaborador.
|
|
279
|
+
* @see {@link Employer}
|
|
280
|
+
*/
|
|
281
|
+
get employer(): Employer {
|
|
282
|
+
return this._employer;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
* @hidden
|
|
287
|
+
* Retorna a chave do contexto do centro de custo.
|
|
288
|
+
*/
|
|
289
|
+
private get costCenterKey(): string {
|
|
290
|
+
return this._costCenterKey;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
/**
|
|
294
|
+
* Retorna o centro de custo do colaborador ou null se não houver.
|
|
295
|
+
* @example
|
|
296
|
+
* ```typescript
|
|
297
|
+
* const costCenter = employee.costCenter; // Retorna o centro de custo do colaborador, ou null se não houver.
|
|
298
|
+
* costCenter ? costCenter.code : null; // Retorna o código do centro de custo, ou null.
|
|
299
|
+
* ```
|
|
300
|
+
* @return Centro de custo do colaborador ou null se não houver.
|
|
301
|
+
* @see {@link CostCenter}
|
|
302
|
+
*/
|
|
303
|
+
get costCenter(): CostCenter {
|
|
304
|
+
const costCenter = ContextReference.getGlobalInstance().getCostCenter(this._costCenterKey);
|
|
305
|
+
if (!costCenter) {
|
|
306
|
+
throw new Error(`Cost center not found for key: ${this._costCenterKey}`);
|
|
307
|
+
}
|
|
308
|
+
return costCenter;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
/**
|
|
312
|
+
* @hidden
|
|
313
|
+
* Retorna a chave da filial do colaborador para buscar no context.
|
|
314
|
+
*/
|
|
315
|
+
private get companyBranchKey(): string {
|
|
316
|
+
return this._companyBranchKey;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
/**
|
|
320
|
+
* @hidden
|
|
321
|
+
* Retorna o ID da escala do colaborador para buscar no context.
|
|
322
|
+
*/
|
|
323
|
+
private get workshiftId(): string {
|
|
324
|
+
return this._workshiftId;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
/**
|
|
328
|
+
* @hidden
|
|
329
|
+
* Retorna o código da turma da escala do colaborador para buscar no context.
|
|
330
|
+
*/
|
|
331
|
+
private get workshiftGroupId(): string {
|
|
332
|
+
return this._workshiftGroupId;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
/**
|
|
336
|
+
* @hidden
|
|
337
|
+
* Retorna a chave do cargo do colaborador para buscar no context.
|
|
338
|
+
*/
|
|
339
|
+
private get jobPositionKey(): string {
|
|
340
|
+
return this._jobPositionKey;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
/**
|
|
344
|
+
* Retorna o cargo do colaborador.
|
|
345
|
+
*
|
|
346
|
+
* @example
|
|
347
|
+
* ```typescript
|
|
348
|
+
* const jobPosition = employee.jobPosition; // Retorna o cargo do colaborador.
|
|
349
|
+
* jobPosition.name; // Retorna o nome do cargo.
|
|
350
|
+
* ```
|
|
351
|
+
* @return Cargo do colaborador.
|
|
352
|
+
* @see {@link JobPosition}
|
|
353
|
+
*/
|
|
354
|
+
get jobPosition(): JobPosition {
|
|
355
|
+
const joobPosition = ContextReference.getGlobalInstance().getJobPosition(this._jobPositionKey);
|
|
356
|
+
if (!joobPosition) {
|
|
357
|
+
throw new Error(`Job Position with ID ${this._jobPositionKey} not found in context.`);
|
|
358
|
+
}
|
|
359
|
+
return joobPosition;
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
/**
|
|
363
|
+
* Retorna o turma da escala do colaborador.
|
|
364
|
+
*
|
|
365
|
+
* @example
|
|
366
|
+
* ```typescript
|
|
367
|
+
* const workshiftGroup = employee.workshiftGroup; // Retorna a o turma da escala do colaborador.
|
|
368
|
+
* workshiftGroup.code; // Retorna o código do turma da escala.
|
|
369
|
+
* ```
|
|
370
|
+
* @return Turma da escala do colaborador.
|
|
371
|
+
* @see {@link WorkshiftGroup}
|
|
372
|
+
*/
|
|
373
|
+
get workshiftGroup(): WorkshiftGroup {
|
|
374
|
+
const workshiftGroup = ContextReference.getGlobalInstance().getWorkshiftGroup(this._workshiftGroupId);
|
|
375
|
+
if (!workshiftGroup) {
|
|
376
|
+
throw new Error(`Workshift group with ID ${this._workshiftGroupId} not found in context.`);
|
|
377
|
+
}
|
|
378
|
+
return workshiftGroup;
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
/**
|
|
382
|
+
* Retorna a escala do colaborador.
|
|
383
|
+
*
|
|
384
|
+
* @example
|
|
385
|
+
* ```typescript
|
|
386
|
+
* const workshift = employee.workshift; // Retorna a escala do colaborador.
|
|
387
|
+
* workshift.code; // Retorna o código da escala.
|
|
388
|
+
* ```
|
|
389
|
+
* @return Escala do colaborador.
|
|
390
|
+
* @see {@link Workshift}
|
|
391
|
+
*/
|
|
392
|
+
get workshift(): Workshift {
|
|
393
|
+
const workshift = ContextReference.getGlobalInstance().getWorkshift(this._workshiftId);
|
|
394
|
+
if (!workshift) {
|
|
395
|
+
throw new Error(`Workshift with ID ${this._workshiftId} not found in context.`);
|
|
396
|
+
}
|
|
397
|
+
return workshift;
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
/**
|
|
401
|
+
* Retorna a filial do colaborador.
|
|
402
|
+
* @example
|
|
403
|
+
* ```typescript
|
|
404
|
+
* const companyBranch = employee.companyBranch; // Retorna a filial do colaborador.
|
|
405
|
+
* companyBranch.code; // Retorna o código da filial.
|
|
406
|
+
* ```
|
|
407
|
+
* @return Filial do colaborador.
|
|
408
|
+
* @see {@link CompanyBranch}
|
|
409
|
+
*/
|
|
410
|
+
get companyBranch(): CompanyBranch {
|
|
411
|
+
const companyBranch = ContextReference.getGlobalInstance().getCompanyBranch(this._companyBranchKey);
|
|
412
|
+
if (!companyBranch) {
|
|
413
|
+
throw new Error(`Company branch with ID ${this._companyBranchKey} not found in context.`);
|
|
414
|
+
}
|
|
415
|
+
return companyBranch;
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
public static clone(employee: Employee): Employee {
|
|
419
|
+
return new Employee({
|
|
420
|
+
id: employee.id,
|
|
421
|
+
code: employee.code,
|
|
422
|
+
person: employee.person,
|
|
423
|
+
hireDate: employee.hireDate,
|
|
424
|
+
dismissalDate: employee.dismissalDate,
|
|
425
|
+
employmentRelationshipId: employee.employmentRelationshipId,
|
|
426
|
+
employer: employee.employer,
|
|
427
|
+
costCenterKey: employee.costCenterKey,
|
|
428
|
+
companyBranchKey: employee.companyBranchKey,
|
|
429
|
+
workshiftId: employee.workshiftId,
|
|
430
|
+
workshiftGroupId: employee.workshiftGroupId,
|
|
431
|
+
jobPositionKey: employee.jobPositionKey,
|
|
432
|
+
});
|
|
433
|
+
}
|
|
434
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @hidden
|
|
3
|
+
* Parâmetros para a criação de CompanyBranch.
|
|
4
|
+
*/
|
|
5
|
+
export interface CompanyBranchParams {
|
|
6
|
+
key: string;
|
|
7
|
+
code: number;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Representa uma filial de empresa.
|
|
12
|
+
*
|
|
13
|
+
* Exemplo de uso:
|
|
14
|
+
* ```typescript
|
|
15
|
+
* companyBranch.code; // Retorna o código da filial.
|
|
16
|
+
* ```
|
|
17
|
+
*
|
|
18
|
+
*/
|
|
19
|
+
export class CompanyBranch {
|
|
20
|
+
private readonly _key: string;
|
|
21
|
+
private readonly _code: number;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* @hidden
|
|
25
|
+
* Construtor da classe CompanyBranch.
|
|
26
|
+
* @param params Parâmetros para inicializar a filial da empresa.
|
|
27
|
+
*/
|
|
28
|
+
constructor(params: CompanyBranchParams) {
|
|
29
|
+
this._key = params.key;
|
|
30
|
+
this._code = params.code;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* @hidden
|
|
35
|
+
* Chave única da filial.
|
|
36
|
+
* @returns Chave única da filial.
|
|
37
|
+
*/
|
|
38
|
+
static getKey(companyBrach: CompanyBranch): string {
|
|
39
|
+
return companyBrach.key;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
private get key(): string {
|
|
43
|
+
return this._key;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Código da filial.
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* ```typescript
|
|
51
|
+
* companyBranch.code; // Retorna o código da filial.
|
|
52
|
+
* ```
|
|
53
|
+
*
|
|
54
|
+
* @returns Código da filial.
|
|
55
|
+
*/
|
|
56
|
+
get code(): number {
|
|
57
|
+
return this._code;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
public static clone(companyBranch: CompanyBranch): CompanyBranch {
|
|
61
|
+
return new CompanyBranch({
|
|
62
|
+
key: companyBranch.key,
|
|
63
|
+
code: companyBranch.code
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @hidden
|
|
3
|
+
*/
|
|
4
|
+
export interface CostCenterParams {
|
|
5
|
+
/**
|
|
6
|
+
* Código do centro de custo.
|
|
7
|
+
*/
|
|
8
|
+
code: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Representa um centro de custo.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```javascript
|
|
16
|
+
* console.log(costCenter.code); // Retorna o código do centro de custo.
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export class CostCenter {
|
|
20
|
+
/**
|
|
21
|
+
* Código do centro de custo.
|
|
22
|
+
*/
|
|
23
|
+
private readonly _code: string;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* @hidden
|
|
27
|
+
* @param params Parâmetros para a criação de CostCenter.
|
|
28
|
+
*/
|
|
29
|
+
constructor(params: CostCenterParams) {
|
|
30
|
+
this._code = params.code;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Código do centro de custo.
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```javascript
|
|
39
|
+
* console.log(costCenter.code); // Retorna o código do centro de custo.
|
|
40
|
+
* ```
|
|
41
|
+
*
|
|
42
|
+
* @returns Código do centro de custo.
|
|
43
|
+
*/
|
|
44
|
+
get code(): string {
|
|
45
|
+
return this._code;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* @hidden
|
|
4
|
+
*/
|
|
5
|
+
export interface EmployerParams {
|
|
6
|
+
code: number;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Representa uma empresa no sistema.
|
|
11
|
+
*/
|
|
12
|
+
export class Employer {
|
|
13
|
+
private readonly _code: number;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @hidden
|
|
17
|
+
*/
|
|
18
|
+
constructor(params: EmployerParams) {
|
|
19
|
+
this._code = params.code;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Retorna o código da empresa.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```typescript
|
|
27
|
+
* let code = employer.code; // Retorna o código da empresa.
|
|
28
|
+
* ```
|
|
29
|
+
*
|
|
30
|
+
* @return Código da empresa.
|
|
31
|
+
*/
|
|
32
|
+
get code(): number {
|
|
33
|
+
return this._code;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { ContractType } from "../contract/contract";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @hidden
|
|
5
|
+
*/
|
|
6
|
+
export interface EmploymentRelationshipParams {
|
|
7
|
+
id: string;
|
|
8
|
+
code: string;
|
|
9
|
+
contractType: ContractType;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Representa um vínculo empregatício.
|
|
14
|
+
* Um vínculo empregatício é uma associação entre um colaborador e uma empresa, que define o tipo de contrato e outras informações relevantes.
|
|
15
|
+
*/
|
|
16
|
+
export class EmploymentRelationship {
|
|
17
|
+
|
|
18
|
+
private readonly _id: string;
|
|
19
|
+
private readonly _code: string;
|
|
20
|
+
private readonly _contractType: ContractType;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* @hidden
|
|
24
|
+
*/
|
|
25
|
+
constructor(params: EmploymentRelationshipParams) {
|
|
26
|
+
this._id = params.id
|
|
27
|
+
this._code = params.code;
|
|
28
|
+
this._contractType = params.contractType;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Retorna o identificador único do vínculo empregatício.
|
|
33
|
+
* @return O ID do vínculo empregatício.
|
|
34
|
+
* @hidden
|
|
35
|
+
**/
|
|
36
|
+
get id(): string {
|
|
37
|
+
return this._id;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Retorna o código do vínculo empregatício.
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```typescript
|
|
44
|
+
* let code = employmentRelationship.code; // Retorna o código do vínculo empregatício.
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
get code(): string {
|
|
48
|
+
return this._code;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Retorna tipo de contrato associado ao vínculo empregatício.
|
|
53
|
+
* @example
|
|
54
|
+
* ```typescript
|
|
55
|
+
* let contractType = employmentRelationship.contractType; // Retorna o tipo de contrato associado ao vínculo empregatício.
|
|
56
|
+
* ```
|
|
57
|
+
* @return O tipo de contrato associado ao vínculo empregatício.
|
|
58
|
+
* @see {@link ContractType}
|
|
59
|
+
*/
|
|
60
|
+
get contractType(): ContractType {
|
|
61
|
+
return this._contractType;
|
|
62
|
+
}
|
|
63
|
+
}
|