39 lines
1.1 KiB
TypeScript
39 lines
1.1 KiB
TypeScript
import { ApiProperty } from '@nestjs/swagger';
|
|
import { Exclude } from 'class-transformer';
|
|
import {
|
|
IsEmail,
|
|
IsNumber,
|
|
IsString,
|
|
Length,
|
|
ValidateIf,
|
|
} from 'class-validator';
|
|
import { BaseStatusDto } from 'src/core/modules/infrastructure/dto/base-status.dto';
|
|
import { UserRole } from 'src/modules/user-related/user/constants';
|
|
import { UserEntity } from 'src/modules/user-related/user/domain/entities/user.entity';
|
|
|
|
export class TenantDto extends BaseStatusDto implements UserEntity {
|
|
@ApiProperty({ name: 'name', required: true, example: 'Tenant 1' })
|
|
@IsString()
|
|
name: string;
|
|
|
|
@ApiProperty({ name: 'username', required: true, example: 'tenant1' })
|
|
@IsString()
|
|
username: string;
|
|
|
|
@ApiProperty({ name: 'share_margin', required: true, example: 85 })
|
|
@IsNumber()
|
|
share_margin: number;
|
|
|
|
@ApiProperty({ name: 'password', required: true, example: 'Tenant123!' })
|
|
@IsString()
|
|
password: string;
|
|
|
|
@ApiProperty({ name: 'email', required: false, example: 'tenant@mail.com' })
|
|
@IsEmail({ ignore_max_length: true })
|
|
@ValidateIf((body) => body.email)
|
|
email: string;
|
|
|
|
@Exclude()
|
|
role: UserRole;
|
|
}
|