Skip to content

Commit 930dbbf

Browse files
authored
Merge pull request #85 from ConnectCo/feat/list-inquiry-api
[FIX] 이벤트, 쿠폰 조회 API 수정
2 parents 066cc97 + 6922d09 commit 930dbbf

File tree

8 files changed

+22
-45
lines changed

8 files changed

+22
-45
lines changed

src/main/java/com/connectCo/config/security/SecurityConstant.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,11 @@ public class SecurityConstant {
1111
public static final String[] PUBLIC_URLS = {
1212
"/auth/login", "/auth/refresh",
1313
"/stores/*/detail", "/organizations/*/detail",
14-
"/coupons/*/detail", "/coupons/store/*", "/coupons",
15-
"/events/*/detail",
14+
"/coupons/*/detail", "/coupons/store/*", "/coupons/list", "/coupons/search",
15+
"/events/*/detail", "/events/organization/*", "/events/list", "/events/search",
1616
"/v3/**", "/swagger-ui/**",
1717
"/test/**",
1818
"/ws/**", "members/fcm-token",
19-
"/events/search", "/coupons/search"
2019
};
2120

2221
// 로그인 필요 API

src/main/java/com/connectCo/domain/coupon/controller/CouponController.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ public BaseResponse<CouponPagingResponse<CouponSummaryInquiryResponse>> inquiryC
132132
}
133133

134134
@Operation(summary = "쿠폰 목록 조회 API", description = "비로그인 시도 가능(비로그인 시 현재 위치 기준)")
135-
@GetMapping
135+
@GetMapping("/list")
136136
@Parameters(value = {
137137
@Parameter(name = "type", description = "쿠폰 조회 타입(생성순, 거리순, 신청마감일 임박순)"),
138138
@Parameter(name = "latitude", description = "위도, 비로그인 시 필수"),

src/main/java/com/connectCo/domain/coupon/dto/response/CouponSummaryInquiryResponse.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,10 @@ public class CouponSummaryInquiryResponse {
2323

2424
@Schema(description = "쿠폰 썸네일 URL", example = "thumbnail-url")
2525
private String thumbnail;
26+
27+
@Schema(description = "위도", example = "36.123")
28+
private Double latitude;
29+
30+
@Schema(description = "경도", example = "127.111")
31+
private Double longitude;
2632
}

src/main/java/com/connectCo/domain/coupon/mapper/CouponMapper.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.connectCo.domain.coupon.mapper;
22

3+
import com.connectCo.domain.address.entity.Address;
34
import com.connectCo.domain.coupon.dto.request.CouponCreateRequest;
45
import com.connectCo.domain.coupon.dto.response.CouponDetailInquiryResponse;
56
import com.connectCo.domain.coupon.dto.response.CouponPagingResponse;
@@ -12,6 +13,8 @@
1213
import org.springframework.data.domain.Page;
1314
import org.springframework.stereotype.Component;
1415

16+
import java.util.Optional;
17+
1518
@Component
1619
public class CouponMapper {
1720

@@ -59,12 +62,16 @@ public CouponSummaryInquiryResponse toCouponSummaryInquiryResponse(Coupon coupon
5962
.map(CouponImage::getUrl)
6063
.orElse(null);
6164

65+
Address address = coupon.getStore().getAddress();
66+
6267
return CouponSummaryInquiryResponse.builder()
6368
.id(coupon.getId())
6469
.name(coupon.getStore().getName())
6570
.title(coupon.getName())
6671
.expiredAt(coupon.getExpiredAt())
6772
.thumbnail(thumbnail)
73+
.latitude(Optional.ofNullable(address).map(Address::getLatitude).orElse(null))
74+
.longitude(Optional.ofNullable(address).map(Address::getLongitude).orElse(null))
6875
.build();
6976
}
7077

src/main/java/com/connectCo/domain/event/controller/EventController.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ public BaseResponse<EventPagingResponse<EventSummaryInquiryResponse>> inquiryEve
136136
@Parameter(name = "page", description = "페이지 번호(0부터 시작)"),
137137
@Parameter(name = "size", description = "한 페이지 당 이벤트 개수"),
138138
})
139-
@GetMapping
139+
@GetMapping("/list")
140140
public BaseResponse<EventPagingResponse<EventSummaryInquiryResponse>> inquiryEvents(
141141
@AuthenticationPrincipal PrincipalDetails principal,
142142
@RequestParam EventSearchType type,

src/main/java/com/connectCo/domain/event/dto/response/EventLocationInquiryResponse.java

Lines changed: 0 additions & 24 deletions
This file was deleted.

src/main/java/com/connectCo/domain/event/dto/response/EventSummaryInquiryResponse.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,9 @@ public class EventSummaryInquiryResponse {
2424
@Schema(description = "이벤트 썸네일 URL", example = "thumbnail-url")
2525
private String thumbnail;
2626

27+
@Schema(description = "위도", example = "36.123")
28+
private Double latitude;
29+
30+
@Schema(description = "경도", example = "127.111")
31+
private Double longitude;
2732
}

src/main/java/com/connectCo/domain/event/mapper/EventMapper.java

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
package com.connectCo.domain.event.mapper;
22

33
import com.connectCo.domain.event.entity.EventLike;
4-
import com.connectCo.domain.member.entity.Member;
54
import com.connectCo.domain.address.entity.Address;
65
import com.connectCo.domain.event.dto.request.EventCreateRequest;
76
import com.connectCo.domain.event.dto.response.EventDetailInquiryResponse;
8-
import com.connectCo.domain.event.dto.response.EventLocationInquiryResponse;
97
import com.connectCo.domain.event.dto.response.EventPagingResponse;
108
import com.connectCo.domain.event.dto.response.EventSummaryInquiryResponse;
119
import com.connectCo.domain.event.entity.Event;
@@ -100,22 +98,8 @@ public EventSummaryInquiryResponse toEventSummaryInquiryResponse(Event event) {
10098
.title(event.getName())
10199
.expiredAt(event.getExpiredAt())
102100
.thumbnail(event.getThumbnail())
103-
.build();
104-
}
105-
106-
public EventLocationInquiryResponse toEventLocationInquiryResponse(Object[] eventWithDistance) {
107-
Event event = (Event) eventWithDistance[0];
108-
Double distance = (Double) eventWithDistance[1];
109-
return EventLocationInquiryResponse.builder()
110-
.eventId(event.getId())
111-
.organizationName(event.getOrganization().getName())
112-
.name(event.getName())
113-
.startAt(event.getStartAt())
114-
.endAt(event.getEndAt())
115-
.thumbnail(event.getThumbnail())
116101
.latitude(event.getAddress().getLatitude())
117102
.longitude(event.getAddress().getLongitude())
118-
.distance(distance)
119103
.build();
120104
}
121105

0 commit comments

Comments
 (0)