Passed
Pull Request — master (#248)
by
unknown
01:38
created

server/src/Application/HumanResource/Leave/Query/GetLeavesByMonthQueryHandler.ts   A

Complexity

Total Complexity 1
Complexity/F 1

Size

Lines of Code 19
Function Count 1

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

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

1 Function

Rating   Name   Duplication   Size   Complexity  
A GetLeavesByMonthQueryHandler.execute 0 5 1
1
import { Inject } from '@nestjs/common';
2
import { LeavesCollection } from 'src/Domain/HumanResource/Leave/LeavesCollection';
3
import { ILeaveRequestRepository } from 'src/Domain/HumanResource/Leave/Repository/ILeaveRequestRepository';
4
5
import { GetLeavesByMonthQuery } from './GetLeavesByMonthQuery'
6
7
export class GetLeavesByMonthQueryHandler {
8
    constructor(
9
        @Inject('ILeaveRequestRepository')
10
        private readonly leaveRequestRepository: ILeaveRequestRepository,
11
    ){}
12
13
    async execute(query: GetLeavesByMonthQuery): Promise<LeavesCollection> {
14
        const leaves = await this.leaveRequestRepository.findAcceptedLeaveRequestsByMonth(query.date);
15
16
        return new LeavesCollection(leaves);
17
    }
18
}
19