diff --git a/purithm/src/main/java/com/example/purithm/domain/filter/controller/FilterController.java b/purithm/src/main/java/com/example/purithm/domain/filter/controller/FilterController.java index bb21113..2544c4c 100644 --- a/purithm/src/main/java/com/example/purithm/domain/filter/controller/FilterController.java +++ b/purithm/src/main/java/com/example/purithm/domain/filter/controller/FilterController.java @@ -43,7 +43,7 @@ public SuccessResponse getAOSFilter(Long id, Long filterId) @GetMapping("/{filterId}/iOS") public SuccessResponse getIOSFilter(Long id, Long filterId) { - return SuccessResponse.of(filterService.getFilterIOSDetail(filterId)); + return SuccessResponse.of(filterService.getFilterIOSDetail(filterId, id)); } @GetMapping("/{filterId}/reviews") diff --git a/purithm/src/main/java/com/example/purithm/domain/filter/dto/response/filterDetailValue/IOSFilterDetailDto.java b/purithm/src/main/java/com/example/purithm/domain/filter/dto/response/filterDetailValue/IOSFilterDetailDto.java index d79cc96..ccd4342 100644 --- a/purithm/src/main/java/com/example/purithm/domain/filter/dto/response/filterDetailValue/IOSFilterDetailDto.java +++ b/purithm/src/main/java/com/example/purithm/domain/filter/dto/response/filterDetailValue/IOSFilterDetailDto.java @@ -1,5 +1,6 @@ package com.example.purithm.domain.filter.dto.response.filterDetailValue; +import com.example.purithm.domain.filter.entity.Filter; import com.example.purithm.domain.filter.entity.IOSFilterDetail; import io.swagger.v3.oas.annotations.media.Schema; @@ -9,54 +10,83 @@ @Getter @Builder public class IOSFilterDetailDto { - @Schema(description = "노출") - private int exposure; - @Schema(description = "휘도") - private int luminance; - @Schema(description = "하이라이트") - private int highlight; - @Schema(description = "그림자") - private int shadow; - @Schema(description = "대비") - private int contrast; - @Schema(description = "밝기") - private int brightness; - @Schema(description = "블랙포인트") - private int blackPoint; - @Schema(description = "채도") - private int saturation; - @Schema(description = "색 선명도") - private int colorfulness; - @Schema(description = "따뜻함") - private int warmth; - @Schema(description = "색조") - private int hue; - @Schema(description = "선명도") - private int clear; - @Schema(description = "명료도") - private int clarity; - @Schema(description = "노이즈 감소") - private int noise; - @Schema(description = "비네트") - private int vignette; - - public static IOSFilterDetailDto of(IOSFilterDetail filterDetail) { + + @Schema(description = "id") + private Long id; + + @Schema(description = "filter 썸네일") + private String thumbnail; + + @Schema(description = "filter 좋아요 여부") + private boolean liked; + + @Schema(description = "filter 이름") + private String name; + + @Schema(description = "filter 보정 상세 값") + private FilterValue value; + + public static IOSFilterDetailDto of(Filter filter, boolean liked, IOSFilterDetail filterDetail) { return IOSFilterDetailDto.builder() - .exposure(filterDetail.getExposure()) - .luminance(filterDetail.getLuminance()) - .highlight(filterDetail.getHighlight()) - .shadow(filterDetail.getShadow()) - .contrast(filterDetail.getContrast()) - .brightness(filterDetail.getBrightness()) - .blackPoint(filterDetail.getBlackPoint()) - .saturation(filterDetail.getSaturation()) - .colorfulness(filterDetail.getColorfulness()) - .warmth(filterDetail.getWarmth()) - .hue(filterDetail.getHue()) - .clear(filterDetail.getClear()) - .clarity(filterDetail.getClarity()) - .noise(filterDetail.getNoise()) - .vignette(filterDetail.getVignette()) - .build(); + .id(filter.getId()) + .thumbnail(filter.getThumbnail()) + .liked(liked) + .name(filter.getName()) + .value(IOSFilterDetailDto.FilterValue.of(filterDetail)).build(); + } + + @Getter + @Builder + public static class FilterValue { + @Schema(description = "노출") + private int exposure; + @Schema(description = "휘도") + private int luminance; + @Schema(description = "하이라이트") + private int highlight; + @Schema(description = "그림자") + private int shadow; + @Schema(description = "대비") + private int contrast; + @Schema(description = "밝기") + private int brightness; + @Schema(description = "블랙포인트") + private int blackPoint; + @Schema(description = "채도") + private int saturation; + @Schema(description = "색 선명도") + private int colorfulness; + @Schema(description = "따뜻함") + private int warmth; + @Schema(description = "색조") + private int hue; + @Schema(description = "선명도") + private int clear; + @Schema(description = "명료도") + private int clarity; + @Schema(description = "노이즈 감소") + private int noise; + @Schema(description = "비네트") + private int vignette; + + public static FilterValue of(IOSFilterDetail filterDetail) { + return FilterValue.builder() + .exposure(filterDetail.getExposure()) + .luminance(filterDetail.getLuminance()) + .highlight(filterDetail.getHighlight()) + .shadow(filterDetail.getShadow()) + .contrast(filterDetail.getContrast()) + .brightness(filterDetail.getBrightness()) + .blackPoint(filterDetail.getBlackPoint()) + .saturation(filterDetail.getSaturation()) + .colorfulness(filterDetail.getColorfulness()) + .warmth(filterDetail.getWarmth()) + .hue(filterDetail.getHue()) + .clear(filterDetail.getClear()) + .clarity(filterDetail.getClarity()) + .noise(filterDetail.getNoise()) + .vignette(filterDetail.getVignette()) + .build(); + } } } diff --git a/purithm/src/main/java/com/example/purithm/domain/filter/service/FilterService.java b/purithm/src/main/java/com/example/purithm/domain/filter/service/FilterService.java index 949226f..fd0d9b7 100644 --- a/purithm/src/main/java/com/example/purithm/domain/filter/service/FilterService.java +++ b/purithm/src/main/java/com/example/purithm/domain/filter/service/FilterService.java @@ -130,10 +130,13 @@ public AOSFilterDetailDto getFilterAOSDetail(Long filterId, Long userId) { return AOSFilterDetailDto.of(filter, isLike(filterId, userId), aosFilterDetail); } - public IOSFilterDetailDto getFilterIOSDetail(Long filterId) { + public IOSFilterDetailDto getFilterIOSDetail(Long filterId, Long userId) { + Filter filter = filterRepository.findById(filterId) + .orElseThrow(() -> CustomException.of(Error.NOT_FOUND_ERROR)); IOSFilterDetail iosFilterDetail = iOSFilterDetailRepository.findById(filterId) .orElseThrow(() -> CustomException.of(Error.NOT_FOUND_ERROR)); - return IOSFilterDetailDto.of(iosFilterDetail); + + return IOSFilterDetailDto.of(filter, isLike(filterId, userId), iosFilterDetail); } public void likeFilter(Long userId, Long filterId) {