47 lines
1.3 KiB
TypeScript
47 lines
1.3 KiB
TypeScript
import { BaseStatusDto } from 'src/core/modules/infrastructure/dto/base-status.dto';
|
|
import { UserEntity } from '../../domain/entities/user.entity';
|
|
import { ApiProperty } from '@nestjs/swagger';
|
|
import { Exclude } from 'class-transformer';
|
|
import { IsString, ValidateIf, IsBoolean, IsObject } from 'class-validator';
|
|
import { UserRole } from '../../constants';
|
|
import { UserPrivilegeModel } from 'src/modules/user-related/user-privilege/data/models/user-privilege.model';
|
|
|
|
export class UserDto extends BaseStatusDto implements UserEntity {
|
|
@ApiProperty({ name: 'name', required: true, example: 'Amanda' })
|
|
@IsString()
|
|
name: string;
|
|
|
|
@ApiProperty({ name: 'username', required: true, example: 'amanda' })
|
|
@IsString()
|
|
username: string;
|
|
|
|
@ApiProperty({ name: 'password', required: true, example: 'Eigen123!' })
|
|
@IsString()
|
|
password: string;
|
|
|
|
@ApiProperty({
|
|
name: 'user_privilege',
|
|
type: Object,
|
|
required: false,
|
|
example: {
|
|
id: 'uuid',
|
|
},
|
|
})
|
|
@IsObject()
|
|
@ValidateIf((body) => body.user_privilege)
|
|
user_privilege: UserPrivilegeModel;
|
|
|
|
@ApiProperty({ name: 'role', required: true, example: UserRole.STAFF })
|
|
@IsString()
|
|
role: UserRole;
|
|
|
|
@Exclude()
|
|
share_margin: number;
|
|
|
|
@Exclude()
|
|
email: string;
|
|
|
|
@Exclude()
|
|
refresh_token: string;
|
|
}
|