Total Complexity | 1 |
Complexity/F | 1 |
Lines of Code | 25 |
Function Count | 1 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | import {Inject} from '@nestjs/common'; |
||
2 | import {IEventRepository} from '../Repository/IEventRepository'; |
||
3 | import {User} from 'src/Domain/HumanResource/User/User.entity'; |
||
4 | |||
5 | export class DoesEventsExistForPeriod { |
||
6 | constructor( |
||
7 | @Inject('IEventRepository') |
||
8 | private readonly eventRepository: IEventRepository |
||
9 | ) {} |
||
10 | |||
11 | public async isSatisfiedBy( |
||
12 | user: User, |
||
13 | startDate: string, |
||
14 | endDate: string |
||
15 | ): Promise<boolean> { |
||
16 | return ( |
||
17 | (await this.eventRepository.countExistingEventsByUserAndPeriod( |
||
18 | user, |
||
19 | startDate, |
||
20 | endDate |
||
21 | )) > 0 |
||
22 | ); |
||
23 | } |
||
24 | } |
||
25 |