Files
crm/apps/api/src/users/dto.ts
T

34 lines
578 B
TypeScript
Raw Normal View History

import {
IsEmail,
IsIn,
IsString,
MaxLength,
MinLength,
} from 'class-validator';
const INVITE_ROLES = ['admin', 'sales', 'support'] as const;
const ALL_ROLES = ['owner', 'admin', 'sales', 'support'] as const;
export class InviteUserDto {
@IsEmail()
email!: string;
@IsString()
@MinLength(2)
@MaxLength(120)
fullName!: string;
@IsString()
@MinLength(8)
@MaxLength(72)
password!: string;
@IsIn(INVITE_ROLES)
role!: (typeof INVITE_ROLES)[number];
}
export class UpdateUserRoleDto {
@IsIn(ALL_ROLES)
role!: (typeof ALL_ROLES)[number];
}