|
@@ -1,4 +1,5 @@
|
|
|
import { ApiProperty } from '@nestjs/swagger';
|
|
import { ApiProperty } from '@nestjs/swagger';
|
|
|
|
|
+import { IsIn, IsNotEmpty, IsString } from 'class-validator';
|
|
|
import { UploadFileType } from './uploader.service';
|
|
import { UploadFileType } from './uploader.service';
|
|
|
|
|
|
|
|
export class UploadRequestDto {
|
|
export class UploadRequestDto {
|
|
@@ -7,6 +8,8 @@ export class UploadRequestDto {
|
|
|
'Target folder path (relative, no leading slash). Example: ads/banner or video/preview',
|
|
'Target folder path (relative, no leading slash). Example: ads/banner or video/preview',
|
|
|
example: 'ads/banner',
|
|
example: 'ads/banner',
|
|
|
})
|
|
})
|
|
|
|
|
+ @IsString()
|
|
|
|
|
+ @IsNotEmpty()
|
|
|
folder: string;
|
|
folder: string;
|
|
|
|
|
|
|
|
@ApiProperty({
|
|
@ApiProperty({
|
|
@@ -14,6 +17,8 @@ export class UploadRequestDto {
|
|
|
'Target filename including extension. Uploader does not modify the name.',
|
|
'Target filename including extension. Uploader does not modify the name.',
|
|
|
example: 'abc123.jpg',
|
|
example: 'abc123.jpg',
|
|
|
})
|
|
})
|
|
|
|
|
+ @IsString()
|
|
|
|
|
+ @IsNotEmpty()
|
|
|
filename: string;
|
|
filename: string;
|
|
|
|
|
|
|
|
@ApiProperty({
|
|
@ApiProperty({
|
|
@@ -22,5 +27,7 @@ export class UploadRequestDto {
|
|
|
enum: ['video', 'image', 'voice', 'other'],
|
|
enum: ['video', 'image', 'voice', 'other'],
|
|
|
example: 'image',
|
|
example: 'image',
|
|
|
})
|
|
})
|
|
|
|
|
+ @IsString()
|
|
|
|
|
+ @IsIn(['video', 'image', 'voice', 'other'])
|
|
|
fileType: UploadFileType;
|
|
fileType: UploadFileType;
|
|
|
}
|
|
}
|