-
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.
[#83] Refactor : MyPage를 User로 리팩토링 한다
- Loading branch information
1 parent
70b8c31
commit db420ce
Showing
21 changed files
with
187 additions
and
405 deletions.
There are no files selected for viewing
70 changes: 0 additions & 70 deletions
70
src/main/java/ssu/eatssu/domain/page/presentation/MyPageController.java
This file was deleted.
Oops, something went wrong.
78 changes: 0 additions & 78 deletions
78
src/main/java/ssu/eatssu/domain/page/service/MyPageService.java
This file was deleted.
Oops, something went wrong.
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
8 changes: 0 additions & 8 deletions
8
src/main/java/ssu/eatssu/domain/repository/dto/ReviewMainRating.java
This file was deleted.
Oops, something went wrong.
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
53 changes: 53 additions & 0 deletions
53
src/main/java/ssu/eatssu/domain/slice/service/SliceService.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,53 @@ | ||
package ssu.eatssu.domain.slice.service; | ||
|
||
import static ssu.eatssu.global.handler.response.BaseResponseStatus.NOT_FOUND_USER; | ||
|
||
import java.util.List; | ||
import java.util.stream.Collectors; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.data.domain.Pageable; | ||
import org.springframework.data.domain.Slice; | ||
import org.springframework.stereotype.Service; | ||
import ssu.eatssu.domain.auth.entity.CustomUserDetails; | ||
import ssu.eatssu.domain.user.dto.MyReviewDetail; | ||
import ssu.eatssu.domain.review.entity.Review; | ||
import ssu.eatssu.domain.review.repository.ReviewRepository; | ||
import ssu.eatssu.domain.slice.dto.SliceResponse; | ||
import ssu.eatssu.domain.user.entity.User; | ||
import ssu.eatssu.domain.user.repository.UserRepository; | ||
import ssu.eatssu.global.handler.response.BaseException; | ||
|
||
@Service | ||
@RequiredArgsConstructor | ||
public class SliceService { | ||
|
||
private final UserRepository userRepository; | ||
private final ReviewRepository reviewRepository; | ||
|
||
public SliceResponse<MyReviewDetail> findMyReviews( | ||
CustomUserDetails userDetails, | ||
Pageable pageable, | ||
Long lastReviewId) { | ||
|
||
User user = userRepository.findById(userDetails.getId()) | ||
.orElseThrow(() -> new BaseException(NOT_FOUND_USER)); | ||
|
||
Slice<Review> sliceReviews = reviewRepository.findByUserOrderByIdDesc(user, lastReviewId, | ||
pageable); | ||
|
||
return convertToMyReviewDetail(sliceReviews); | ||
} | ||
|
||
private SliceResponse<MyReviewDetail> convertToMyReviewDetail(Slice<Review> sliceReviews) { | ||
List<MyReviewDetail> myReviewDetails = sliceReviews.getContent().stream() | ||
.map(MyReviewDetail::from) | ||
.collect(Collectors.toList()); | ||
|
||
return SliceResponse.<MyReviewDetail>builder() | ||
.numberOfElements(sliceReviews.getNumberOfElements()) | ||
.hasNext(sliceReviews.hasNext()) | ||
.dataList(myReviewDetails) | ||
.build(); | ||
} | ||
} | ||
|
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
8 changes: 4 additions & 4 deletions
8
...su/eatssu/domain/page/dto/MypageInfo.java → ...atssu/domain/user/dto/MyPageResponse.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 |
---|---|---|
@@ -1,19 +1,19 @@ | ||
package ssu.eatssu.domain.page.dto; | ||
package ssu.eatssu.domain.user.dto; | ||
|
||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import ssu.eatssu.domain.user.entity.OauthProvider; | ||
import ssu.eatssu.domain.auth.entity.OauthProvider; | ||
|
||
@AllArgsConstructor | ||
@Builder | ||
@Schema(title = "마이페이지 정보") | ||
@Getter | ||
public class MypageInfo { | ||
public class MyPageResponse { | ||
@Schema(description = "닉네임", example = "피치푸치") | ||
private String nickname; | ||
|
||
@Schema(description = "연결 계정 정보", example = "피치푸치") | ||
private OauthProvider accountFrom; | ||
private OauthProvider provider; | ||
} |
2 changes: 1 addition & 1 deletion
2
...atssu/domain/page/dto/MyReviewDetail.java → ...atssu/domain/user/dto/MyReviewDetail.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
16 changes: 0 additions & 16 deletions
16
src/main/java/ssu/eatssu/domain/user/dto/NicknameEdit.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.