-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature] - 여행 계획 코드 리팩토링 #67
Merged
+46
−31
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
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.NotBlank; | ||
import jakarta.validation.constraints.NotNull; | ||
import lombok.Builder; | ||
|
@@ -15,14 +15,12 @@ public record PlanPlaceCreateRequest( | |
@NotBlank(message = "장소명은 비어있을 수 없습니다.") String placeName, | ||
@Schema(description = "여행 장소 설명", example = "신나는 여행 장소") | ||
String description, | ||
@Schema(description = "여행 장소 순서", example = "1") | ||
@NotNull | ||
@Min(value = 0, message = "순서는 1 이상이어야 합니다.") | ||
int order, | ||
@NotNull PlanLocationCreateRequest location | ||
@Valid | ||
@NotNull(message = "위치는 비어있을 수 없습니다.") | ||
PlanLocationCreateRequest location | ||
) { | ||
|
||
public TravelPlanPlace toPlanPlace(TravelPlanDay day, Place place) { | ||
public TravelPlanPlace toPlanPlace(int order, TravelPlanDay day, Place place) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🤔 순서를 외부에서 주입해준다.. 더 나은 방법이 있지 않을까요.. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 제가 착각했네요! Approve 하겠습니다! |
||
return new TravelPlanPlace(description, order, day, place); | ||
} | ||
|
||
|
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
저희 Logging 정책에 대해서도 이야기를 나눠봐야겠네요.
로그 메시지 컨벤션도 정해야 할 것 같습니다.