-
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 #144 from Team-Going/feature/142
[feat] 여행 정보 조회 API 구현
- Loading branch information
Showing
4 changed files
with
55 additions
and
12 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
23 changes: 14 additions & 9 deletions
23
doorip-api/src/main/java/org/doorip/trip/dto/response/TripGetResponse.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,28 @@ | ||
package org.doorip.trip.dto.response; | ||
|
||
import com.fasterxml.jackson.annotation.JsonFormat; | ||
import lombok.AccessLevel; | ||
import lombok.Builder; | ||
import org.doorip.trip.domain.Trip; | ||
|
||
import java.util.List; | ||
import java.time.LocalDate; | ||
|
||
@Builder(access = AccessLevel.PRIVATE) | ||
public record TripGetResponse( | ||
String name, | ||
List<TripResponse> trips | ||
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 | ||
) { | ||
public static TripGetResponse of(String name, List<Trip> trips) { | ||
|
||
public static TripGetResponse of(Trip trip) { | ||
return TripGetResponse.builder() | ||
.name(name) | ||
.trips(trips.stream() | ||
.map(TripResponse::of) | ||
.toList()) | ||
.tripId(trip.getId()) | ||
.title(trip.getTitle()) | ||
.startDate(trip.getStartDate()) | ||
.endDate(trip.getEndDate()) | ||
.build(); | ||
|
||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
doorip-api/src/main/java/org/doorip/trip/dto/response/TripsGetResponse.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,23 @@ | ||
package org.doorip.trip.dto.response; | ||
|
||
import lombok.AccessLevel; | ||
import lombok.Builder; | ||
import org.doorip.trip.domain.Trip; | ||
|
||
import java.util.List; | ||
|
||
@Builder(access = AccessLevel.PRIVATE) | ||
public record TripsGetResponse( | ||
String name, | ||
List<TripResponse> trips | ||
) { | ||
public static TripsGetResponse of(String name, List<Trip> trips) { | ||
return TripsGetResponse.builder() | ||
.name(name) | ||
.trips(trips.stream() | ||
.map(TripResponse::of) | ||
.toList()) | ||
.build(); | ||
|
||
} | ||
} |
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