Total Complexity | 1 |
Complexity/F | 1 |
Lines of Code | 38 |
Function Count | 1 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | import { QueryHandler } from '@nestjs/cqrs'; |
||
2 | import { Inject } from '@nestjs/common'; |
||
3 | import { IMealTicketRemovalRepository } from 'src/Domain/HumanResource/MealTicket/Repository/IMealTicketRemovalRepository'; |
||
4 | import { GetMealTicketsPerMonthQuery } from './GetMealTicketsPerMonthQuery'; |
||
5 | import { IDateUtils } from 'src/Application/IDateUtils'; |
||
6 | |||
7 | @QueryHandler(GetMealTicketsPerMonthQuery) |
||
8 | export class GetMealTicketsPerMonthQueryHandler { |
||
9 | constructor( |
||
10 | @Inject('IDateUtils') |
||
11 | private readonly dateUtils: IDateUtils, |
||
12 | @Inject('IMealTicketRemovalRepository') |
||
13 | private readonly mealTicketRemovalRepository: IMealTicketRemovalRepository |
||
14 | ) {} |
||
15 | |||
16 | public async execute( |
||
17 | query: GetMealTicketsPerMonthQuery |
||
18 | ): Promise<void> { |
||
19 | const { user, date } = query; |
||
20 | /*const workingDaysByMonth = this.dateUtils.getAllWorkingDayOfYearByMonth( |
||
21 | currentDate |
||
22 | ); |
||
23 | const yearlyAvailableMealTickets = AvailableMealTicketStrategy.getMealTicketCountForEachMonthOfTheYear( |
||
24 | workingDaysByMonth |
||
25 | ); |
||
26 | |||
27 | const mealTicketRemovals = await this.mealTicketRemovalRepository.getAllByUserGroupedByMonth( |
||
28 | user, |
||
29 | currentDate |
||
30 | ); |
||
31 | |||
32 | return this.buildMealTicketSummary( |
||
33 | mealTicketRemovals, |
||
34 | yearlyAvailableMealTickets |
||
35 | );*/ |
||
36 | } |
||
37 | } |
||
38 |