-
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.
feat : 학원 목록 조회 좋아요 쿼리 분리 및 2차 캐시 사용 퍼사드 구현
- Loading branch information
Showing
3 changed files
with
98 additions
and
0 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
22 changes: 22 additions & 0 deletions
22
...va/org/guzzing/studayserver/domain/academy/facade/dto/AcademiesByLocationFacadeParam.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,22 @@ | ||
package org.guzzing.studayserver.domain.academy.facade.dto; | ||
|
||
import org.guzzing.studayserver.domain.academy.service.dto.param.AcademyByLocationWithCursorParam; | ||
import org.guzzing.studayserver.domain.academy.util.Latitude; | ||
import org.guzzing.studayserver.domain.academy.util.Longitude; | ||
|
||
public record AcademiesByLocationFacadeParam( | ||
Latitude baseLatitude, | ||
Longitude baseLongitude, | ||
Long memberId, | ||
Long lastAcademyId | ||
) { | ||
|
||
public AcademyByLocationWithCursorParam toAcademyByLocationWithCursorParam() { | ||
return new AcademyByLocationWithCursorParam( | ||
baseLatitude, | ||
baseLongitude, | ||
memberId, | ||
lastAcademyId | ||
); | ||
} | ||
} |
55 changes: 55 additions & 0 deletions
55
.../org/guzzing/studayserver/domain/academy/facade/dto/AcademiesByLocationFacadeResults.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,55 @@ | ||
package org.guzzing.studayserver.domain.academy.facade.dto; | ||
|
||
import org.guzzing.studayserver.domain.academy.service.dto.result.AcademyByLocationWithCursorAndNotLikeResults; | ||
|
||
import java.util.List; | ||
import java.util.Map; | ||
|
||
public record AcademiesByLocationFacadeResults( | ||
List<AcademiesByLocationFacadeResult> academiesByLocationFacadeResults, | ||
long lastAcademyId, | ||
boolean hasNext | ||
) { | ||
public static AcademiesByLocationFacadeResults to( | ||
AcademyByLocationWithCursorAndNotLikeResults results, | ||
Map<Long, Boolean> isLikes | ||
) { | ||
return new AcademiesByLocationFacadeResults( | ||
results.academiesByLocationResults() | ||
.stream() | ||
.map(result -> AcademiesByLocationFacadeResult.to(result, isLikes.get(result.academyId()))) | ||
.toList(), | ||
results.lastAcademyId(), | ||
results.hasNext() | ||
); | ||
} | ||
|
||
public record AcademiesByLocationFacadeResult( | ||
long academyId, | ||
String academyName, | ||
String address, | ||
String contact, | ||
List<String> categories, | ||
double latitude, | ||
double longitude, | ||
String shuttleAvailable, | ||
boolean isLiked | ||
) { | ||
public static AcademiesByLocationFacadeResult to( | ||
AcademyByLocationWithCursorAndNotLikeResults.AcademiesByLocationWithCursorAndNotLikeResult result, | ||
boolean isLiked | ||
) { | ||
return new AcademiesByLocationFacadeResult( | ||
result.academyId(), | ||
result.academyName(), | ||
result.address(), | ||
result.contact(), | ||
result.categories(), | ||
result.latitude(), | ||
result.longitude(), | ||
result.shuttleAvailable(), | ||
isLiked | ||
); | ||
} | ||
} | ||
} |