-
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.
Merge pull request #31 from Team-Going/feature/27
[feat] 여행 생성 API 구현
- Loading branch information
Showing
8 changed files
with
163 additions
and
10 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
19 changes: 19 additions & 0 deletions
19
doorip-api/src/main/java/org/doorip/trip/dto/request/TripCreateRequest.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,19 @@ | ||
package org.doorip.trip.dto.request; | ||
|
||
import com.fasterxml.jackson.annotation.JsonFormat; | ||
|
||
import java.time.LocalDate; | ||
|
||
public record TripCreateRequest( | ||
String title, | ||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd", timezone = "Asia/Seoul") | ||
LocalDate startDate, | ||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd", timezone = "Asia/Seoul") | ||
LocalDate endDate, | ||
int styleA, | ||
int styleB, | ||
int styleC, | ||
int styleD, | ||
int styleE | ||
) { | ||
} |
31 changes: 31 additions & 0 deletions
31
doorip-api/src/main/java/org/doorip/trip/dto/response/TripCreateResponse.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,31 @@ | ||
package org.doorip.trip.dto.response; | ||
|
||
import com.fasterxml.jackson.annotation.JsonFormat; | ||
import org.doorip.trip.domain.Trip; | ||
|
||
import java.time.LocalDate; | ||
|
||
import static java.time.Period.between; | ||
|
||
public record TripCreateResponse( | ||
Long tripId, | ||
String title, | ||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd", timezone = "Asia/Seoul") | ||
LocalDate startDate, | ||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd", timezone = "Asia/Seoul") | ||
LocalDate endDate, | ||
String code, | ||
int day | ||
) { | ||
|
||
public static TripCreateResponse of(Trip trip) { | ||
return new TripCreateResponse( | ||
trip.getId(), | ||
trip.getTitle(), | ||
trip.getStartDate(), | ||
trip.getEndDate(), | ||
trip.getCode(), | ||
between(LocalDate.now(), trip.getStartDate()).getDays() | ||
); | ||
} | ||
} |
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