Passed
Pull Request — master (#235)
by Mathieu
01:49
created

server/src/Application/HumanResource/MealTicket/Query/GetMealTicketsPerMonthQueryHandler.ts   A

Complexity

Total Complexity 1
Complexity/F 1

Size

Lines of Code 38
Function Count 1

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 1
eloc 19
mnd 0
bc 0
fnc 1
dl 0
loc 38
rs 10
bpm 0
cpm 1
noi 0
c 0
b 0
f 0

1 Function

Rating   Name   Duplication   Size   Complexity  
A GetMealTicketsPerMonthQueryHandler.execute 0 5 1
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