-
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.
- Loading branch information
Showing
5 changed files
with
50 additions
and
5 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
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
12 changes: 12 additions & 0 deletions
12
...a/org/haedal/zzansuni/userchallenge/domain/application/SubUserExpByVerificationEvent.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,12 @@ | ||
package org.haedal.zzansuni.userchallenge.domain.application; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
|
||
@Getter | ||
@AllArgsConstructor(staticName = "of") | ||
public class SubUserExpByVerificationEvent { | ||
private Long userId; | ||
private Integer subExp; | ||
private Long challengeGroupId; | ||
} |
29 changes: 29 additions & 0 deletions
29
...org/haedal/zzansuni/userchallenge/domain/application/SubUserExpByVerificationUseCase.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,29 @@ | ||
package org.haedal.zzansuni.userchallenge.domain.application; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
import org.haedal.zzansuni.user.domain.User; | ||
import org.haedal.zzansuni.user.domain.port.UserReader; | ||
import org.haedal.zzansuni.userchallenge.domain.ChallengeGroupUserExp; | ||
import org.haedal.zzansuni.userchallenge.domain.port.ChallengeGroupUserExpReader; | ||
import org.springframework.stereotype.Component; | ||
import org.springframework.transaction.annotation.Transactional; | ||
|
||
@Component | ||
@RequiredArgsConstructor | ||
public class SubUserExpByVerificationUseCase { | ||
private final UserReader userReader; | ||
private final ChallengeGroupUserExpReader challengeGroupUserExpReader; | ||
|
||
@Transactional | ||
public void invoke(SubUserExpByVerificationEvent event) { | ||
Long userId = event.getUserId(); | ||
Long challengeGroupId = event.getChallengeGroupId(); | ||
|
||
User user = userReader.getById(userId); | ||
ChallengeGroupUserExp challengeGroupUserExp = challengeGroupUserExpReader | ||
.findByChallengeGroupIdAndUserId(challengeGroupId, userId).orElseThrow(); | ||
|
||
// user.subExp(event.getSubExp()); | ||
// challengeGroupUserExp.subExp(event.getSubExp()); | ||
} | ||
} |
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