first commit
This commit is contained in:
40
apps/api-gateway/src/dto/media.dto.ts
Normal file
40
apps/api-gateway/src/dto/media.dto.ts
Normal file
@@ -0,0 +1,40 @@
|
||||
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
||||
import { IsIn, IsOptional, IsString } from 'class-validator';
|
||||
|
||||
const IMAGE_TYPES = ['image/jpeg', 'image/png', 'image/webp', 'image/gif'] as const;
|
||||
export class AvatarUploadDto {
|
||||
@ApiProperty({ description: 'MIME-тип изображения', example: 'image/jpeg', enum: IMAGE_TYPES })
|
||||
@IsString({ message: 'Укажите MIME-тип изображения' })
|
||||
@IsIn([...IMAGE_TYPES], { message: 'Допустимы только JPEG, PNG, WEBP или GIF' })
|
||||
contentType!: string;
|
||||
}
|
||||
|
||||
export class ConfirmAvatarDto {
|
||||
@ApiProperty({ description: 'Ключ объекта в MinIO после загрузки', example: 'avatars/uuid/photo.jpg' })
|
||||
@IsString({ message: 'Ключ хранилища должен быть строкой' })
|
||||
storageKey!: string;
|
||||
}
|
||||
|
||||
export class DocumentPhotoUploadDto {
|
||||
@ApiProperty({ description: 'MIME-тип изображения', example: 'image/jpeg', enum: IMAGE_TYPES })
|
||||
@IsString({ message: 'Укажите MIME-тип изображения' })
|
||||
@IsIn([...IMAGE_TYPES], { message: 'Допустимы только JPEG, PNG, WEBP или GIF' })
|
||||
contentType!: string;
|
||||
}
|
||||
|
||||
export class ChatMediaUploadDto {
|
||||
@ApiProperty({ description: 'MIME-тип файла', example: 'audio/webm' })
|
||||
@IsString({ message: 'Укажите MIME-тип файла' })
|
||||
contentType!: string;
|
||||
|
||||
@ApiPropertyOptional({ description: 'Имя файла для определения расширения', example: 'voice.webm' })
|
||||
@IsOptional()
|
||||
@IsString({ message: 'Имя файла должно быть строкой' })
|
||||
fileName?: string;
|
||||
}
|
||||
|
||||
export class UpdateAvatarStorageDto {
|
||||
@ApiProperty({ description: 'Ключ объекта в MinIO', example: 'avatars/uuid/photo.jpg' })
|
||||
@IsString({ message: 'Ключ хранилища должен быть строкой' })
|
||||
storageKey!: string;
|
||||
}
|
||||
Reference in New Issue
Block a user