mirror of
https://github.com/samsonjs/immich.git
synced 2026-04-27 15:07:45 +00:00
52 lines
1.2 KiB
TypeScript
52 lines
1.2 KiB
TypeScript
import { ApiProperty } from '@nestjs/swagger';
|
|
import { Transform } from 'class-transformer';
|
|
import { IsEmail, IsEnum, IsNotEmpty, IsNumber, IsPositive, IsString, IsUUID } from 'class-validator';
|
|
import { UserAvatarColor } from 'src/entities/user.entity';
|
|
import { Optional, ValidateBoolean, toEmail, toSanitized } from 'src/validation';
|
|
|
|
export class UpdateUserDto {
|
|
@Optional()
|
|
@IsEmail({ require_tld: false })
|
|
@Transform(toEmail)
|
|
email?: string;
|
|
|
|
@Optional()
|
|
@IsNotEmpty()
|
|
@IsString()
|
|
password?: string;
|
|
|
|
@Optional()
|
|
@IsString()
|
|
@IsNotEmpty()
|
|
name?: string;
|
|
|
|
@Optional()
|
|
@IsString()
|
|
@Transform(toSanitized)
|
|
storageLabel?: string;
|
|
|
|
@IsNotEmpty()
|
|
@IsUUID('4')
|
|
@ApiProperty({ format: 'uuid' })
|
|
id!: string;
|
|
|
|
@ValidateBoolean({ optional: true })
|
|
isAdmin?: boolean;
|
|
|
|
@ValidateBoolean({ optional: true })
|
|
shouldChangePassword?: boolean;
|
|
|
|
@ValidateBoolean({ optional: true })
|
|
memoriesEnabled?: boolean;
|
|
|
|
@Optional()
|
|
@IsEnum(UserAvatarColor)
|
|
@ApiProperty({ enumName: 'UserAvatarColor', enum: UserAvatarColor })
|
|
avatarColor?: UserAvatarColor;
|
|
|
|
@Optional({ nullable: true })
|
|
@IsNumber()
|
|
@IsPositive()
|
|
@ApiProperty({ type: 'integer', format: 'int64' })
|
|
quotaSizeInBytes?: number | null;
|
|
}
|