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

server/src/Infrastructure/HumanResource/Savings/Repository/InterestRateRepository.ts   A

Complexity

Total Complexity 1
Complexity/F 1

Size

Lines of Code 21
Function Count 1

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 1
eloc 16
mnd 0
bc 0
fnc 1
dl 0
loc 21
bpm 0
cpm 1
noi 0
c 0
b 0
f 0
rs 10

1 Function

Rating   Name   Duplication   Size   Complexity  
A InterestRateRepository.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