Skip to content

Commit

Permalink
Merge pull request #23 from KUSITMS-Team-A/fix/22-find-store
Browse files Browse the repository at this point in the history
[#22] 가게 찾기 API 수정
  • Loading branch information
yeop0740 authored Nov 21, 2023
2 parents 1d08066 + acbe48e commit e949f1b
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ public class ReadStoreDetailsDto {

private String address;

private Double latitude;

private Double longitude;

private List<BusinessHourDto> businessHours;

private String phoneNumber;
Expand All @@ -41,6 +45,8 @@ public static ReadStoreDetailsDto from(StoreDetailsDto store, List<BusinessHour>
.category(store.getCategory().getCategoryName())
.description(store.getDescription())
.address(store.getAddress())
.latitude(store.getLatitude())
.longitude(store.getLongitude())
.phoneNumber(store.getPhoneNumber())
.distance(store.getDistance())
.mapUrl(store.getMapUrl())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ public interface StoreDetailsDto {

String getAddress();

Double getLatitude();

Double getLongitude();

String getPhoneNumber();

Double getDistance();
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/com/backend/domain/store/dto/StoresDto.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ public interface StoresDto {

String getAddress();

Double getLatitude();

Double getLongitude();

Category getCategory();

Double getDistance();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ public interface StoreRepository extends JpaRepository<Store, Long> {
" CASE WHEN p.pick_id IS NOT NULL THEN 'TRUE' ELSE 'FALSE' END AS isPicked," +
" s.category AS category," +
" s.address AS address," +
" s.latitude AS latitude," +
" s.longitude AS longitude," +
" s.phone_number AS phoneNumber," +
" ST_Distance_Sphere(point(s.longitude, s.latitude), point(:longitude, :latitude)) AS distance," +
" s.map_url AS mapUrl" +
Expand All @@ -45,6 +47,8 @@ Optional<StoreDetailsDto> findStoreDetailById(@Param("userId") Long userId,
" CASE WHEN p.pick_id IS NOT NULL THEN 'TRUE' ELSE 'FALSE' END AS isPicked," +
" s.category AS category," +
" s.address AS address," +
" s.latitude AS latitude," +
" s.longitude AS longitude," +
" ST_Distance_Sphere(point(s.longitude, s.latitude), point(:longitude, :latitude)) AS distance" +
" FROM store s" +
" JOIN pick p ON s.store_id = p.store_id AND p.user_id = :userId" +
Expand Down Expand Up @@ -74,6 +78,8 @@ Page<StoresDto> findAllContainsNameAndPicked(@Param("userId") Long userId,
" CASE WHEN p.pick_id IS NOT NULL THEN 'TRUE' ELSE 'FALSE' END AS isPicked," +
" s.category AS category," +
" s.address AS address," +
" s.latitude AS latitude," +
" s.longitude AS longitude," +
" ST_Distance_Sphere(point(s.longitude, s.latitude), point(:longitude, :latitude)) AS distance" +
" FROM store s" +
" JOIN pick p ON s.store_id = p.store_id AND p.user_id = :userId" +
Expand Down Expand Up @@ -104,6 +110,8 @@ Page<StoresDto> findAllContainsNameAndPickedAndCategory(@Param("userId") Long us
" CASE WHEN p.pick_id IS NOT NULL THEN 'TRUE' ELSE 'FALSE' END AS isPicked," +
" s.category AS category," +
" s.address AS address," +
" s.latitude AS latitude," +
" s.longitude AS longitude," +
" ST_Distance_Sphere(point(s.longitude, s.latitude), point(:longitude, :latitude)) AS distance" +
" FROM store s" +
" LEFT JOIN pick p ON s.store_id = p.store_id AND p.user_id = :userId" +
Expand Down Expand Up @@ -132,6 +140,8 @@ Page<StoresDto> findAllContainsName(@Param("userId") Long userId,
" CASE WHEN p.pick_id IS NOT NULL THEN 'TRUE' ELSE 'FALSE' END AS isPicked," +
" s.category AS category," +
" s.address AS address," +
" s.latitude AS latitude," +
" s.longitude AS longitude," +
" ST_Distance_Sphere(point(s.longitude, s.latitude), point(:longitude, :latitude)) AS distance" +
" FROM store s" +
" LEFT JOIN pick p ON s.store_id = p.store_id AND p.user_id = :userId" +
Expand Down

0 comments on commit e949f1b

Please sign in to comment.