import { ConfigService } from '@nestjs/config' ; import { IDateUtils } from 'src/Application/IDateUtils' ; export abstract class AbstractGenerator { constructor ( protected readonly dateUtils , protected readonly configService ) { } protected async format ( prefix , nbItem ) { const pad = await this . configService . get < number > ( 'ACCOUNTING_PAD' ) ; return `${ prefix }-${ this . getCurrentYear ( ) }-${ String ( nbItem + 1 ) . padStart ( pad , '0' ) }` ; } protected getCurrentYear ( ) { return this . dateUtils . getCurrentDate ( ) . getFullYear ( ) ; } }