bug fix: update method
This commit is contained in:
parent
ddac5608a6
commit
8a46905abe
@ -32,8 +32,8 @@ export class UserController {
|
||||
}
|
||||
|
||||
// 根据id修改用户
|
||||
@Put("/update")
|
||||
async update(@Param('id') id: number, @Body() user: Users): Promise<void> {
|
||||
@Put("/update/:id")
|
||||
async update(@Param('id') id: number, @Body() user: Partial<Users>): Promise<void> {
|
||||
this.userService.update(id, user);
|
||||
}
|
||||
}
|
@ -32,7 +32,11 @@ export class UserService {
|
||||
}
|
||||
|
||||
// 根据id修改用户
|
||||
async update(id: number, user: Users): Promise<void> {
|
||||
async update(id: number, user: Partial<Users>): Promise<void> {
|
||||
try {
|
||||
await this.userRepository.update(id,user);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user