Total Complexity | 1 |
Complexity/F | 1 |
Lines of Code | 28 |
Function Count | 1 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | import {Inject} from '@nestjs/common'; |
||
2 | import {User} from 'src/Domain/User/User.entity'; |
||
3 | import {Task} from 'src/Domain/Task/Task.entity'; |
||
4 | import {Customer} from 'src/Domain/Customer/Customer.entity'; |
||
5 | import {IDailyRateRepository} from '../Repository/IDailyRateRepository'; |
||
6 | import {DailyRate} from '../DailyRate.entity'; |
||
7 | |||
8 | export class IsDailyRateAlreadyExist { |
||
9 | constructor( |
||
10 | @Inject('IDailyRateRepository') |
||
11 | private readonly dailyRateRepository: IDailyRateRepository |
||
12 | ) {} |
||
13 | |||
14 | public async isSatisfiedBy( |
||
15 | user: User, |
||
16 | task: Task, |
||
17 | customer: Customer |
||
18 | ): Promise<boolean> { |
||
19 | return ( |
||
20 | (await this.dailyRateRepository.findOneByUserCustomerAndTask( |
||
21 | user, |
||
22 | customer, |
||
23 | task |
||
24 | )) instanceof DailyRate |
||
25 | ); |
||
26 | } |
||
27 | } |
||
28 |