forked from woowacourse-teams/2024-touroot
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Feature] - 여행 계획 코드 리팩토링 (woowacourse-teams#67)
* feat: MethodArgumentNotValidException handler 추가 * fix: TravelPlan Request에서 order 제거 후 index 사용으로 변경
- Loading branch information
Showing
7 changed files
with
46 additions
and
31 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
16 changes: 8 additions & 8 deletions
16
backend/src/main/java/woowacourse/touroot/travelplan/dto/request/PlanDayCreateRequest.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 |
---|---|---|
@@ -1,23 +1,23 @@ | ||
package woowacourse.touroot.travelplan.dto.request; | ||
|
||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import jakarta.validation.constraints.Min; | ||
import jakarta.validation.Valid; | ||
import jakarta.validation.constraints.NotNull; | ||
import jakarta.validation.constraints.Size; | ||
import woowacourse.touroot.travelplan.domain.TravelPlan; | ||
import woowacourse.touroot.travelplan.domain.TravelPlanDay; | ||
|
||
import java.util.List; | ||
|
||
public record PlanDayCreateRequest( | ||
@Schema(description = "여행 계획 날짜", example = "1") | ||
@NotNull(message = "날짜는 비어있을 수 없습니다.") | ||
@Min(value = 0, message = "날짜는 1 이상이어야 합니다.") | ||
int day, | ||
@Schema(description = "여행 장소 정보") | ||
@NotNull(message = "여행 장소 정보는 비어있을 수 없습니다.") List<PlanPlaceCreateRequest> places | ||
@Valid | ||
@Size(min = 1, message = "여행 장소는 한 개 이상이어야 합니다.") | ||
@NotNull(message = "여행 장소 정보는 비어있을 수 없습니다.") | ||
List<PlanPlaceCreateRequest> places | ||
) { | ||
|
||
public TravelPlanDay toPlanDay(TravelPlan plan) { | ||
return new TravelPlanDay(day, plan); | ||
public TravelPlanDay toPlanDay(int order, TravelPlan plan) { | ||
return new TravelPlanDay(order, plan); | ||
} | ||
} |
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
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