Total Complexity | 1 |
Complexity/F | 1 |
Lines of Code | 17 |
Function Count | 1 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | import { QueryHandler } from '@nestjs/cqrs'; |
||
2 | import { Inject } from '@nestjs/common'; |
||
3 | import { CountShootingsBySchoolQuery } from './CountShootingsBySchoolQuery'; |
||
4 | import { IShootingRepository } from 'src/Domain/School/Repository/IShootingRepository'; |
||
5 | |||
6 | @QueryHandler(CountShootingsBySchoolQuery) |
||
7 | export class CountShootingsBySchoolQueryHandler { |
||
8 | constructor( |
||
9 | @Inject('IShootingRepository') |
||
10 | private readonly shootingRepository: IShootingRepository |
||
11 | ) {} |
||
12 | |||
13 | public execute({ schoolId }: CountShootingsBySchoolQuery): Promise<number> { |
||
14 | return this.shootingRepository.countBySchool(schoolId); |
||
15 | } |
||
16 | } |
||
17 |