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