diff --git a/backend/src/main/java/woowacourse/touroot/travelogue/dto/request/TraveloguePlaceRequest.java b/backend/src/main/java/woowacourse/touroot/travelogue/dto/request/TraveloguePlaceRequest.java index fe6c92a1..c449974e 100644 --- a/backend/src/main/java/woowacourse/touroot/travelogue/dto/request/TraveloguePlaceRequest.java +++ b/backend/src/main/java/woowacourse/touroot/travelogue/dto/request/TraveloguePlaceRequest.java @@ -15,7 +15,7 @@ public record TraveloguePlaceRequest( @Schema(description = "여행기 장소 위치 정보") @NotNull(message = "여행기 장소 위치 정보는 비어있을 수 없습니다.") @Valid - TravelogueLocationRequest location, + TraveloguePositionRequest position, @Schema(description = "여행기 장소 설명", example = "성담 빌딩에 위치한 선릉 캠퍼스입니다.") String description, @Schema(description = "여행기 장소 사진") @@ -29,6 +29,6 @@ public TraveloguePlace toTraveloguePlace(int order, Place place, TravelogueDay t } public Place toPlace() { - return new Place(name, location.lat(), location.lng()); + return new Place(name, position.lat(), position.lng()); } } diff --git a/backend/src/main/java/woowacourse/touroot/travelogue/dto/request/TravelogueLocationRequest.java b/backend/src/main/java/woowacourse/touroot/travelogue/dto/request/TraveloguePositionRequest.java similarity index 92% rename from backend/src/main/java/woowacourse/touroot/travelogue/dto/request/TravelogueLocationRequest.java rename to backend/src/main/java/woowacourse/touroot/travelogue/dto/request/TraveloguePositionRequest.java index 9f995d1f..a71d690b 100644 --- a/backend/src/main/java/woowacourse/touroot/travelogue/dto/request/TravelogueLocationRequest.java +++ b/backend/src/main/java/woowacourse/touroot/travelogue/dto/request/TraveloguePositionRequest.java @@ -3,7 +3,7 @@ import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.NotNull; -public record TravelogueLocationRequest( +public record TraveloguePositionRequest( @Schema(description = "여행기 장소 위도", example = "37.5175896") @NotNull(message = "여행기 장소 위도는 비어있을 수 없습니다.") String lat, diff --git a/backend/src/main/java/woowacourse/touroot/travelogue/dto/response/TraveloguePlaceResponse.java b/backend/src/main/java/woowacourse/touroot/travelogue/dto/response/TraveloguePlaceResponse.java index ef8f20eb..f80a1757 100644 --- a/backend/src/main/java/woowacourse/touroot/travelogue/dto/response/TraveloguePlaceResponse.java +++ b/backend/src/main/java/woowacourse/touroot/travelogue/dto/response/TraveloguePlaceResponse.java @@ -13,7 +13,7 @@ public record TraveloguePlaceResponse( String name, @Schema(description = "여행기 장소 설명", example = "성담 빌딩에 위치한 선릉 캠퍼스입니다.") String description, - TravelogueLocationResponse location, + TraveloguePositionResponse position, List photoUrls ) { @@ -22,7 +22,7 @@ public static TraveloguePlaceResponse of(TraveloguePlace place, List pho .id(place.getId()) .name(place.getName()) .description(place.getDescription()) - .location(TravelogueLocationResponse.from(place)) + .position(TraveloguePositionResponse.from(place)) .photoUrls(photoUrls) .build(); } diff --git a/backend/src/main/java/woowacourse/touroot/travelogue/dto/response/TravelogueLocationResponse.java b/backend/src/main/java/woowacourse/touroot/travelogue/dto/response/TraveloguePositionResponse.java similarity index 76% rename from backend/src/main/java/woowacourse/touroot/travelogue/dto/response/TravelogueLocationResponse.java rename to backend/src/main/java/woowacourse/touroot/travelogue/dto/response/TraveloguePositionResponse.java index e3a18728..dc26d2c6 100644 --- a/backend/src/main/java/woowacourse/touroot/travelogue/dto/response/TravelogueLocationResponse.java +++ b/backend/src/main/java/woowacourse/touroot/travelogue/dto/response/TraveloguePositionResponse.java @@ -5,15 +5,15 @@ import woowacourse.touroot.travelogue.domain.TraveloguePlace; @Builder -public record TravelogueLocationResponse( +public record TraveloguePositionResponse( @Schema(description = "여행기 장소 위도", example = "37.5175896") String lat, @Schema(description = "여행기 장소 설명", example = "127.0867236") String lng ) { - - public static TravelogueLocationResponse from(TraveloguePlace place) { - return TravelogueLocationResponse.builder() + + public static TraveloguePositionResponse from(TraveloguePlace place) { + return TraveloguePositionResponse.builder() .lat(place.getLatitude()) .lng(place.getLongitude()) .build(); diff --git a/backend/src/main/java/woowacourse/touroot/travelogue/service/TraveloguePlaceService.java b/backend/src/main/java/woowacourse/touroot/travelogue/service/TraveloguePlaceService.java index d82acffe..441e4844 100644 --- a/backend/src/main/java/woowacourse/touroot/travelogue/service/TraveloguePlaceService.java +++ b/backend/src/main/java/woowacourse/touroot/travelogue/service/TraveloguePlaceService.java @@ -41,8 +41,8 @@ public Map> createPlaces( private Place getPlace(TraveloguePlaceRequest request) { return placeRepository.findByNameAndLatitudeAndLongitude( request.name(), - request.location().lat(), - request.location().lng() + request.position().lat(), + request.position().lng() ).orElseGet(() -> placeRepository.save(request.toPlace())); } diff --git a/backend/src/test/java/woowacourse/touroot/travelogue/fixture/TravelogueTestFixture.java b/backend/src/test/java/woowacourse/touroot/travelogue/fixture/TravelogueTestFixture.java index d5da7601..87c0a830 100644 --- a/backend/src/test/java/woowacourse/touroot/travelogue/fixture/TravelogueTestFixture.java +++ b/backend/src/test/java/woowacourse/touroot/travelogue/fixture/TravelogueTestFixture.java @@ -10,13 +10,13 @@ import woowacourse.touroot.travelogue.domain.TraveloguePhoto; import woowacourse.touroot.travelogue.domain.TraveloguePlace; import woowacourse.touroot.travelogue.dto.request.TravelogueDayRequest; -import woowacourse.touroot.travelogue.dto.request.TravelogueLocationRequest; import woowacourse.touroot.travelogue.dto.request.TraveloguePhotoRequest; import woowacourse.touroot.travelogue.dto.request.TraveloguePlaceRequest; +import woowacourse.touroot.travelogue.dto.request.TraveloguePositionRequest; import woowacourse.touroot.travelogue.dto.request.TravelogueRequest; import woowacourse.touroot.travelogue.dto.response.TravelogueDayResponse; -import woowacourse.touroot.travelogue.dto.response.TravelogueLocationResponse; import woowacourse.touroot.travelogue.dto.response.TraveloguePlaceResponse; +import woowacourse.touroot.travelogue.dto.response.TraveloguePositionResponse; import woowacourse.touroot.travelogue.dto.response.TravelogueResponse; @Component @@ -56,14 +56,14 @@ public static List getTravelogueDayRequests() { public static List getTraveloguePlaceRequests() { return List.of(new TraveloguePlaceRequest( "블라디보스토크", - getTravelogueLocationRequest(), + getTraveloguePositionRequest(), "극동의 진주, 블라디보스토크.", getTraveloguePhotoRequests() )); } - public static TravelogueLocationRequest getTravelogueLocationRequest() { - return new TravelogueLocationRequest("37.1234", "127.1234"); + public static TraveloguePositionRequest getTraveloguePositionRequest() { + return new TraveloguePositionRequest("37.1234", "127.1234"); } public static List getTraveloguePhotoRequests() { @@ -101,14 +101,14 @@ public static List getTraveloguePlaceResponses() { .id(1L) .name("블라디보스토크") .description("극동의 진주, 블라디보스토크.") - .location(getTravelogueLocationResponse()) + .position(getTraveloguePositionResponse()) .photoUrls(getTraveloguePhotoUrls()) .build() ); } - public static TravelogueLocationResponse getTravelogueLocationResponse() { - return TravelogueLocationResponse.builder() + public static TraveloguePositionResponse getTraveloguePositionResponse() { + return TraveloguePositionResponse.builder() .lat("37.1234") .lng("127.1234") .build(); diff --git a/backend/src/test/java/woowacourse/touroot/travelogue/helper/TravelogueTestHelper.java b/backend/src/test/java/woowacourse/touroot/travelogue/helper/TravelogueTestHelper.java index 5e24a140..119a93e7 100644 --- a/backend/src/test/java/woowacourse/touroot/travelogue/helper/TravelogueTestHelper.java +++ b/backend/src/test/java/woowacourse/touroot/travelogue/helper/TravelogueTestHelper.java @@ -62,8 +62,8 @@ public static TraveloguePhoto getTraveloguePhoto(String key, Integer order, Trav public void initTravelogueTestData() { Travelogue travelogue = persistTravelogue(); TravelogueDay day = persistTravelogueDay(travelogue); - Place location = persistPlace(); - TraveloguePlace place = persistTraveloguePlace(location, day); + Place position = persistPlace(); + TraveloguePlace place = persistTraveloguePlace(position, day); persistTraveloguePhoto(place); } @@ -85,8 +85,8 @@ public Place persistPlace() { return placeRepository.save(place); } - public TraveloguePlace persistTraveloguePlace(Place location, TravelogueDay day) { - TraveloguePlace place = getTraveloguePlace(1, "극동의 진주, 블라디보스토크.", location, day); + public TraveloguePlace persistTraveloguePlace(Place position, TravelogueDay day) { + TraveloguePlace place = getTraveloguePlace(1, "극동의 진주, 블라디보스토크.", position, day); return traveloguePlaceRepository.save(place); } diff --git a/backend/src/test/java/woowacourse/touroot/travelogue/service/TraveloguePhotoServiceTest.java b/backend/src/test/java/woowacourse/touroot/travelogue/service/TraveloguePhotoServiceTest.java index ec8b9783..3e2f79cd 100644 --- a/backend/src/test/java/woowacourse/touroot/travelogue/service/TraveloguePhotoServiceTest.java +++ b/backend/src/test/java/woowacourse/touroot/travelogue/service/TraveloguePhotoServiceTest.java @@ -35,8 +35,8 @@ void createPhotos() { List requests = TravelogueTestFixture.getTraveloguePhotoRequests(); Travelogue travelogue = testHelper.persistTravelogue(); TravelogueDay day = testHelper.persistTravelogueDay(travelogue); - Place location = testHelper.persistPlace(); - TraveloguePlace place = testHelper.persistTraveloguePlace(location, day); + Place position = testHelper.persistPlace(); + TraveloguePlace place = testHelper.persistTraveloguePlace(position, day); List photos = photoService.createPhotos(requests, place); @@ -48,8 +48,8 @@ void createPhotos() { void findPhotoUrlsByPlace() { Travelogue travelogue = testHelper.persistTravelogue(); TravelogueDay day = testHelper.persistTravelogueDay(travelogue); - Place location = testHelper.persistPlace(); - TraveloguePlace place = testHelper.persistTraveloguePlace(location, day); + Place position = testHelper.persistPlace(); + TraveloguePlace place = testHelper.persistTraveloguePlace(position, day); TraveloguePhoto photo = testHelper.persistTraveloguePhoto(place); List photoUrls = photoService.findPhotoUrlsByPlace(place); diff --git a/backend/src/test/java/woowacourse/touroot/travelogue/service/TraveloguePlaceServiceTest.java b/backend/src/test/java/woowacourse/touroot/travelogue/service/TraveloguePlaceServiceTest.java index 8bc88ce4..d6b0d91c 100644 --- a/backend/src/test/java/woowacourse/touroot/travelogue/service/TraveloguePlaceServiceTest.java +++ b/backend/src/test/java/woowacourse/touroot/travelogue/service/TraveloguePlaceServiceTest.java @@ -68,8 +68,8 @@ void createPlaces() { void findTraveloguePlacesByDay() { Travelogue travelogue = testHelper.persistTravelogue(); TravelogueDay day = testHelper.persistTravelogueDay(travelogue); - Place location = testHelper.persistPlace(); - TraveloguePlace place = testHelper.persistTraveloguePlace(location, day); + Place position = testHelper.persistPlace(); + TraveloguePlace place = testHelper.persistTraveloguePlace(position, day); List places = placeService.findTraveloguePlacesByDay(day);