| Total Complexity | 1 |
| Total Lines | 18 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | import {Inject} from '@nestjs/common'; |
||
| 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 | ); |
||
| 25 |