mirror of
https://github.com/ershisan99/flashcards-api.git
synced 2025-12-16 20:59:26 +00:00
fix 500 error
This commit is contained in:
@@ -1,14 +1,14 @@
|
||||
import { ApiProperty, PickType } from '@nestjs/swagger'
|
||||
import { ApiProperty, PickType, PartialType } from '@nestjs/swagger'
|
||||
import { IsOptional } from 'class-validator'
|
||||
|
||||
import { User } from '../entities/auth.entity'
|
||||
|
||||
export class UpdateUserDataDto extends PickType(User, ['name', 'avatar'] as const) {
|
||||
export class UpdateUserDataDto extends PartialType(PickType(User, ['name', 'avatar'] as const)) {
|
||||
@IsOptional()
|
||||
@ApiProperty({ required: false })
|
||||
avatar: string
|
||||
avatar?: string
|
||||
|
||||
@IsOptional()
|
||||
@ApiProperty({ required: false })
|
||||
name: string
|
||||
name?: string
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ export class UpdateUserHandler implements ICommandHandler<UpdateUserCommand> {
|
||||
}
|
||||
|
||||
const updatedUser = await this.usersRepository.updateUser(command.userId, {
|
||||
name: command.user.name.trim(),
|
||||
name: command.user.name?.trim(),
|
||||
avatar,
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user