Skip to content

Commit

Permalink
[refactor] store Response Dto 불필요 필드 정리
Browse files Browse the repository at this point in the history
  • Loading branch information
BackInGone committed Jan 26, 2024
1 parent 7958cc2 commit 19b4e4a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 77 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,34 +6,14 @@

public record CityStoreResponseDto(
Long id,
String name,
String language,
String timeDifference,
String voltage,
String visa,
CurrencyUnit currency,
String weatherRecommendation,
String weatherDescription,
Country country,
Integer storeCount,
String imageUrl
Integer storeCount
) {

public static CityStoreResponseDto fromEntity(CityStore cityStore) {
City city = cityStore.getCity();
return new CityStoreResponseDto(
city.getId(),
city.getName(),
city.getLanguage(),
city.getTimeDifference(),
city.getVoltage(),
city.getVisa(),
city.getCurrency(),
city.getWeatherRecommendation(),
city.getWeatherDescription(),
city.getCountry(),
city.getStoreCount(),
city.getImageUrl()
city.getStoreCount()
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,43 +7,16 @@

public record PlaceStoreResponseDto(
Long id,
String name,
String address,
String description,

@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "HH-mm-ss")
LocalTime weekdayOpenTime,
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "HH-mm-ss")
LocalTime weekdayCloseTime,
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "HH-mm-ss")
LocalTime weekendOpenTime,
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "HH-mm-ss")
LocalTime weekendCloseTime,
Integer storedCount,
Double latitude,
Double longtitude,
Integer commentCount,
Long cityId,
String imageUrl
Long cityId
) {

public static PlaceStoreResponseDto fromEntity(PlaceStore placeStore, String imageUrl) {
Place place = placeStore.getPlace();
return new PlaceStoreResponseDto(
place.getId(),
place.getName(),
place.getAddress(),
place.getDescription(),
place.getWeekdayOpenTime(),
place.getWeekdayCloseTime(),
place.getWeekendOpenTime(),
place.getWeekendCloseTime(),
place.getStoredCount(),
place.getLatitude(),
place.getLongitude(),
place.getCommentCount(),
place.getCity().getId(),
imageUrl
place.getCity().getId()
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,38 +7,14 @@

public record TripRecordStoreResponseDto(
Long id,
String title,
String content,
String expenseRangeType,
String countries,
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd")
LocalDate tripStartDay,
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd")
LocalDate tripEndDay,
Integer totalDays,
Double averageRating,
Integer viewCount,
Integer storeCount,
Integer commentCount,
String imageUrl
Integer storeCount
) {

public static TripRecordStoreResponseDto fromEntity(TripRecordStore tripRecordStore, String imageUrl) {
TripRecord tripRecord = tripRecordStore.getTripRecord();
return new TripRecordStoreResponseDto(
tripRecord.getId(),
tripRecord.getTitle(),
tripRecord.getContent(),
tripRecord.getExpenseRangeType().name(), //todo
tripRecord.getCountries(),
tripRecord.getTripStartDay(),
tripRecord.getTripEndDay(),
tripRecord.getTotalDays(),
tripRecord.getAverageRating(),
tripRecord.getViewCount(),
tripRecord.getStoreCount(),
tripRecord.getCommentCount(),
imageUrl
tripRecord.getStoreCount()
);
}
}

0 comments on commit 19b4e4a

Please sign in to comment.