mirror of
https://github.com/immich-app/immich.git
synced 2026-05-18 03:10:24 +03:00
refactor!: migrate class-validator to zod (#26597)
This commit is contained in:
@@ -1,16 +1,20 @@
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { createZodDto } from 'nestjs-zod';
|
||||
import { UploadFieldName } from 'src/dtos/asset-media.dto';
|
||||
import { isoDatetimeToDate } from 'src/validation';
|
||||
import z from 'zod';
|
||||
|
||||
export class CreateProfileImageDto {
|
||||
@ApiProperty({ type: 'string', format: 'binary', description: 'Profile image file' })
|
||||
[UploadFieldName.PROFILE_DATA]!: Express.Multer.File;
|
||||
}
|
||||
|
||||
export class CreateProfileImageResponseDto {
|
||||
@ApiProperty({ description: 'User ID' })
|
||||
userId!: string;
|
||||
@ApiProperty({ description: 'Profile image change date', format: 'date-time' })
|
||||
profileChangedAt!: Date;
|
||||
@ApiProperty({ description: 'Profile image file path' })
|
||||
profileImagePath!: string;
|
||||
}
|
||||
const CreateProfileImageResponseSchema = z
|
||||
.object({
|
||||
userId: z.string().describe('User ID'),
|
||||
profileChangedAt: isoDatetimeToDate.describe('Profile image change date'),
|
||||
profileImagePath: z.string().describe('Profile image file path'),
|
||||
})
|
||||
.meta({ id: 'CreateProfileImageResponseDto' });
|
||||
|
||||
export class CreateProfileImageResponseDto extends createZodDto(CreateProfileImageResponseSchema) {}
|
||||
|
||||
Reference in New Issue
Block a user