Skip to content

Commit dca52cb

Browse files
authored
#173 [Fix] 채택 시 지급 포인트 변경
1 parent 96c7021 commit dca52cb

2 files changed

Lines changed: 9 additions & 11 deletions

File tree

src/main/java/com/swyp/picke/domain/battle/service/BattleProposalService.java

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,20 +30,17 @@ public class BattleProposalService {
3030
private final CreditService creditService;
3131
private final UserService userService;
3232

33-
private static final int PROPOSAL_COST = 30;
34-
private static final int PROPOSAL_REWARD = 100;
35-
3633
@Transactional
3734
public BattleProposalResponse propose(BattleProposalRequest request) {
3835
User user = userService.findCurrentUser();
3936

40-
// 크레딧 잔액 확인
37+
int cost = CreditType.TOPIC_SUGGEST.getDefaultAmount();
38+
4139
int totalCredits = creditService.getTotalPoints(user.getId());
42-
if (totalCredits < PROPOSAL_COST) {
40+
if (totalCredits < cost) {
4341
throw new CustomException(ErrorCode.CREDIT_NOT_ENOUGH);
4442
}
4543

46-
// 제안 저장
4744
BattleProposal proposal = BattleProposal.builder()
4845
.user(user)
4946
.category(request.getCategory())
@@ -55,8 +52,7 @@ public BattleProposalResponse propose(BattleProposalRequest request) {
5552

5653
battleProposalRepository.save(proposal);
5754

58-
// 30크레딧 차감 (음수로 저장)
59-
creditService.addCredit(user.getId(), CreditType.TOPIC_SUGGEST, -PROPOSAL_COST, proposal.getId());
55+
creditService.addCredit(user.getId(), CreditType.TOPIC_SUGGEST, -cost, proposal.getId());
6056

6157
return new BattleProposalResponse(proposal);
6258
}
@@ -87,8 +83,8 @@ public BattleProposalResponse review(Long proposalId, BattleProposalReviewReques
8783

8884
if (request.getAction() == BattleProposalReviewRequest.Action.ACCEPT) {
8985
proposal.accept();
90-
// 100크레딧 지급
91-
creditService.addCredit(proposal.getUser().getId(), CreditType.TOPIC_ADOPTED, PROPOSAL_REWARD, proposalId);
86+
int reward = CreditType.TOPIC_ADOPTED.getDefaultAmount();
87+
creditService.addCredit(proposal.getUser().getId(), CreditType.TOPIC_ADOPTED, reward, proposalId);
9288
} else {
9389
proposal.reject();
9490
}

src/main/java/com/swyp/picke/domain/user/enums/CreditType.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ public enum CreditType {
88
MAJORITY_WIN(10), // 다수결 보상: 월요일 배치, 2주 전 배틀 TOP≥10 대상
99
BEST_COMMENT(50), // 베댓 보상: 월요일 배치, 2주 전 배틀 좋아요 1위
1010
WEEKLY_CHARGE(40), // 주간 자동 충전: 매주 월요일 00:00 활성 사용자 전체
11-
FREE_CHARGE(0); // 광고/자유 충전: 가변 금액
11+
FREE_CHARGE(0), // 광고/자유 충전: 가변 금액
12+
TOPIC_SUGGEST(30), // 주제 제안
13+
TOPIC_ADOPTED(100); // 주제 채택
1214

1315
private final int defaultAmount;
1416

0 commit comments

Comments
 (0)