Skip to content

Commit

Permalink
🎈 Merge pull request #177 from ileostar/fix/update-user
Browse files Browse the repository at this point in the history
🐛 fix user update interface
  • Loading branch information
ileostar authored Aug 24, 2024
2 parents 967cb74 + e05aae6 commit 57a4648
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion apps/server/src/modules/user/user.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export class UserController {
})
@ApiBody({ type: OmitType(UpdateUserDto, ['userId']) })
@ApiOperation({ summary: '更新用户信息', description: '测试' })
@APIResponse(UpdateUserDto)
@APIResponse(OmitType(UpdateUserDto, ['userId']))
async updateUserInfos(
@Param('userId') userId: string,
@Body() dto: Omit<UpdateUserDto, 'userId'>,
Expand Down
3 changes: 2 additions & 1 deletion apps/server/src/modules/user/user.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ export class UserService {
if (!old) throw '用户ID不存在';
if (dto.username) {
const tempUser = await this.findUserByUsername(dto.username);
if (!!tempUser && tempUser.userId !== dto.userId) throw '用户名已存在';
console.log(tempUser, tempUser.userId, dto.userId);
if (!!tempUser && tempUser.id !== dto.userId) throw '用户名已存在';
}
await this.db.update(user).set(dto).where(eq(user.id, dto.userId));
return dto;
Expand Down

0 comments on commit 57a4648

Please sign in to comment.