refactor user accounts structure
This commit is contained in:
@@ -1,37 +1,20 @@
|
||||
import { ApiProperty, PartialType } from '@nestjs/swagger'
|
||||
import { IsEnum, IsOptional, IsString } from 'class-validator'
|
||||
import { AccountStatus, AccountType } from 'generated/prisma/enums'
|
||||
import { CreateUserDto } from '../../../users/dto/user.dto'
|
||||
import { PartnerRole } from 'generated/prisma/enums'
|
||||
|
||||
export class CreateAccountDto extends CreateUserDto {
|
||||
export class CreatePartnerAccountDto {
|
||||
@IsString()
|
||||
@ApiProperty({})
|
||||
username: string
|
||||
|
||||
@IsOptional()
|
||||
@IsEnum(AccountType)
|
||||
type?: AccountType
|
||||
|
||||
@IsString()
|
||||
@ApiProperty({})
|
||||
password: string
|
||||
}
|
||||
|
||||
export class UpdateAccountDto {
|
||||
export class UpdateAccountDto extends PartialType(CreatePartnerAccountDto) {
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
username?: string
|
||||
|
||||
@IsOptional()
|
||||
@IsEnum(AccountType)
|
||||
type?: AccountType
|
||||
|
||||
@IsOptional()
|
||||
@IsEnum(AccountStatus)
|
||||
status?: AccountStatus
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
password?: string
|
||||
|
||||
// @IsOptional()
|
||||
// @IsString()
|
||||
// user_id?: string
|
||||
@IsEnum(PartnerRole)
|
||||
@ApiProperty({ enum: PartnerRole })
|
||||
role?: PartnerRole
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user