mirror of
https://github.com/immich-app/immich
synced 2025-11-07 17:27:20 +00:00
61 lines
1.3 KiB
TypeScript
61 lines
1.3 KiB
TypeScript
import { ApiProperty } from '@nestjs/swagger';
|
|
import { Transform } from 'class-transformer';
|
|
import { IsEmail, IsNotEmpty, IsNumber, IsPositive, IsString } from 'class-validator';
|
|
import { Optional, ValidateBoolean, toEmail, toSanitized } from 'src/validation';
|
|
|
|
export class CreateUserDto {
|
|
@IsEmail({ require_tld: false })
|
|
@Transform(toEmail)
|
|
email!: string;
|
|
|
|
@IsNotEmpty()
|
|
@IsString()
|
|
password!: string;
|
|
|
|
@IsNotEmpty()
|
|
@IsString()
|
|
name!: string;
|
|
|
|
@Optional({ nullable: true })
|
|
@IsString()
|
|
@Transform(toSanitized)
|
|
storageLabel?: string | null;
|
|
|
|
@ValidateBoolean({ optional: true })
|
|
memoriesEnabled?: boolean;
|
|
|
|
@Optional({ nullable: true })
|
|
@IsNumber()
|
|
@IsPositive()
|
|
@ApiProperty({ type: 'integer', format: 'int64' })
|
|
quotaSizeInBytes?: number | null;
|
|
|
|
@ValidateBoolean({ optional: true })
|
|
shouldChangePassword?: boolean;
|
|
}
|
|
|
|
export class CreateAdminDto {
|
|
@IsNotEmpty()
|
|
isAdmin!: true;
|
|
|
|
@IsEmail({ require_tld: false })
|
|
@Transform(({ value }) => value?.toLowerCase())
|
|
email!: string;
|
|
|
|
@IsNotEmpty()
|
|
password!: string;
|
|
|
|
@IsNotEmpty()
|
|
name!: string;
|
|
}
|
|
|
|
export class CreateUserOAuthDto {
|
|
@IsEmail({ require_tld: false })
|
|
@Transform(({ value }) => value?.toLowerCase())
|
|
email!: string;
|
|
|
|
@IsNotEmpty()
|
|
oauthId!: string;
|
|
|
|
name?: string;
|
|
}
|