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 { CountDiscountsBySchoolQuery } from './CountDiscountsBySchoolQuery'; |
||
4 | import { IDiscountRepository } from 'src/Domain/School/Repository/IDiscountRepository'; |
||
5 | |||
6 | @QueryHandler(CountDiscountsBySchoolQuery) |
||
7 | export class CountDiscountsBySchoolQueryHandler { |
||
8 | constructor( |
||
9 | @Inject('IDiscountRepository') |
||
10 | private readonly discountRepository: IDiscountRepository |
||
11 | ) {} |
||
12 | |||
13 | public execute({ schoolId }: CountDiscountsBySchoolQuery): Promise<number> { |
||
14 | return this.discountRepository.countBySchool(schoolId); |
||
15 | } |
||
16 | } |
||
17 |