-
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.
Browse files
Browse the repository at this point in the history
[refactor/#241] 스크랩 양방향 매핑을 제거하기 위한 리팩토링
- Loading branch information
Showing
14 changed files
with
115 additions
and
198 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
58 changes: 0 additions & 58 deletions
58
src/main/java/umc/th/juinjang/converter/limjang/LimjangTotalListConverter.java
This file was deleted.
Oops, something went wrong.
40 changes: 0 additions & 40 deletions
40
src/main/java/umc/th/juinjang/converter/limjang/LimjangsGetResponseConverter.java
This file was deleted.
Oops, something went wrong.
40 changes: 40 additions & 0 deletions
40
src/main/java/umc/th/juinjang/model/dto/limjang/response/LimjangsGetByKeywordResponse.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,40 @@ | ||
package umc.th.juinjang.model.dto.limjang.response; | ||
|
||
import static umc.th.juinjang.service.LimjangService.LimjangPriceBridge.makePriceListVersion2; | ||
|
||
import java.util.List; | ||
import java.util.Map; | ||
import umc.th.juinjang.model.entity.Image; | ||
import umc.th.juinjang.model.entity.Limjang; | ||
|
||
public record LimjangsGetByKeywordResponse(List<LimjangByKeywordResponse> limjangList) { | ||
record LimjangByKeywordResponse( | ||
long limjangId, | ||
List<String> images, | ||
int purposeCode, | ||
boolean isScraped, | ||
String nickname, | ||
int priceType, | ||
List<String> priceList, | ||
String totalAverage, | ||
String address | ||
) { | ||
static LimjangByKeywordResponse of(Limjang limjang, boolean isScraped) { | ||
return new LimjangByKeywordResponse( | ||
limjang.getLimjangId(), | ||
limjang.getImageList().stream().map(Image::getImageUrl).toList(), | ||
limjang.getPurpose().getValue(), | ||
isScraped, | ||
limjang.getNickname(), | ||
limjang.getPriceType().getValue(), | ||
makePriceListVersion2(limjang.getPriceType(), limjang.getPurpose(), limjang.getLimjangPrice()), | ||
limjang.getReport() == null ? null : limjang.getReport().getTotalRate().toString(), | ||
limjang.getAddress() | ||
); | ||
} | ||
} | ||
|
||
public static LimjangsGetByKeywordResponse of(List<Limjang> limjangList, Map<Long, Boolean> mapLimjangToScrapStatus) { | ||
return new LimjangsGetByKeywordResponse(limjangList.stream().map(it -> LimjangByKeywordResponse.of(it, mapLimjangToScrapStatus.get(it.getLimjangId()))).toList()); | ||
} | ||
} |
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
11 changes: 2 additions & 9 deletions
11
src/main/java/umc/th/juinjang/repository/limjang/LimjangQueryDslRepository.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,22 +1,15 @@ | ||
package umc.th.juinjang.repository.limjang; | ||
|
||
import java.util.List; | ||
import org.springframework.data.domain.Pageable; | ||
import umc.th.juinjang.model.dto.limjang.enums.LimjangSortOptions; | ||
import umc.th.juinjang.model.entity.Limjang; | ||
import umc.th.juinjang.model.entity.Member; | ||
|
||
public interface LimjangQueryDslRepository { | ||
|
||
List<Limjang> searchLimjangs(Member member, String keyword); | ||
|
||
// List<Limjang> findTop5ByMemberIdOrderByUpdatedAtDesc(Member member); | ||
List<Limjang> searchLimjangsWhereDeletedIsFalse(Member member, String keyword); | ||
|
||
List<Limjang> findMainScreenContentsLimjang(Member member); | ||
|
||
Limjang findByIdWithLimjangPrice(long memberId, long limjangId); | ||
|
||
List<Limjang> findAllLimjangs(Member member); | ||
|
||
List<Limjang> findAllByMemberAndOrderByParam(Member member, LimjangSortOptions sort); | ||
List<Limjang> findAllByMemberAndDeletedIsFalseOrderByParam(Member member, LimjangSortOptions sort); | ||
} |
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
Oops, something went wrong.