Total Complexity | 1 |
Total Lines | 11 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | import {ConfigService} from '@nestjs/config'; |
||
3 | |||
4 | @Injectable() |
||
5 | export class FileDirectoryStrategy { |
||
6 | constructor(private readonly configService: ConfigService) {} |
||
7 | |||
8 | public async location(uploadedDate: Date): Promise<string> { |
||
9 | const destination = await this.configService.get<string>('UPLOAD_LOCATION'); |
||
10 | const month = uploadedDate.getMonth() + 1; |
||
11 | const year = uploadedDate.getFullYear(); |
||
12 | |||
13 | return `${destination}/${year}/${month}`; |
||
14 | } |
||
16 |