Total Complexity | 2 |
Total Lines | 16 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | import {InjectRepository} from '@nestjs/typeorm'; |
||
5 | |||
6 | export class QuoteRepository implements IQuoteRepository { |
||
7 | constructor( |
||
8 | @InjectRepository(Quote) |
||
9 | private readonly repository: Repository<Quote> |
||
10 | ) {} |
||
11 | |||
12 | public save(quote: Quote): Promise<Quote> { |
||
13 | return this.repository.save(quote); |
||
14 | } |
||
15 | |||
16 | public countByYear(year: number): Promise<number> { |
||
17 | return this.repository |
||
18 | .createQueryBuilder('quote') |
||
19 | .select('quote.id') |
||
20 | .where('extract(year FROM quote.date) = :year', {year}) |
||
21 | .getCount(); |
||
24 |