Skip to content

Commit

Permalink
Merge pull request #241 from fairnesscoop/feat/remove-meal-ticket-con…
Browse files Browse the repository at this point in the history
…verter

fix: remove meal ticket converter
  • Loading branch information
mmarchois authored Mar 29, 2022
2 parents dfba814 + ee340d1 commit f6ac72e
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 167 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,13 @@ import { LeaveRequestToLeavesConverter } from 'src/Domain/HumanResource/Leave/Co
import { LeaveRequest } from 'src/Domain/HumanResource/Leave/LeaveRequest.entity';
import { AcceptedLeaveRequestEvent } from './AcceptedLeaveRequestEvent';
import { AcceptedLeaveRequestEventListener } from './AcceptedLeaveRequestEventListener';
import { LeaveRequestToMealTicketRemovalConverter } from 'src/Domain/HumanResource/MealTicket/Converter/LeaveRequestToMealTicketRemovalConverter';

describe('AcceptedLeaveRequestEventListener', () => {
it('testAcceptedLeaveRequest', async () => {
const leaveRequest = mock(LeaveRequest);
const leaveRequestToLeavesConverter = mock(LeaveRequestToLeavesConverter);
const leaveRequestToMealTicketRemovalConverter = mock(LeaveRequestToMealTicketRemovalConverter);
const acceptedLeaveEventListener = new AcceptedLeaveRequestEventListener(
instance(leaveRequestToLeavesConverter),
instance(leaveRequestToMealTicketRemovalConverter),
);

await acceptedLeaveEventListener.handle(
Expand All @@ -22,8 +19,5 @@ describe('AcceptedLeaveRequestEventListener', () => {
verify(
leaveRequestToLeavesConverter.convert(instance(leaveRequest))
).once();
verify(
leaveRequestToMealTicketRemovalConverter.convert(instance(leaveRequest))
).once();
});
});
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
import { EventsHandler } from '@nestjs/cqrs';
import { AcceptedLeaveRequestEvent } from './AcceptedLeaveRequestEvent';
import { LeaveRequestToLeavesConverter } from 'src/Domain/HumanResource/Leave/Converter/LeaveRequestToLeavesConverter';
import { LeaveRequestToMealTicketRemovalConverter } from 'src/Domain/HumanResource/MealTicket/Converter/LeaveRequestToMealTicketRemovalConverter';

@EventsHandler(AcceptedLeaveRequestEvent)
export class AcceptedLeaveRequestEventListener {
constructor(
private readonly leaveRequestToLeavesConverter: LeaveRequestToLeavesConverter,
private readonly leaveRequestToMealTicketRemovalConverter: LeaveRequestToMealTicketRemovalConverter
) {}

public handle(event: AcceptedLeaveRequestEvent): void {
this.leaveRequestToLeavesConverter.convert(event.leaveRequest);
this.leaveRequestToMealTicketRemovalConverter.convert(event.leaveRequest);
}
}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ import { GetAvailableMealTicketsAction } from './MealTicket/Action/GetAvailableM
import { GetMealTicketsPerMonthQueryHandler } from 'src/Application/HumanResource/MealTicket/Query/GetMealTicketsPerMonthQueryHandler';
import { UpdateLeaveRequestAction } from './Leave/Action/UpdateLeaveRequestAction';
import { UpdateLeaveRequestCommandHandler } from 'src/Application/HumanResource/Leave/Command/UpdateLeaveRequestCommandHandler';
import { LeaveRequestToMealTicketRemovalConverter } from 'src/Domain/HumanResource/MealTicket/Converter/LeaveRequestToMealTicketRemovalConverter';

@Module({
imports: [
Expand Down Expand Up @@ -145,8 +144,7 @@ import { LeaveRequestToMealTicketRemovalConverter } from 'src/Domain/HumanResour
IsMealTicketRemovalAlreadyExist,
CreateMealTicketRemovalCommandHandler,
GetMealTicketsPerMonthQueryHandler,
UpdateLeaveRequestCommandHandler,
LeaveRequestToMealTicketRemovalConverter
UpdateLeaveRequestCommandHandler
]
})
export class HumanResourceModule { }

0 comments on commit f6ac72e

Please sign in to comment.