| Total Complexity | 1 | 
| Total Lines | 20 | 
| Duplicated Lines | 0 % | 
| Changes | 0 | ||
| 1 | import { Injectable, Inject } from '@nestjs/common'; | ||
| 6 | |||
| 7 | @Injectable() | ||
| 8 | export class QuoteIdGenerator extends AbstractGenerator { | ||
| 9 | constructor( | ||
| 10 |     @Inject('IQuoteRepository') | ||
| 11 | private readonly quoteRepository: IQuoteRepository, | ||
| 12 |     @Inject('IDateUtils') | ||
| 13 | protected readonly dateUtils: IDateUtils, | ||
| 14 | protected readonly configService: ConfigService | ||
| 15 |   ) { | ||
| 16 | super(dateUtils, configService); | ||
| 17 | } | ||
| 18 | |||
| 19 |   public async generate(): Promise<string> { | ||
| 20 | const [ prefix, nbItem ] = await Promise.all([ | ||
| 21 |       this.configService.get<string>('ACCOUNTING_QUOTE_PREFIX'), | ||
| 22 | this.quoteRepository.countByYear(this.getCurrentYear()) | ||
| 23 | ]); | ||
| 24 | |||
| 25 | return this.format(prefix, nbItem); | ||
| 26 | } | ||
| 28 |