| Total Complexity | 1 |
| Complexity/F | 1 |
| Lines of Code | 19 |
| 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 {IPayStubRepository} from '../Repository/IPayStubRepository'; |
||
| 4 | import {PayStub} from '../PayStub.entity'; |
||
| 5 | |||
| 6 | export class IsPayStubAlreadyExist { |
||
| 7 | constructor( |
||
| 8 | @Inject('IPayStubRepository') |
||
| 9 | private readonly payStubRepository: IPayStubRepository |
||
| 10 | ) {} |
||
| 11 | |||
| 12 | public async isSatisfiedBy(user: User, date: Date): Promise<boolean> { |
||
| 13 | return ( |
||
| 14 | (await this.payStubRepository.findOneByUserAndDate(user, date)) instanceof |
||
| 15 | PayStub |
||
| 16 | ); |
||
| 17 | } |
||
| 18 | } |
||
| 19 |