-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #47 from KNU-HAEDAL/issue/43
[Refactor]: 경험치 비정규화 로직 Usecase로 분리
- Loading branch information
Showing
4 changed files
with
29 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
.../haedal/zzansuni/domain/challengegroup/userchallenge/AddUserExpByVerificationUseCase.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package org.haedal.zzansuni.domain.challengegroup.userchallenge; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
import org.haedal.zzansuni.domain.challengegroup.ChallengeGroupReader; | ||
import org.haedal.zzansuni.domain.challengegroup.userexp.ChallengeGroupUserExp; | ||
import org.springframework.stereotype.Component; | ||
import org.springframework.transaction.annotation.Transactional; | ||
|
||
@Component | ||
@RequiredArgsConstructor | ||
public class AddUserExpByVerificationUseCase { | ||
private final ChallengeGroupReader challengeGroupReader; | ||
|
||
@Transactional | ||
public void invoke(AddUserExpByVerificationEvent event) { | ||
Long challengeGroupId = event.getChallengeGroupId(); | ||
Long userId = event.getUserId(); | ||
|
||
ChallengeGroupUserExp challengeGroupUserExp = challengeGroupReader | ||
.findByChallengeGroupIdAndUserId(challengeGroupId, userId).orElseThrow(); | ||
challengeGroupUserExp.addExp(event.getAcquiredExp()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters