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 27, 2024
1 parent 14e37d0 commit d851954
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,18 @@

public record CityStoreResponseDto(
Long id,
Integer storeCount
String name,
Integer storeCount,
String imageUrl
) {

public static CityStoreResponseDto fromEntity(CityStore cityStore) {
City city = cityStore.getCity();
return new CityStoreResponseDto(
city.getId(),
city.getStoreCount()
city.getName(),
city.getStoreCount(),
city.getImageUrl()
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,25 @@
import com.fasterxml.jackson.annotation.JsonFormat;
import com.haejwo.tripcometrue.domain.place.entity.Place;
import com.haejwo.tripcometrue.domain.store.entity.PlaceStore;
import jakarta.persistence.criteria.CriteriaBuilder.In;
import java.time.LocalTime;

public record PlaceStoreResponseDto(
Long id,
String name,
Integer commentCount,
Integer storedCount,
Long cityId
String imageUrl
) {

public static PlaceStoreResponseDto fromEntity(PlaceStore placeStore, String imageUrl) {
Place place = placeStore.getPlace();
return new PlaceStoreResponseDto(
place.getId(),
place.getName(),
place.getCommentCount(),
place.getStoredCount(),
place.getCity().getId()
imageUrl
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,18 @@

public record TripRecordStoreResponseDto(
Long id,
Integer storeCount
String title,
Integer storeCount,
String imageUrl
) {

public static TripRecordStoreResponseDto fromEntity(TripRecordStore tripRecordStore, String imageUrl) {
TripRecord tripRecord = tripRecordStore.getTripRecord();
return new TripRecordStoreResponseDto(
tripRecord.getId(),
tripRecord.getStoreCount()
tripRecord.getTitle(),
tripRecord.getStoreCount(),
imageUrl
);
}
}

0 comments on commit d851954

Please sign in to comment.