mirror of
https://github.com/ershisan99/flashcards-api.git
synced 2025-12-17 05:09: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 { IsOptional } from 'class-validator'
|
||||||
|
|
||||||
import { User } from '../entities/auth.entity'
|
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()
|
@IsOptional()
|
||||||
@ApiProperty({ required: false })
|
@ApiProperty({ required: false })
|
||||||
avatar: string
|
avatar?: string
|
||||||
|
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
@ApiProperty({ required: false })
|
@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, {
|
const updatedUser = await this.usersRepository.updateUser(command.userId, {
|
||||||
name: command.user.name.trim(),
|
name: command.user.name?.trim(),
|
||||||
avatar,
|
avatar,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user