Files
Picsur/backend/src/routes/api/auth/auth.dto.ts

42 lines
622 B
TypeScript
Raw Normal View History

2022-02-21 14:53:21 +01:00
import {
IsBoolean,
2022-02-24 11:22:28 +01:00
IsDefined,
2022-02-21 14:53:21 +01:00
IsNotEmpty,
IsOptional,
IsString,
ValidateNested,
} from 'class-validator';
2022-02-24 22:56:27 +01:00
import { User } from '../../../collections/userdb/user.dto';
2022-02-21 14:53:21 +01:00
export class LoginResponseDto {
@IsString()
2022-02-24 11:22:28 +01:00
@IsDefined()
2022-02-21 14:53:21 +01:00
access_token: string;
}
export class RegisterRequestDto {
@IsString()
@IsNotEmpty()
username: string;
@IsString()
@IsNotEmpty()
password: string;
@IsBoolean()
@IsOptional()
isAdmin?: boolean;
}
export class DeleteRequestDto {
@IsString()
@IsNotEmpty()
username: string;
}
export class JwtDataDto {
@ValidateNested()
2022-02-24 11:22:28 +01:00
@IsDefined()
2022-02-21 14:53:21 +01:00
user: User;
}