Skip to content

배지 목록 조회 및 대표 배지 설정 기능 구현#164

Open
Junad-Park wants to merge 3 commits intofeature/setup-badge-domainfrom
feature/badge-list-and-representative
Open

배지 목록 조회 및 대표 배지 설정 기능 구현#164
Junad-Park wants to merge 3 commits intofeature/setup-badge-domainfrom
feature/badge-list-and-representative

Conversation

@Junad-Park
Copy link
Copy Markdown
Contributor

✨ 작업 내용

1️⃣ 배지 목록 조회 기능 구현

  • 사용자가 보유한 배지 목록전체 배지 개수, 그리고 현재 설정된 대표 배지 정보를 함께 조회하는 기능 추가

2️⃣ 대표 배지 설정 기능 구현

  • 사용자가 보유한 배지 중 하나를 대표 배지로 설정하거나 변경할 수 있는 기능 추가
  • 기존에 설정된 대표 배지가 있을 경우 이를 해제하고 새로운 배지를 대표로 설정

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jan 17, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

🗂️ Base branches to auto review (1)
  • develop

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Note

.coderabbit.yaml has unrecognized properties

CodeRabbit is using all valid settings from your configuration. Unrecognized properties (listed below) have been ignored and may indicate typos or deprecated fields that can be removed.

⚠️ Parsing warnings (1)
Validation error: Unrecognized key(s) in object: 'auto_resolve_threads', 'spring_specific'
⚙️ Configuration instructions
  • Please see the configuration documentation for more information.
  • You can also validate your configuration using the online YAML validator.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/badge-list-and-representative

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Member

@wafla wafla left a comment

Choose a reason for hiding this comment

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

고생하셨습니다!

Copy link
Copy Markdown
Member

@Seol-JY Seol-JY left a comment

Choose a reason for hiding this comment

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

고생하셨습니다~!!

/* 413xx Badge */
NOT_FOUND_BADGE(HttpStatus.NOT_FOUND, 41301, "뱃지를 찾을 수 없습니다."),
ALREADY_ACQUIRED_BADGE(HttpStatus.CONFLICT, 41302, "이미 획득한 뱃지입니다."),
NOT_OWNED_BADGE(HttpStatus.FORBIDDEN, 41303, "보유하지 않은 뱃지입니다."),
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

p3:
현재 FORBIDDEN(403)으로 되어 있는데, 403은 보통 인가(authorization) 실패를 의미하는 것 같아서요. 이 경우는 "해당 유저-배지 관계가 존재하지 않음"에 가까워서 NOT_FOUND(404)가 더 자연스럽지 않을까 싶은데, 혹시 403으로 설정하신 이유가 있을까요?

Comment on lines +86 to +98
@Transactional
public void setRepresentativeBadge(final User user, final Long badgeId) {
Badge badge = badgeRepository.findById(badgeId)
.orElseThrow(() -> CommonException.from(ExceptionCode.NOT_FOUND_BADGE));

UserBadge newRepresentativeBadge = userBadgeRepository.findByUserAndBadge(user, badge)
.orElseThrow(() -> CommonException.from(ExceptionCode.NOT_OWNED_BADGE));

userBadgeRepository.findByUserAndIsRepresentativeTrue(user)
.ifPresent(oldBadge -> oldBadge.updateRepresentativeStatus(false));

newRepresentativeBadge.updateRepresentativeStatus(true);
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

p5: 현재는 "대표 배지를 다른 배지로 변경"만 가능한 것 같은데, 대표 배지를 해제(null로 설정)하는 케이스는 요구사항에 없는 걸까요? 만약 추후에 필요할 수 있다면 badgeId를 nullable로 받아서 해제도 지원하는 것도 고려해볼 수 있을 것 같아서 여쭤봅니다.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants