mirror of
https://github.com/immich-app/immich.git
synced 2025-12-23 01:11:36 +03:00
64 lines
1.3 KiB
TypeScript
64 lines
1.3 KiB
TypeScript
import { ApiProperty } from '@nestjs/swagger';
|
|
import { Transform } from 'class-transformer';
|
|
import { IsBoolean, IsEmail, IsNotEmpty, IsNumber, IsPositive, IsString } from 'class-validator';
|
|
import { Optional, toEmail, toSanitized } from '../../domain.util';
|
|
|
|
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;
|
|
|
|
@Optional()
|
|
@IsBoolean()
|
|
memoriesEnabled?: boolean;
|
|
|
|
@Optional({ nullable: true })
|
|
@IsNumber()
|
|
@IsPositive()
|
|
@ApiProperty({ type: 'integer', format: 'int64' })
|
|
quotaSizeInBytes?: number | null;
|
|
|
|
@Optional()
|
|
@IsBoolean()
|
|
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;
|
|
}
|