@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,126 @@
|
|
|
1
|
+
import { Schedules, SchedulesParams } from "../../../src/data/schedules/schedules";
|
|
2
|
+
import { Bridge } from "../../../src/data/schedules/bridge";
|
|
3
|
+
import { BridgeBuilder } from "./bridgeBuilder.builder";
|
|
4
|
+
import { WorkscheduleChange } from "../../data/schedules/workscheduleChange";
|
|
5
|
+
import { Readiness } from "../../data/schedules/readiness";
|
|
6
|
+
import { ReadinessBuilder } from "./readinessBuilder.builder";
|
|
7
|
+
import { OvertimeAuthorization } from "../../data/schedules/overtimeAuthorization";
|
|
8
|
+
import { OvertimeAuthorizationBuilder } from "./overtimeAuthorization.builder";
|
|
9
|
+
import { Compensation } from "../../../src/data/schedules/compensation";
|
|
10
|
+
import { CompensationBuilder } from "./compensation.builder";
|
|
11
|
+
import { CompensationType, PeriodType } from '../../data/schedules/compensation';
|
|
12
|
+
|
|
13
|
+
export class SchedulesBuilder {
|
|
14
|
+
private bridges: Bridge[] = [
|
|
15
|
+
BridgeBuilder.builder().withOriginDate(new Date("2023-01-01")).withDestinationDate(new Date("2023-01-02")).build(),
|
|
16
|
+
BridgeBuilder.builder().withOriginDate(new Date("2023-02-01")).withDestinationDate(new Date("2023-02-02")).build()
|
|
17
|
+
];
|
|
18
|
+
|
|
19
|
+
private readiness: Readiness[] = [
|
|
20
|
+
ReadinessBuilder.builder()
|
|
21
|
+
.withStartDate(new Date("2023-01-01"))
|
|
22
|
+
.withEndDate(new Date("2023-01-02"))
|
|
23
|
+
.withStartTime(8)
|
|
24
|
+
.withEndTime(17)
|
|
25
|
+
.withContinuous(true)
|
|
26
|
+
.withSituationId("situation123")
|
|
27
|
+
.build(),
|
|
28
|
+
ReadinessBuilder.builder()
|
|
29
|
+
.withStartDate(new Date("2023-02-01"))
|
|
30
|
+
.withEndDate(new Date("2023-02-02"))
|
|
31
|
+
.withStartTime(9)
|
|
32
|
+
.withEndTime(18)
|
|
33
|
+
.withContinuous(false)
|
|
34
|
+
.withSituationId("situation456")
|
|
35
|
+
.build()
|
|
36
|
+
];
|
|
37
|
+
|
|
38
|
+
private overtimeAuthorizations: OvertimeAuthorization[] = [
|
|
39
|
+
OvertimeAuthorizationBuilder.builder()
|
|
40
|
+
.withStartDate(new Date("2023-01-01"))
|
|
41
|
+
.withEndDate(new Date("2023-01-02"))
|
|
42
|
+
.withStartTime(9)
|
|
43
|
+
.withEndTime(17)
|
|
44
|
+
.build(),
|
|
45
|
+
OvertimeAuthorizationBuilder.builder()
|
|
46
|
+
.withStartDate(new Date("2023-02-01"))
|
|
47
|
+
.withEndDate(new Date("2023-02-02"))
|
|
48
|
+
.withStartTime(10)
|
|
49
|
+
.withEndTime(18)
|
|
50
|
+
.build()
|
|
51
|
+
];
|
|
52
|
+
|
|
53
|
+
private compensations: Compensation[] = [
|
|
54
|
+
CompensationBuilder.default()
|
|
55
|
+
.withStartDate(new Date("2023-01-01"))
|
|
56
|
+
.withEndDate(new Date("2023-01-31"))
|
|
57
|
+
.withIntervalStart(480) // 08:00
|
|
58
|
+
.withIntervalEnd(1020) // 17:00
|
|
59
|
+
.withCompensationType(CompensationType.ABSENCE_FOR_COMPENSATION)
|
|
60
|
+
.withPeriodType(PeriodType.ANY_PART_OF_WORKDAY)
|
|
61
|
+
.withNumberOfHours(8)
|
|
62
|
+
.withSituationId("situation-123")
|
|
63
|
+
.withWorkscheduleId("workschedule-456")
|
|
64
|
+
.build(),
|
|
65
|
+
CompensationBuilder.default()
|
|
66
|
+
.withStartDate(new Date("2023-02-01"))
|
|
67
|
+
.withEndDate(new Date("2023-02-28"))
|
|
68
|
+
.withIntervalStart(480) // 08:00
|
|
69
|
+
.withIntervalEnd(1020) // 17:00
|
|
70
|
+
.withCompensationType(CompensationType.ABSENCE_FOR_COMPENSATION)
|
|
71
|
+
.withPeriodType(PeriodType.ANY_PART_OF_WORKDAY)
|
|
72
|
+
.withNumberOfHours(8)
|
|
73
|
+
.withSituationId("situation-456")
|
|
74
|
+
.withWorkscheduleId("workschedule-789")
|
|
75
|
+
.build()
|
|
76
|
+
];
|
|
77
|
+
|
|
78
|
+
private workscheduleChanges: WorkscheduleChange[] = []; // Placeholder for future workshift changes
|
|
79
|
+
|
|
80
|
+
static builder(): SchedulesBuilder {
|
|
81
|
+
return new SchedulesBuilder();
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
static default(): SchedulesBuilder {
|
|
85
|
+
return new SchedulesBuilder();
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
withBridges(bridges: Bridge[]): SchedulesBuilder {
|
|
89
|
+
this.bridges = bridges;
|
|
90
|
+
return this;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
withWorkscheduleChanges(workscheduleChanges: WorkscheduleChange[]): SchedulesBuilder {
|
|
94
|
+
this.workscheduleChanges = workscheduleChanges;
|
|
95
|
+
return this;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
withReadiness(readiness: Readiness[]): SchedulesBuilder {
|
|
99
|
+
this.readiness = readiness;
|
|
100
|
+
return this;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
withOvertimeAuthorizations(overtimeAuthorizations: OvertimeAuthorization[]): SchedulesBuilder {
|
|
104
|
+
this.overtimeAuthorizations = overtimeAuthorizations;
|
|
105
|
+
return this;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
withCompensations(compensations: Compensation[]): SchedulesBuilder {
|
|
109
|
+
this.compensations = compensations;
|
|
110
|
+
return this;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
build(): Schedules {
|
|
114
|
+
const params: SchedulesParams = {
|
|
115
|
+
bridges: this.bridges,
|
|
116
|
+
workscheduleChanges: [],
|
|
117
|
+
workshiftChanges: [],
|
|
118
|
+
readinesses: this.readiness,
|
|
119
|
+
overtimeAuthorizations: this.overtimeAuthorizations,
|
|
120
|
+
compensations: this.compensations,
|
|
121
|
+
};
|
|
122
|
+
return new Schedules(
|
|
123
|
+
params
|
|
124
|
+
);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { Situation, SituationParams, SituationType } from "../../../src/data/foundation/situation";
|
|
2
|
+
|
|
3
|
+
export class SituationBuilder {
|
|
4
|
+
private id = "02190811-5317-451c-bbe7-8920a570677d";
|
|
5
|
+
private code = 1;
|
|
6
|
+
private type = SituationType.WORKING;
|
|
7
|
+
private exception = false;
|
|
8
|
+
private daytime = true;
|
|
9
|
+
private complementarySituationId = "02190811-5317-451c-bbe7-8920a570677d";
|
|
10
|
+
|
|
11
|
+
static builder(): SituationBuilder {
|
|
12
|
+
return new SituationBuilder();
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
public withId(id: string): SituationBuilder {
|
|
16
|
+
this.id = id;
|
|
17
|
+
return this;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
public withCode(code: number): SituationBuilder {
|
|
21
|
+
this.code = code;
|
|
22
|
+
return this;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
public withType(type: SituationType): SituationBuilder {
|
|
26
|
+
this.type = type;
|
|
27
|
+
return this;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
public withException(exception: boolean): SituationBuilder {
|
|
31
|
+
this.exception = exception;
|
|
32
|
+
return this;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
public withDaytime(daytime: boolean): SituationBuilder {
|
|
36
|
+
this.daytime = daytime;
|
|
37
|
+
return this;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
public withComplementarySituationId(complementarySituationId: string): SituationBuilder {
|
|
41
|
+
this.complementarySituationId = complementarySituationId;
|
|
42
|
+
return this;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
public build(): Situation {
|
|
48
|
+
const params: SituationParams = {
|
|
49
|
+
id: this.id,
|
|
50
|
+
code: this.code,
|
|
51
|
+
type: this.type,
|
|
52
|
+
exception: this.exception,
|
|
53
|
+
daytime: this.daytime,
|
|
54
|
+
complementarySituationId: this.complementarySituationId
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
return new Situation(params);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { Syndicate, SyndicateParams } from "../../data/foundation/syndicate";
|
|
2
|
+
|
|
3
|
+
export class SyndicateBuilder {
|
|
4
|
+
|
|
5
|
+
private key = "1";
|
|
6
|
+
private code = 1;
|
|
7
|
+
private nightStartHour = 1320;
|
|
8
|
+
private nightEndHour = 300;
|
|
9
|
+
private minimumInterval4to6Hours = 540;
|
|
10
|
+
private minimumInterval6Hours = 60;
|
|
11
|
+
private minimumWorkDuration6Hours = 60;
|
|
12
|
+
private maxDailyWorkTime = 480;
|
|
13
|
+
private maxContinuousDrivingTime = 540;
|
|
14
|
+
private minContinuousRestTime = 60;
|
|
15
|
+
private allowDailyRestFractionation = false;
|
|
16
|
+
private calculateWeeklyRest = false;
|
|
17
|
+
|
|
18
|
+
public withKey(key: string): SyndicateBuilder {
|
|
19
|
+
this.key = key;
|
|
20
|
+
return this;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
public withCode(code: number): SyndicateBuilder {
|
|
24
|
+
this.code = code;
|
|
25
|
+
return this;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
public withNightStartHour(hour: number): SyndicateBuilder {
|
|
29
|
+
this.nightStartHour = hour;
|
|
30
|
+
return this;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
public withNightEndHour(hour: number): SyndicateBuilder {
|
|
34
|
+
this.nightEndHour = hour;
|
|
35
|
+
return this;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
public withMinimumInterval4to6Hours(interval: number): SyndicateBuilder {
|
|
39
|
+
this.minimumInterval4to6Hours = interval;
|
|
40
|
+
return this;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
public withMinimumInterval6Hours(interval: number): SyndicateBuilder {
|
|
44
|
+
this.minimumInterval6Hours = interval;
|
|
45
|
+
return this;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
public withMinimumWorkDuration6Hours(duration: number): SyndicateBuilder {
|
|
49
|
+
this.minimumWorkDuration6Hours = duration;
|
|
50
|
+
return this;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
public withMaxDailyWorkTime(time: number): SyndicateBuilder {
|
|
54
|
+
this.maxDailyWorkTime = time;
|
|
55
|
+
return this;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
public withMaxContinuousDrivingTime(time: number): SyndicateBuilder {
|
|
59
|
+
this.maxContinuousDrivingTime = time;
|
|
60
|
+
return this;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
public withMinContinuousRestTime(time: number): SyndicateBuilder {
|
|
64
|
+
this.minContinuousRestTime = time;
|
|
65
|
+
return this;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
public withAllowDailyRestFractionation(allow: boolean): SyndicateBuilder {
|
|
69
|
+
this.allowDailyRestFractionation = allow;
|
|
70
|
+
return this;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
public withCalculateWeeklyRest(calculate: boolean): SyndicateBuilder {
|
|
74
|
+
this.calculateWeeklyRest = calculate;
|
|
75
|
+
return this;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
public build(): Syndicate {
|
|
79
|
+
const params: SyndicateParams = {
|
|
80
|
+
key: this.key,
|
|
81
|
+
code: this.code,
|
|
82
|
+
nightStartHour: this.nightStartHour,
|
|
83
|
+
nightEndHour: this.nightEndHour,
|
|
84
|
+
minimumInterval4to6Hours: this.minimumInterval4to6Hours,
|
|
85
|
+
minimumInterval6Hours: this.minimumInterval6Hours,
|
|
86
|
+
minimumWorkDuration6Hours: this.minimumWorkDuration6Hours,
|
|
87
|
+
maxDailyWorkTime: this.maxDailyWorkTime,
|
|
88
|
+
maxContinuousDrivingTime: this.maxContinuousDrivingTime,
|
|
89
|
+
minContinuousRestTime: this.minContinuousRestTime,
|
|
90
|
+
allowDailyRestFractionation: this.allowDailyRestFractionation,
|
|
91
|
+
calculateWeeklyRest: this.calculateWeeklyRest,
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
return new Syndicate(params);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { SyndicateHistory, SyndicateHistoryParams } from "../../data/histories/syndicateHistory";
|
|
2
|
+
import { CollectiveNegotiation } from "../../data/collectiveNegotiation";
|
|
3
|
+
import { Syndicate } from "../../data/syndicate";
|
|
4
|
+
|
|
5
|
+
export class SyndicateHistoryBuilder {
|
|
6
|
+
static defaultParams(): SyndicateHistoryParams {
|
|
7
|
+
return {
|
|
8
|
+
id: "sh1",
|
|
9
|
+
collectiveNegotiation: {} as CollectiveNegotiation,
|
|
10
|
+
syndicate: {} as Syndicate,
|
|
11
|
+
startDate: new Date("2023-01-01"),
|
|
12
|
+
endDate: new Date("2023-12-31"),
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
static default(): { build: () => SyndicateHistory } {
|
|
17
|
+
return {
|
|
18
|
+
build: (): SyndicateHistory => {
|
|
19
|
+
return new SyndicateHistory(this.defaultParams());
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
static withParams(params: Partial<SyndicateHistoryParams>): { build: () => SyndicateHistory } {
|
|
25
|
+
return {
|
|
26
|
+
build: (): SyndicateHistory => {
|
|
27
|
+
const def = this.defaultParams();
|
|
28
|
+
const merged: SyndicateHistoryParams = { ...def, ...params };
|
|
29
|
+
return new SyndicateHistory(merged);
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { ClockingEventBuilder } from "./clockingEvent.builder";
|
|
2
|
+
import { IntervalBuilder } from "./interval.builder";
|
|
3
|
+
import { TimeEvaluationSituationBuilder } from "./timeEvaluationSituation.builder";
|
|
4
|
+
import { TimeEvaluation, TimeEvaluationParams } from "../../../src/data/timeEvaluation/timeEvaluation";
|
|
5
|
+
import { TimeEvaluationSituation } from "../../../src/data/timeEvaluation/timeEvaluationSituation";
|
|
6
|
+
import { ClockingEvent } from "../../../src/data/timeEvaluation/clockingEvent";
|
|
7
|
+
import { Interval } from "../../../src/data/timeEvaluation/interval";
|
|
8
|
+
import { SchedulesBuilder } from "./schedules.builder";
|
|
9
|
+
import { Schedules } from "../../../src/data/schedules/schedules";
|
|
10
|
+
import { HourBankAccountBuilder } from "./hourBankAccountBuilder";
|
|
11
|
+
import { HourBankAccount } from "../../data/hourBank/hourBankAccount";
|
|
12
|
+
import { Histories } from "../../data/histories/histories";
|
|
13
|
+
import { EstimatedHours } from '../../data/timeEvaluation/estimatedHours';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Builder para a classe TimeEvaluation.
|
|
17
|
+
* Este builder é utilizado para criar objetos de teste da classe TimeEvaluation.
|
|
18
|
+
*/
|
|
19
|
+
export class TimeEvaluationBuilder {
|
|
20
|
+
private date = new Date("2025-01-01");
|
|
21
|
+
private workscheduleId = "";
|
|
22
|
+
private workscheduleWorkshiftId = "";
|
|
23
|
+
private workshiftId = "";
|
|
24
|
+
private timeEvaluationSituations = [new TimeEvaluationSituationBuilder().build()];
|
|
25
|
+
private clockingEvents = [new ClockingEventBuilder().build()];
|
|
26
|
+
private intervals = [new IntervalBuilder().build()];
|
|
27
|
+
private schedule = SchedulesBuilder.builder().build();
|
|
28
|
+
private hourBankAccounts = [HourBankAccountBuilder.builder().build()];
|
|
29
|
+
private situationDefinitionKey = "";
|
|
30
|
+
private costCenterKey = "";
|
|
31
|
+
private histories = new Histories({
|
|
32
|
+
jobPositionHistories: [],
|
|
33
|
+
companyBranchHistories: [],
|
|
34
|
+
employmentRelationshipHistories: [],
|
|
35
|
+
timeEvaluationHistories: [],
|
|
36
|
+
workshiftHistories: [],
|
|
37
|
+
leaveHistories: [],
|
|
38
|
+
costCenterHistories: []
|
|
39
|
+
});
|
|
40
|
+
private estimatedHoursObject = {
|
|
41
|
+
meal: [],
|
|
42
|
+
snack: [],
|
|
43
|
+
work: [],
|
|
44
|
+
};
|
|
45
|
+
private estimatedHours = new EstimatedHours(this.estimatedHoursObject);
|
|
46
|
+
private syndicateId = "";
|
|
47
|
+
|
|
48
|
+
static builder(): TimeEvaluationBuilder {
|
|
49
|
+
return new TimeEvaluationBuilder();
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
static default(): TimeEvaluation {
|
|
53
|
+
return new TimeEvaluationBuilder().build();
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
withSchedule(schedule: Schedules): TimeEvaluationBuilder {
|
|
58
|
+
this.schedule = schedule;
|
|
59
|
+
return this;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
withSituationDefinitionKey(situationDefinitionKey: string): TimeEvaluationBuilder {
|
|
63
|
+
this.situationDefinitionKey = situationDefinitionKey;
|
|
64
|
+
return this;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
withDate(date: Date): TimeEvaluationBuilder {
|
|
68
|
+
this.date = date;
|
|
69
|
+
return this;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
withWorkschedule(workscheduleId: string): TimeEvaluationBuilder {
|
|
73
|
+
this.workscheduleId = workscheduleId;
|
|
74
|
+
return this;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
withWorkscheduleWorkshift(workscheduleWorkshiftId: string): TimeEvaluationBuilder {
|
|
78
|
+
this.workscheduleWorkshiftId = workscheduleWorkshiftId;
|
|
79
|
+
return this;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
withWorkshift(workshiftId: string): TimeEvaluationBuilder {
|
|
83
|
+
this.workshiftId = workshiftId;
|
|
84
|
+
return this;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
withTimeEvaluationSituations(timeEvaluationSituations: TimeEvaluationSituation[]): TimeEvaluationBuilder {
|
|
88
|
+
this.timeEvaluationSituations = timeEvaluationSituations;
|
|
89
|
+
return this;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
withClockingEvents(clockingEvents: ClockingEvent[]): TimeEvaluationBuilder {
|
|
93
|
+
this.clockingEvents = clockingEvents;
|
|
94
|
+
return this;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
withIntervals(intervals: Interval[]): TimeEvaluationBuilder {
|
|
98
|
+
this.intervals = intervals;
|
|
99
|
+
return this;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
withHourBankAccounts(hourBankAccounts: HourBankAccount[]): TimeEvaluationBuilder {
|
|
103
|
+
this.hourBankAccounts = hourBankAccounts;
|
|
104
|
+
return this;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
withSyndicate(syndicateId: string): TimeEvaluationBuilder {
|
|
108
|
+
this.syndicateId = syndicateId;
|
|
109
|
+
return this;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
withCostCenter(costCenterKey: string): TimeEvaluationBuilder {
|
|
113
|
+
this.costCenterKey = costCenterKey;
|
|
114
|
+
return this;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
build(): TimeEvaluation {
|
|
118
|
+
const params: TimeEvaluationParams = {
|
|
119
|
+
date: this.date,
|
|
120
|
+
missingClockingEvent: false,
|
|
121
|
+
workscheduleId: this.workscheduleId,
|
|
122
|
+
workscheduleWorkshiftId: this.workscheduleWorkshiftId,
|
|
123
|
+
workshiftId: this.workshiftId,
|
|
124
|
+
timeEvaluationSituations: this.timeEvaluationSituations,
|
|
125
|
+
clockingEvents: this.clockingEvents,
|
|
126
|
+
intervals: this.intervals,
|
|
127
|
+
schedules: this.schedule,
|
|
128
|
+
hourBankAccounts: this.hourBankAccounts,
|
|
129
|
+
situationDefinitionKey: this.situationDefinitionKey,
|
|
130
|
+
histories: this.histories,
|
|
131
|
+
estimatedHours: this.estimatedHours,
|
|
132
|
+
syndicateKey: this.syndicateId,
|
|
133
|
+
costCenterKey: this.costCenterKey,
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
return new TimeEvaluation(params);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { TimeEvaluationHistory, TimeEvaluationType } from "../../data/histories/timeEvaluationHistory";
|
|
2
|
+
import { ContextReferenceBuilder } from "./contextReference.builder";
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
export class TimeEvaluationHistoryBuilder {
|
|
6
|
+
private startDate = new Date("2024-1-1");
|
|
7
|
+
private endDate: Date | null = null;
|
|
8
|
+
private type = TimeEvaluationType.NORMAL;
|
|
9
|
+
private situationDefinitionKey: string[] = ["1_2022-11-23_null"];
|
|
10
|
+
private context = ContextReferenceBuilder.empty();
|
|
11
|
+
|
|
12
|
+
static builder(): TimeEvaluationHistoryBuilder {
|
|
13
|
+
return new TimeEvaluationHistoryBuilder();
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
withStartDate(startDate: Date): TimeEvaluationHistoryBuilder {
|
|
17
|
+
this.startDate = startDate;
|
|
18
|
+
return this;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
withEndDate(endDate: Date | null): TimeEvaluationHistoryBuilder {
|
|
22
|
+
this.endDate = endDate;
|
|
23
|
+
return this;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
withType(type: TimeEvaluationType): TimeEvaluationHistoryBuilder {
|
|
27
|
+
this.type = type;
|
|
28
|
+
return this;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
withSituationDefinitionKey(situationDefinitionKey: string): TimeEvaluationHistoryBuilder {
|
|
32
|
+
if (Array.isArray(situationDefinitionKey)) {
|
|
33
|
+
this.situationDefinitionKey = situationDefinitionKey;
|
|
34
|
+
} else {
|
|
35
|
+
this.situationDefinitionKey = [situationDefinitionKey];
|
|
36
|
+
}
|
|
37
|
+
return this;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
build(): TimeEvaluationHistory {
|
|
42
|
+
return new TimeEvaluationHistory({
|
|
43
|
+
startDate: this.startDate,
|
|
44
|
+
endDate: this.endDate,
|
|
45
|
+
type: this.type,
|
|
46
|
+
situationDefinitionKey: this.situationDefinitionKey
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { TimeEvaluationSituation, TimeEvaluationSituationParams } from "../../data/timeEvaluation/timeEvaluationSituation";
|
|
2
|
+
|
|
3
|
+
export class TimeEvaluationSituationBuilder {
|
|
4
|
+
private id = "default-id";
|
|
5
|
+
private situationId = "";
|
|
6
|
+
private situationCode = 1;
|
|
7
|
+
private numberOfHours = 8;
|
|
8
|
+
|
|
9
|
+
withId(id: string): this {
|
|
10
|
+
this.id = id;
|
|
11
|
+
return this;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
withSituation(situation: number): this {
|
|
15
|
+
this.situationCode = situation;
|
|
16
|
+
return this;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
withNumberOfHours(hours: number): this {
|
|
20
|
+
this.numberOfHours = hours;
|
|
21
|
+
return this;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
build(): TimeEvaluationSituation {
|
|
26
|
+
const params: TimeEvaluationSituationParams = {
|
|
27
|
+
situationId: this.situationId,
|
|
28
|
+
situationCode: this.situationCode,
|
|
29
|
+
numberOfHours: this.numberOfHours
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
return new TimeEvaluationSituation(params);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Workschedule,
|
|
3
|
+
WorkscheduleClockingRegister,
|
|
4
|
+
WorkscheduleClockingEvent,
|
|
5
|
+
WorkscheduleParams,
|
|
6
|
+
WorkscheduleType,
|
|
7
|
+
ClockingEventScheduleType,
|
|
8
|
+
WorkscheduleDefinitionType,
|
|
9
|
+
UsingType,
|
|
10
|
+
IntervalType
|
|
11
|
+
} from "../../data/foundation/workschedule";
|
|
12
|
+
|
|
13
|
+
export class WorkscheduleBuilder {
|
|
14
|
+
private id = "1";
|
|
15
|
+
private code = 1;
|
|
16
|
+
private type = WorkscheduleType.FLEXIBLE;
|
|
17
|
+
private definitionType = WorkscheduleDefinitionType.NORMAL;
|
|
18
|
+
private workload = 1;
|
|
19
|
+
private clockingRegisters = [
|
|
20
|
+
new WorkscheduleClockingRegister({
|
|
21
|
+
sequence: 1,
|
|
22
|
+
clockingEvent: 1,
|
|
23
|
+
toleranceBefore: 1,
|
|
24
|
+
toleranceAfter: 1,
|
|
25
|
+
mobilityBefore: 1,
|
|
26
|
+
mobilityAfter: 1,
|
|
27
|
+
intervalType: IntervalType.FLEXIBLE,
|
|
28
|
+
clockingEventScheduleType: ClockingEventScheduleType.GENERATED,
|
|
29
|
+
usingType: UsingType.MANDATORY_ENTRY_OR_EXIT,
|
|
30
|
+
}),
|
|
31
|
+
new WorkscheduleClockingRegister({
|
|
32
|
+
sequence: 2,
|
|
33
|
+
clockingEvent: 2,
|
|
34
|
+
toleranceBefore: 2,
|
|
35
|
+
toleranceAfter: 2,
|
|
36
|
+
mobilityBefore: 1,
|
|
37
|
+
mobilityAfter: 1,
|
|
38
|
+
intervalType: IntervalType.RIGID,
|
|
39
|
+
clockingEventScheduleType: ClockingEventScheduleType.GENERATED,
|
|
40
|
+
usingType: UsingType.NON_MANDATORY_ENTRY_OR_EXIT,
|
|
41
|
+
}),
|
|
42
|
+
];
|
|
43
|
+
|
|
44
|
+
private clockingEvent = new WorkscheduleClockingEvent({
|
|
45
|
+
workStartEndOvertimeTolerance: 1,
|
|
46
|
+
mealOvertimeTolerance: 1,
|
|
47
|
+
overtimeDailyTotalTolerance: 1,
|
|
48
|
+
absenceDailyTotalTolerance: 1,
|
|
49
|
+
workStartEndAbsenceTolerance: 1,
|
|
50
|
+
mealAbsenceTolerance: 1,
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
withCode(code: number): this {
|
|
54
|
+
this.code = code;
|
|
55
|
+
return this;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
withType(type: WorkscheduleType): this {
|
|
59
|
+
this.type = type;
|
|
60
|
+
return this;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
withDefinitionType(definitionType: WorkscheduleDefinitionType): this {
|
|
64
|
+
this.definitionType = definitionType;
|
|
65
|
+
return this;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
withClockingRegister(clockingRegisters: WorkscheduleClockingRegister[]): this {
|
|
69
|
+
this.clockingRegisters = clockingRegisters;
|
|
70
|
+
return this;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
withClockingEvent(clockingEvent: WorkscheduleClockingEvent): this {
|
|
74
|
+
this.clockingEvent = clockingEvent;
|
|
75
|
+
return this;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
withWorkload(workload: number): this {
|
|
79
|
+
this.workload = workload;
|
|
80
|
+
return this;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
build(): Workschedule {
|
|
84
|
+
const params: WorkscheduleParams = {
|
|
85
|
+
id :this.id,
|
|
86
|
+
code: this.code,
|
|
87
|
+
type: this.type,
|
|
88
|
+
definitionType: this.definitionType,
|
|
89
|
+
workload: this.workload,
|
|
90
|
+
clockingRegisters: this.clockingRegisters,
|
|
91
|
+
clockingEvent: this.clockingEvent,
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
return new Workschedule(params);
|
|
95
|
+
}
|
|
96
|
+
}
|