Completed
Push — master ( f37313...e5af60 )
by Mathieu
24s queued 11s
created

InterestRateRepository   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 1
eloc 12
dl 0
loc 13
c 0
b 0
f 0
rs 10

1 Function

Rating   Name   Duplication   Size   Complexity  
A findLatestInterestRate 0 7 1
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