Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BE] 유저 닉네임 변경 API 추가 #223

Merged
merged 4 commits into from
Nov 28, 2024
Merged

Conversation

uuuo3o
Copy link
Collaborator

@uuuo3o uuuo3o commented Nov 27, 2024

✅ 주요 작업

  • 새로운 닉네임 입력시 변경가능함
  • 중복된 닉네임이 들어오면 400 Bad Request 에러가 뜨면서 '이미 존재하는 닉네임입니다.' 오류가 발생합니다!

💭 고민과 해결과정

  • 근데 뭐... 특수문자라던가 글자수 제한 같은건 아직 안걸었어요..

@uuuo3o uuuo3o added BE 백엔드 API API 구현 labels Nov 27, 2024
@uuuo3o uuuo3o requested review from jinddings and sieunie November 27, 2024 16:21
@uuuo3o uuuo3o self-assigned this Nov 27, 2024
Copy link
Collaborator

@jinddings jinddings left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

제가 해야지 하고 깜빡하고 있었는데... 답답해서 해주셨군요..! 감사합니다

@uuuo3o
Copy link
Collaborator Author

uuuo3o commented Nov 28, 2024

제가 해야지 하고 깜빡하고 있었는데... 답답해서 해주셨군요..! 감사합니다

답답해서 한 건 아니잖아요 ㅋㅋㅋㅋ 어제 저희끼리 모여있을 때 제가 할게요~ 했던 거잖아요ㅋㅋㅋㅋ!!! 아니 왜 그러세요!!

@jinddings
Copy link
Collaborator

jinddings commented Nov 28, 2024

제가 해야지 하고 깜빡하고 있었는데... 답답해서 해주셨군요..! 감사합니다

답답해서 한 건 아니잖아요 ㅋㅋㅋㅋ 어제 저희끼리 모여있을 때 제가 할게요~ 했던 거잖아요ㅋㅋㅋㅋ!!! 아니 왜 그러세요!!

앗 ㅋㅋㅋ 이거 말고 그 default 닉네임이요 ㅎㅎㅎㅎㅎㅎㅎㅎㅎ 수정 사항이 같이 적용되서 보이네요

Copy link
Collaborator

@sieunie sieunie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

수고하셨습니다!

@@ -27,4 +29,20 @@ export class UserController {
getProfile(@Req() request: Request) {
return this.userService.getProfile(parseInt(request.user.userId, 10));
}

@Post('/rename')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 닉네임 수정은 patch 메소드가 더 낫지 않을까용...? 어떻게 생각하세요?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

오 완전 좋아요 patch!!
맞아요.. 당연한건데.. 전체 수정이 아니라 부분 수정이니까!!
당장 반영하겠습니다.

Comment on lines 24 to 29
const isDuplicated = await this.userRepository.findBy({
nickname: newName,
});
if (isDuplicated.length > 0) {
throw new BadRequestException('이미 존재하는 닉네임입니다.');
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 existsBy 이런거로 boolean 값 받아서 할 수도 있을 것 같아요!

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

오우..! 저도 저런 식으로만 했어서 생각도 못했네요 그런 메소드가 있었군요..! 감사합니다!

Copy link
Collaborator Author

@uuuo3o uuuo3o Nov 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

안그래도 boolean 으로 하고 싶었는데 저렇게 찾으니까 없는 경우에도 빈 배열이어서.. 뭐 어떤 상황에서도 다 true로 가지고 오더라구요..ㅋㅋㅋ
감사합니다!!!

@uuuo3o uuuo3o merged commit d41658b into back/main Nov 28, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API API 구현 BE 백엔드
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants