-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[REFACTOR] user 레벨 업 및 기타 작업 리팩터링 (#134)
## ☀️ 작업 사항 - user progress 기능 user 도메인 내부로 이동 - avatar unlock 기능 명시적으로 리팩터링 - user에서 레벨 업 관련 계산 로직 분리 - user에서 exp percentage를 계산할 수 있도록 필드 및 메서드 추가 - user 애그리거트 리패키징 - domian 패키지 생성 및 내부에 도메인 계층의 클래스 리패키징 ## ☀️ 관련 이슈 related: #133 ## ☀️ 참고사항 논의된 사항이지만 패키징 구조에 대해 이견이 있다면 자유롭게 말씀해주시면 감사하겠습니다!
- Loading branch information
Showing
27 changed files
with
206 additions
and
134 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
2 changes: 1 addition & 1 deletion
2
src/main/java/com/wakeUpTogetUp/togetUp/api/auth/dto/response/LoginRes.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
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
37 changes: 37 additions & 0 deletions
37
src/main/java/com/wakeUpTogetUp/togetUp/api/avatar/application/UserAvatarQueryService.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,37 @@ | ||
package com.wakeUpTogetUp.togetUp.api.avatar.application; | ||
|
||
import com.wakeUpTogetUp.togetUp.api.avatar.dto.response.UserAvatarResponse; | ||
import com.wakeUpTogetUp.togetUp.api.avatar.model.Avatar; | ||
import com.wakeUpTogetUp.togetUp.api.avatar.model.UserAvatar; | ||
import com.wakeUpTogetUp.togetUp.api.avatar.repository.AvatarRepository; | ||
import com.wakeUpTogetUp.togetUp.api.avatar.repository.UserAvatarRepository; | ||
import com.wakeUpTogetUp.togetUp.common.Status; | ||
import com.wakeUpTogetUp.togetUp.exception.BaseException; | ||
import com.wakeUpTogetUp.togetUp.utils.mapper.EntityDtoMapper; | ||
import java.util.List; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.stereotype.Service; | ||
import org.springframework.transaction.annotation.Transactional; | ||
|
||
@Service | ||
@RequiredArgsConstructor | ||
@Transactional(readOnly = true) | ||
public class UserAvatarQueryService { | ||
|
||
private final AvatarRepository avatarRepository; | ||
private final UserAvatarRepository userAvatarRepository; | ||
|
||
public List<UserAvatarResponse> findUserAvatarList(int userId) { | ||
List<Avatar> avatarList = avatarRepository.findAll(); | ||
List<UserAvatar> userAvatarList = userAvatarRepository.findAllByUser_Id(userId); | ||
|
||
return EntityDtoMapper.INSTANCE.toUserAvatarDataList(avatarList, userAvatarList); | ||
} | ||
|
||
public int getUserAvatarId(int userId) { | ||
return userAvatarRepository.findByUser_IdAndIsActiveIsTrue(userId) | ||
.orElseThrow(() -> new BaseException(Status.FIND_USER_AVATAR_FAIL)) | ||
.getAvatar() | ||
.getId(); | ||
} | ||
} |
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
11 changes: 11 additions & 0 deletions
11
src/main/java/com/wakeUpTogetUp/togetUp/api/avatar/application/model/UnlockAvatarResult.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,11 @@ | ||
package com.wakeUpTogetUp.togetUp.api.avatar.application.model; | ||
|
||
import lombok.Getter; | ||
import lombok.RequiredArgsConstructor; | ||
|
||
@Getter | ||
@RequiredArgsConstructor | ||
public class UnlockAvatarResult { | ||
|
||
private final boolean isUnlocked; | ||
} |
2 changes: 1 addition & 1 deletion
2
src/main/java/com/wakeUpTogetUp/togetUp/api/avatar/model/UserAvatar.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
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 |
---|---|---|
|
@@ -5,8 +5,8 @@ | |
import com.wakeUpTogetUp.togetUp.api.dev.dto.response.AppStoreUrlRes; | ||
import com.wakeUpTogetUp.togetUp.api.mission.dto.request.MissionCompleteReq; | ||
import com.wakeUpTogetUp.togetUp.api.mission.dto.response.MissionCompleteRes; | ||
import com.wakeUpTogetUp.togetUp.api.users.model.User; | ||
import com.wakeUpTogetUp.togetUp.api.users.vo.UserStat; | ||
import com.wakeUpTogetUp.togetUp.api.users.domain.User; | ||
import com.wakeUpTogetUp.togetUp.api.users.domain.vo.UserStat; | ||
import com.wakeUpTogetUp.togetUp.common.Status; | ||
import com.wakeUpTogetUp.togetUp.common.dto.BaseResponse; | ||
import io.swagger.v3.oas.annotations.Operation; | ||
|
@@ -68,13 +68,15 @@ public BaseResponse<MissionCompleteRes> processMissionCompletion( | |
@Parameter(hidden = true) @AuthUser Integer userId, | ||
@RequestBody @Valid MissionCompleteReq missionCompleteReq | ||
) { | ||
User user = new User(userId, | ||
"1234", | ||
"이예원", | ||
"[email protected]", | ||
LoginType.KAKAO, | ||
30, | ||
3); | ||
User user = User.builder() | ||
.id(userId) | ||
.socialId("1234") | ||
.name("이예원") | ||
.email("[email protected]") | ||
.loginType(LoginType.KAKAO) | ||
.expPoint(30) | ||
.level(3) | ||
.build(); | ||
|
||
MissionCompleteRes response = MissionCompleteRes.builder() | ||
.userStat(UserStat.from(user)) | ||
|
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
2 changes: 1 addition & 1 deletion
2
src/main/java/com/wakeUpTogetUp/togetUp/api/mission/dto/response/MissionCompleteRes.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
4 changes: 2 additions & 2 deletions
4
src/main/java/com/wakeUpTogetUp/togetUp/api/mission/model/MissionLog.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
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
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
3 changes: 1 addition & 2 deletions
3
src/main/java/com/wakeUpTogetUp/togetUp/api/room/model/RoomUser.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
Oops, something went wrong.