Total Complexity | 1 |
Complexity/F | 1 |
Lines of Code | 21 |
Function Count | 1 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | import { InjectRepository } from '@nestjs/typeorm'; |
||
2 | import { Repository } from 'typeorm'; |
||
3 | import { IInterestRateRepository } from 'src/Domain/HumanResource/Savings/Repository/IInterestRateRepository'; |
||
4 | import { InterestRate } from 'src/Domain/HumanResource/Savings/InterestRate.entity'; |
||
5 | |||
6 | export class InterestRateRepository implements IInterestRateRepository { |
||
7 | constructor( |
||
8 | @InjectRepository(InterestRate) |
||
9 | private readonly repository: Repository<InterestRate> |
||
10 | ) {} |
||
11 | |||
12 | public findLatestInterestRate(): Promise<InterestRate> { |
||
13 | return this.repository |
||
14 | .createQueryBuilder('interestRate') |
||
15 | .select(['interestRate.id']) |
||
16 | .limit(1) |
||
17 | .orderBy('interestRate.createdAt', 'DESC') |
||
18 | .getOne(); |
||
19 | } |
||
20 | } |
||
21 |