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

[FIX] 코스 등록시 Point 추가 로직 구현 - #90 #91

Merged
merged 3 commits into from
Jul 13, 2024

Conversation

rlarlgnszx
Copy link
Member

🔥Pull requests

⛳️ 작업한 브랜치

👷 작업한 내용

코스 등록시 Point 추가 로직 구현

  • 기존의 PointListner - > 포인트 삭제
  • PointListner -> pointType에 따라 Point 획득/사용
    public void onMessage(final MapRecord<String, String, String> message) {
    Map<String, String> map = message.getValue();
    Long userId = Long.valueOf(map.get("userId"));
    TransactionType type = TransactionType.valueOf(map.get("type"));
    User user = getUser(userId);
    int point = Integer.parseInt(map.get("point"));
    switch (type) {
    case POINT_GAINED:
    user.setTotalPoint(user.getTotalPoint() + point);
    break;
    case POINT_USED:
    user.setTotalPoint(user.getTotalPoint() - point);
    break;
    default:
    throw new IllegalArgumentException("잘못된 TransactionType: " + type);
    }
    userRepository.save(user);
    }

🚨 참고 사항

없음

📟 관련 이슈

Copy link
Contributor

@gardening-y gardening-y left a comment

Choose a reason for hiding this comment

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

미쳤다~ 수고하셨습니당

@rlarlgnszx rlarlgnszx merged commit a2cf3a2 into develop Jul 13, 2024
1 check passed
@gardening-y gardening-y changed the title 코스 등록시 Point 추가 로직 구현 - #90 [FIX] 코스 등록시 Point 추가 로직 구현 - #90 Sep 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEAT] 코스 생성 API User Point 추가 로직 추가
2 participants