mirror of
https://github.com/KevinMidboe/immich.git
synced 2025-10-29 17:40:28 +00:00
66 lines
1.2 KiB
TypeScript
66 lines
1.2 KiB
TypeScript
import { Transform } from 'class-transformer';
|
|
import { IsBoolean, IsEmail, IsNotEmpty, 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()
|
|
firstName!: string;
|
|
|
|
@IsNotEmpty()
|
|
@IsString()
|
|
lastName!: string;
|
|
|
|
@Optional({ nullable: true })
|
|
@IsString()
|
|
@Transform(toSanitized)
|
|
storageLabel?: string | null;
|
|
|
|
@Optional({ nullable: true })
|
|
@IsString()
|
|
externalPath?: string | null;
|
|
|
|
@Optional()
|
|
@IsBoolean()
|
|
memoriesEnabled?: boolean;
|
|
}
|
|
|
|
export class CreateAdminDto {
|
|
@IsNotEmpty()
|
|
isAdmin!: true;
|
|
|
|
@IsEmail({ require_tld: false })
|
|
@Transform(({ value }) => value?.toLowerCase())
|
|
email!: string;
|
|
|
|
@IsNotEmpty()
|
|
password!: string;
|
|
|
|
@IsNotEmpty()
|
|
firstName!: string;
|
|
|
|
@IsNotEmpty()
|
|
lastName!: string;
|
|
}
|
|
|
|
export class CreateUserOAuthDto {
|
|
@IsEmail({ require_tld: false })
|
|
@Transform(({ value }) => value?.toLowerCase())
|
|
email!: string;
|
|
|
|
@IsNotEmpty()
|
|
oauthId!: string;
|
|
|
|
firstName?: string;
|
|
|
|
lastName?: string;
|
|
}
|