| Total Complexity | 1 |
| Complexity/F | 1 |
| Lines of Code | 16 |
| Function Count | 1 |
| Duplicated Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | import {ConfigService} from '@nestjs/config'; |
||
| 2 | import {Injectable} from '@nestjs/common'; |
||
| 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 | } |
||
| 15 | } |
||
| 16 |