Total Complexity | 1 |
Complexity/F | 1 |
Lines of Code | 18 |
Function Count | 1 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | import { Inject } from '@nestjs/common'; |
||
2 | import { Discount } from '../../Discount.entity'; |
||
3 | import { IDiscountRepository } from '../../Repository/IDiscountRepository'; |
||
4 | import { School } from '../../School.entity'; |
||
5 | |||
6 | export class IsDiscountAlreadyExist { |
||
7 | constructor( |
||
8 | @Inject('IDiscountRepository') |
||
9 | private readonly discountRepository: IDiscountRepository |
||
10 | ) {} |
||
11 | |||
12 | public async isSatisfiedBy(amount: number, school: School): Promise<boolean> { |
||
13 | return ( |
||
14 | (await this.discountRepository.findOneByAmountAndSchool(amount, school)) instanceof Discount |
||
15 | ); |
||
16 | } |
||
17 | } |
||
18 |