-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Feature] - 여행기 작성 API 및 여행기 전체 조회 API 구현
* feat: 여행기 작성 API를 위한 DTO 구현 * feat: 여행기 사진 엔티티 생성자 매개변수 순서 변경 * feat: 여행기 작성 API 구현 * feat: 메인 페이지를 위한 여행기 전체 목록 조회 API 구현 * chore: EOL 추가 * refactor: 불필요한 Bean validation 제거 * refactor: embedded DTO bean validation 추가 * chore: 실수로 제거한 필드 추가 * refactor: 패키지 구조 변경 * chore: 불필요한 final 제거 * refactor: 여행기 관련 도메인 조회 기능아 정적 팩토리 메소드를 활용하도록 개선
- Loading branch information
Showing
28 changed files
with
472 additions
and
191 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
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
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
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
18 changes: 0 additions & 18 deletions
18
...nd/src/main/java/woowacourse/touroot/travelogue/domain/day/dto/TravelogueDayResponse.java
This file was deleted.
Oops, something went wrong.
28 changes: 0 additions & 28 deletions
28
...src/main/java/woowacourse/touroot/travelogue/domain/day/service/TravelogueDayService.java
This file was deleted.
Oops, something went wrong.
25 changes: 0 additions & 25 deletions
25
...main/java/woowacourse/touroot/travelogue/domain/photo/service/TraveloguePhotoService.java
This file was deleted.
Oops, something went wrong.
28 changes: 0 additions & 28 deletions
28
...rc/main/java/woowacourse/touroot/travelogue/domain/place/dto/TraveloguePlaceResponse.java
This file was deleted.
Oops, something went wrong.
28 changes: 0 additions & 28 deletions
28
...main/java/woowacourse/touroot/travelogue/domain/place/service/TraveloguePlaceService.java
This file was deleted.
Oops, something went wrong.
20 changes: 20 additions & 0 deletions
20
backend/src/main/java/woowacourse/touroot/travelogue/dto/request/TravelogueDayRequest.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,20 @@ | ||
package woowacourse.touroot.travelogue.dto.request; | ||
|
||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import jakarta.validation.Valid; | ||
import jakarta.validation.constraints.NotNull; | ||
import java.util.List; | ||
import woowacourse.touroot.travelogue.domain.Travelogue; | ||
import woowacourse.touroot.travelogue.domain.TravelogueDay; | ||
|
||
public record TravelogueDayRequest( | ||
@Schema(description = "여행기 장소 목록") | ||
@NotNull(message = "여행기 장소 목록은 비어있을 수 없습니다.") | ||
@Valid | ||
List<TraveloguePlaceRequest> places | ||
) { | ||
|
||
public TravelogueDay toTravelogueDay(int order, Travelogue travelogue) { | ||
return new TravelogueDay(order, travelogue); | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
...d/src/main/java/woowacourse/touroot/travelogue/dto/request/TravelogueLocationRequest.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,14 @@ | ||
package woowacourse.touroot.travelogue.dto.request; | ||
|
||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import jakarta.validation.constraints.NotNull; | ||
|
||
public record TravelogueLocationRequest( | ||
@Schema(description = "여행기 장소 위도", example = "37.5175896") | ||
@NotNull(message = "여행기 장소 위도는 비어있을 수 없습니다.") | ||
String lat, | ||
@Schema(description = "여행기 장소 경도", example = "127.0867236") | ||
@NotNull(message = "여행기 장소 경도는 비어있을 수 없습니다.") | ||
String lng | ||
) { | ||
} |
17 changes: 17 additions & 0 deletions
17
backend/src/main/java/woowacourse/touroot/travelogue/dto/request/TraveloguePhotoRequest.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,17 @@ | ||
package woowacourse.touroot.travelogue.dto.request; | ||
|
||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import jakarta.validation.constraints.NotNull; | ||
import woowacourse.touroot.travelogue.domain.TraveloguePhoto; | ||
import woowacourse.touroot.travelogue.domain.TraveloguePlace; | ||
|
||
public record TraveloguePhotoRequest( | ||
@Schema(description = "여행기 장소 사진 Key", example = "photo.png") | ||
@NotNull(message = "여행기 장소 사진 Key 값은 비어있을 수 없습니다.") | ||
String key | ||
) { | ||
|
||
public TraveloguePhoto toTraveloguePhoto(int order, TraveloguePlace traveloguePlace) { | ||
return new TraveloguePhoto(order, key, traveloguePlace); | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
backend/src/main/java/woowacourse/touroot/travelogue/dto/request/TraveloguePlaceRequest.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,34 @@ | ||
package woowacourse.touroot.travelogue.dto.request; | ||
|
||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import jakarta.validation.Valid; | ||
import jakarta.validation.constraints.NotNull; | ||
import java.util.List; | ||
import woowacourse.touroot.place.domain.Place; | ||
import woowacourse.touroot.travelogue.domain.TravelogueDay; | ||
import woowacourse.touroot.travelogue.domain.TraveloguePlace; | ||
|
||
public record TraveloguePlaceRequest( | ||
@Schema(description = "여행기 장소 이름", example = "선릉 캠퍼스") | ||
@NotNull(message = "여행기 장소 이름은 비어있을 수 없습니다.") | ||
String name, | ||
@Schema(description = "여행기 장소 위치 정보") | ||
@NotNull(message = "여행기 장소 위치 정보는 비어있을 수 없습니다.") | ||
@Valid | ||
TravelogueLocationRequest location, | ||
@Schema(description = "여행기 장소 설명", example = "성담 빌딩에 위치한 선릉 캠퍼스입니다.") | ||
String description, | ||
@Schema(description = "여행기 장소 사진") | ||
@NotNull(message = "여행기 장소 사진은 비어있을 수 없습니다.") | ||
@Valid | ||
List<TraveloguePhotoRequest> photos | ||
) { | ||
|
||
public TraveloguePlace toTraveloguePlace(int order, Place place, TravelogueDay travelogueDay) { | ||
return new TraveloguePlace(order, description, place, travelogueDay); | ||
} | ||
|
||
public Place toPlace() { | ||
return new Place(name, location.lat(), location.lng()); | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
backend/src/main/java/woowacourse/touroot/travelogue/dto/request/TravelogueRequest.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,25 @@ | ||
package woowacourse.touroot.travelogue.dto.request; | ||
|
||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import jakarta.validation.Valid; | ||
import jakarta.validation.constraints.NotNull; | ||
import java.util.List; | ||
import woowacourse.touroot.travelogue.domain.Travelogue; | ||
|
||
public record TravelogueRequest( | ||
@Schema(description = "여행기 제목", example = "서울 강남 여행기") | ||
@NotNull(message = "여행기 제목은 비어있을 수 없습니다.") | ||
String title, | ||
@Schema(description = "여행기 섬네일", example = "https://thumbnail.png") | ||
@NotNull(message = "여행기 섬네일은 비어있을 수 없습니다.") | ||
String thumbnail, | ||
@Schema(description = "여행기 일자 목록") | ||
@NotNull(message = "여행기 일자 목록은 비어있을 수 없습니다.") | ||
@Valid | ||
List<TravelogueDayRequest> days | ||
) { | ||
|
||
public Travelogue toTravelogue() { | ||
return new Travelogue(title, thumbnail); | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
backend/src/main/java/woowacourse/touroot/travelogue/dto/response/TravelogueDayResponse.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 woowacourse.touroot.travelogue.dto.response; | ||
|
||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import java.util.List; | ||
import lombok.Builder; | ||
import woowacourse.touroot.travelogue.domain.TravelogueDay; | ||
|
||
@Builder | ||
public record TravelogueDayResponse( | ||
@Schema(description = "여행기 일자 ID", example = "1") | ||
Long id, | ||
@Schema(description = "여행기 장소 목록") | ||
List<TraveloguePlaceResponse> places | ||
) { | ||
|
||
public static TravelogueDayResponse of(TravelogueDay day, List<TraveloguePlaceResponse> places) { | ||
return TravelogueDayResponse.builder() | ||
.id(day.getId()) | ||
.places(places) | ||
.build(); | ||
} | ||
} |
Oops, something went wrong.