Skip to content

Commit 8706ede

Browse files
Ajoute le type de congé déménagement
1 parent d6088a8 commit 8706ede

File tree

9 files changed

+56
-5
lines changed

9 files changed

+56
-5
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import { MigrationInterface, QueryRunner } from 'typeorm';
2+
3+
export class AddRelocationLeave1719581515131
4+
implements MigrationInterface {
5+
name = 'AddRelocationLeave1719581515131';
6+
7+
public async up(queryRunner: QueryRunner): Promise<void> {
8+
await queryRunner.query(
9+
`ALTER TYPE "public"."leave_request_type_enum" RENAME TO "leave_request_type_enum_old"`
10+
);
11+
await queryRunner.query(
12+
`CREATE TYPE "public"."leave_request_type_enum" AS ENUM('paid', 'unpaid', 'special', 'medical', 'illimited', 'postponedWorkedFreeDay', 'relocation')`
13+
);
14+
await queryRunner.query(
15+
`ALTER TABLE "leave_request" ALTER COLUMN "type" TYPE "public"."leave_request_type_enum" USING "type"::"text"::"public"."leave_request_type_enum"`
16+
);
17+
await queryRunner.query(`DROP TYPE "public"."leave_request_type_enum_old"`);
18+
}
19+
20+
public async down(queryRunner: QueryRunner): Promise<void> {
21+
await queryRunner.query(
22+
`CREATE TYPE "public"."leave_request_type_enum_old" AS ENUM('paid', 'unpaid', 'special', 'medical', 'illimited', 'postponedWorkedFreeDay')`
23+
);
24+
await queryRunner.query(
25+
`ALTER TABLE "leave_request" ALTER COLUMN "type" TYPE "public"."leave_request_type_enum_old" USING "type"::"text"::"public"."leave_request_type_enum_old"`
26+
);
27+
await queryRunner.query(`DROP TYPE "public"."leave_request_type_enum"`);
28+
await queryRunner.query(
29+
`ALTER TYPE "public"."leave_request_type_enum_old" RENAME TO "leave_request_type_enum"`
30+
);
31+
}
32+
}

src/Application/HumanResource/Payslip/Query/GetUserElementsQueryHandler.spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ describe('GetUserElementsQueryHandler', () => {
169169
new UserLeavesView(0, []),
170170
new UserLeavesView(0, []),
171171
new UserLeavesView(0, []),
172+
new UserLeavesView(0, []),
172173
new UserLeavesView(0, [])
173174
)
174175
]);

src/Application/HumanResource/Payslip/Query/GetUsersElementsQueryHandler.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ export class GetUsersElementsQueryHandler {
6565
this.createUserLeavesView(userLeaves.unpaid, date),
6666
this.createUserLeavesView(userLeaves.medical, date),
6767
this.createUserLeavesView(userLeaves.special, date),
68-
this.createUserLeavesView(userLeaves.postponedWorkedFreeDay, date)
68+
this.createUserLeavesView(userLeaves.postponedWorkedFreeDay, date),
69+
this.createUserLeavesView(userLeaves.relocation, date)
6970
)
7071
);
7172
}

src/Application/HumanResource/Payslip/View/UserElementsView.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export class UserElementsView {
1818
public readonly unpaidLeaves: UserLeavesView,
1919
public readonly sickLeaves: UserLeavesView,
2020
public readonly exceptionalLeaves: UserLeavesView,
21-
public readonly postponedWorkedFreeDayLeaves: UserLeavesView
21+
public readonly postponedWorkedFreeDayLeaves: UserLeavesView,
22+
public readonly relocationLeaves: UserLeavesView
2223
) {}
2324
}

src/Domain/HumanResource/Leave/LeaveRequest.entity.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ export enum Type {
1313
SPECIAL = 'special',
1414
MEDICAL = 'medical',
1515
ILLIMITED = 'illimited',
16-
POSTPONED_WORKED_FREE_DAY = 'postponedWorkedFreeDay'
16+
POSTPONED_WORKED_FREE_DAY = 'postponedWorkedFreeDay',
17+
RELOCATION = 'relocation'
1718
}
1819

1920
export interface ILeaveRequestModeration {

src/Domain/HumanResource/Leave/UserLeavesCollection.spec.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,16 @@ describe('UserLeavesCollection', () => {
1616
when(postponedWorkedFreeDayLeave.getType()).thenReturn(
1717
Type.POSTPONED_WORKED_FREE_DAY
1818
);
19+
const relocationLeave = mock(LeaveRequest);
20+
when(relocationLeave.getType()).thenReturn(Type.RELOCATION);
1921

2022
const userLeaves = new UserLeavesCollection([
2123
instance(paidLeave),
2224
instance(unpaidLeave),
2325
instance(specialLeave),
2426
instance(medicalLeave),
25-
instance(postponedWorkedFreeDayLeave)
27+
instance(postponedWorkedFreeDayLeave),
28+
instance(relocationLeave)
2629
]);
2730
expect(userLeaves.paid[0].getType()).toBe(Type.PAID);
2831
expect(userLeaves.unpaid[0].getType()).toBe(Type.UNPAID);
@@ -31,5 +34,6 @@ describe('UserLeavesCollection', () => {
3134
expect(userLeaves.postponedWorkedFreeDay[0].getType()).toBe(
3235
Type.POSTPONED_WORKED_FREE_DAY
3336
);
37+
expect(userLeaves.relocation[0].getType()).toBe(Type.RELOCATION);
3438
});
3539
});

src/Domain/HumanResource/Leave/UserLeavesCollection.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ export class UserLeavesCollection {
66
public special: LeaveRequest[] = [];
77
public medical: LeaveRequest[] = [];
88
public postponedWorkedFreeDay: LeaveRequest[] = [];
9+
public relocation: LeaveRequest[] = [];
910

1011
constructor(leaves: LeaveRequest[]) {
1112
this.distributeLeavesByType(leaves);
@@ -29,6 +30,9 @@ export class UserLeavesCollection {
2930
case Type.POSTPONED_WORKED_FREE_DAY:
3031
this.postponedWorkedFreeDay.push(leave);
3132
break;
33+
case Type.RELOCATION:
34+
this.relocation.push(leave);
35+
break;
3236
}
3337
}
3438
}

src/Infrastructure/HumanResource/PayrollElements/Table/PayrollElementsTableFactory.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ export class PayrollElementsTableFactory {
2424
'payroll-elements-unpaidLeaves',
2525
'payroll-elements-medicalLeaves',
2626
'payroll-elements-specialLeaves',
27-
'payroll-elements-postponedWorkedFreeDayLeaves'
27+
'payroll-elements-postponedWorkedFreeDayLeaves',
28+
'payroll-elements-relocationLeaves'
2829
];
2930

3031
const rows = [];
@@ -64,6 +65,9 @@ export class PayrollElementsTableFactory {
6465
.template('pages/payroll_elements/_leaves.njk', {
6566
leaves: item.postponedWorkedFreeDayLeaves
6667
})
68+
.template('pages/payroll_elements/_leaves.njk', {
69+
leaves: item.relocationLeaves
70+
})
6771
.build();
6872

6973
rows.push(row);

src/translations/fr-FR.ftl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ leaves-type-value = {$type ->
131131
[medical] Congé maladie
132132
[illimited] Congé illimité
133133
[postponedWorkedFreeDay] Congé jour férié glissant
134+
[relocation] Congé déménagement
134135
*[other] Autre
135136
}
136137
leaves-type-value-plural = {$type ->
@@ -140,6 +141,7 @@ leaves-type-value-plural = {$type ->
140141
[medical] Congés maladie
141142
[illimited] Congés illimités
142143
[postponedWorkedFreeDay] Congés jours fériés glissants
144+
[relocation] Congés déménagement
143145
*[other] Autre
144146
}
145147
leaves-startDate = Du
@@ -200,6 +202,7 @@ payroll-elements-unpaidLeaves = Congés sans solde
200202
payroll-elements-medicalLeaves = Congés maladie
201203
payroll-elements-specialLeaves = Congés exceptionnels
202204
payroll-elements-postponedWorkedFreeDayLeaves = Congés jours fériés glissants
205+
payroll-elements-relocationLeaves = Congés déménagement
203206
payroll-elements-download = Télécharger
204207
payroll-elements-filename = Fairness - Éléments de paie - {$date}.csv
205208
payroll-elements-wiki = Voir le Wiki

0 commit comments

Comments
 (0)