Skip to content

Commit

Permalink
[Chore] #268 - Coordinate DTO 네이밍 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
parkrootseok committed May 10, 2023
1 parent eb624f4 commit 2d74937
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@
import java.util.List;
import lombok.Data;
import lombok.NoArgsConstructor;
import shop.cazait.domain.coordinate.entity.Documents;

@Data
@NoArgsConstructor
public class CoordinateVO {
public class ExtKakaoCoordinateOutDTO {

private List<Documents> documents = new ArrayList<>();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package shop.cazait.domain.coordinate.dto;
package shop.cazait.domain.coordinate.entity;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.PropertyNamingStrategies;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.web.reactive.function.client.WebClient;
import shop.cazait.domain.coordinate.dto.CoordinateVO;
import shop.cazait.domain.coordinate.dto.ExtKakaoCoordinateOutDTO;
import shop.cazait.domain.cafe.dto.PostCafeReq;
import shop.cazait.domain.coordinate.entity.Coordinate;

Expand All @@ -20,15 +20,15 @@ public class CoordinateService {
private String uri = "/v2/local/search/address.json";

public Coordinate getCoordinate(PostCafeReq cafeReq) throws JsonProcessingException {
CoordinateVO coordinateVO = getCoordinateFromAddress(cafeReq.getAddress());
ExtKakaoCoordinateOutDTO extKakaoCoordinateOutDTO = getCoordinateFromAddress(cafeReq.getAddress());
Coordinate coordinate = Coordinate.builder()
.longitude(coordinateVO.getDocuments().get(0).getLongitude())
.latitude(coordinateVO.getDocuments().get(0).getLatitude())
.longitude(extKakaoCoordinateOutDTO.getDocuments().get(0).getLongitude())
.latitude(extKakaoCoordinateOutDTO.getDocuments().get(0).getLatitude())
.build();
return coordinate;
}

private CoordinateVO getCoordinateFromAddress(String address) throws JsonProcessingException {
private ExtKakaoCoordinateOutDTO getCoordinateFromAddress(String address) throws JsonProcessingException {

ObjectMapper mapper = new ObjectMapper()
.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
Expand All @@ -46,8 +46,8 @@ private CoordinateVO getCoordinateFromAddress(String address) throws JsonProcess
return response.bodyToMono(String.class);
}).block();

CoordinateVO coordinateVO = mapper.readValue(jsonString, CoordinateVO.class);
return coordinateVO;
ExtKakaoCoordinateOutDTO extKakaoCoordinateOutDTO = mapper.readValue(jsonString, ExtKakaoCoordinateOutDTO.class);
return extKakaoCoordinateOutDTO;

}
}

0 comments on commit 2d74937

Please sign in to comment.