Skip to content

Commit

Permalink
Merge pull request #38 from Central-MakeUs/16-좋아요-관련-기능을-추가한다
Browse files Browse the repository at this point in the history
Fix(#14): AOS 필터 보정값 조회 응답 수정
  • Loading branch information
tmddus2 authored Aug 10, 2024
2 parents fe4d758 + 4cb9d3c commit 8a078ed
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public SuccessResponse<FilterDetailDto> getFilterDetail(Long id, Long filterId)

@GetMapping("/{filterId}/AOS")
public SuccessResponse<AOSFilterDetailDto> getAOSFilter(Long id, Long filterId) {
return SuccessResponse.of(filterService.getFilterAOSDetail(filterId));
return SuccessResponse.of(filterService.getFilterAOSDetail(filterId, id));
}

@GetMapping("/{filterId}/iOS")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.example.purithm.domain.filter.dto.response.filterDetailValue;

import com.example.purithm.domain.filter.entity.AOSFilterDetail;
import com.example.purithm.domain.filter.entity.Filter;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Builder;
Expand All @@ -9,42 +10,72 @@
@Getter
@Builder
public class AOSFilterDetailDto {
@Schema(description = "라이트 밸런스")
private int lightBalance;
@Schema(description = "밝기")
private int brightness;
@Schema(description = "노출")
private int exposure;
@Schema(description = "대비")
private int contrast;
@Schema(description = "하이라이트")
private int highlight;
@Schema(description = "그림자")
private int shadow;
@Schema(description = "채도")
private int saturation;
@Schema(description = "틴트")
private int tint;
@Schema(description = "색온드")
private int temperature;
@Schema(description = "선명도")
private int clear;
@Schema(description = "명료도")
private int clarity;

public static AOSFilterDetailDto of(AOSFilterDetail 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 AOSFilterDetailDto of(Filter filter, boolean liked, AOSFilterDetail filterDetail) {
return AOSFilterDetailDto.builder()
.lightBalance(filterDetail.getLightBalance())
.brightness(filterDetail.getBrightness())
.exposure(filterDetail.getExposure())
.contrast(filterDetail.getContrast())
.highlight(filterDetail.getHighlight())
.shadow(filterDetail.getShadow())
.saturation(filterDetail.getSaturation())
.tint(filterDetail.getTint())
.temperature(filterDetail.getTemperature())
.clear(filterDetail.getClear())
.clarity(filterDetail.getClarity())
.build();
.id(filter.getId())
.thumbnail(filter.getThumbnail())
.liked(liked)
.name(filter.getName())
.value(FilterValue.of(filterDetail)).build();
}
}

@Getter
@Builder
public static class FilterValue {
@Schema(description = "라이트 밸런스")
private int lightBalance;
@Schema(description = "밝기")
private int brightness;
@Schema(description = "노출")
private int exposure;
@Schema(description = "대비")
private int contrast;
@Schema(description = "하이라이트")
private int highlight;
@Schema(description = "그림자")
private int shadow;
@Schema(description = "채도")
private int saturation;
@Schema(description = "틴트")
private int tint;
@Schema(description = "색온도")
private int temperature;
@Schema(description = "선명도")
private int clear;
@Schema(description = "명료도")
private int clarity;

public static FilterValue of(AOSFilterDetail filterDetail) {
return FilterValue.builder()
.lightBalance(filterDetail.getLightBalance())
.brightness(filterDetail.getBrightness())
.exposure(filterDetail.getExposure())
.contrast(filterDetail.getContrast())
.highlight(filterDetail.getHighlight())
.shadow(filterDetail.getShadow())
.saturation(filterDetail.getSaturation())
.tint(filterDetail.getTint())
.temperature(filterDetail.getTemperature())
.clear(filterDetail.getClear())
.clarity(filterDetail.getClarity())
.build();
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,13 @@ public FilterDetailDto getFilterDetail(Long id, Long filterId) {
.build();
}

public AOSFilterDetailDto getFilterAOSDetail(Long filterId) {
public AOSFilterDetailDto getFilterAOSDetail(Long filterId, Long userId) {
Filter filter = filterRepository.findById(filterId)
.orElseThrow(() -> CustomException.of(Error.NOT_FOUND_ERROR));
AOSFilterDetail aosFilterDetail = aOSFilterDetailRepository.findById(filterId)
.orElseThrow(() -> CustomException.of(Error.NOT_FOUND_ERROR));
return AOSFilterDetailDto.of(aosFilterDetail);

return AOSFilterDetailDto.of(filter, isLike(filterId, userId), aosFilterDetail);
}

public IOSFilterDetailDto getFilterIOSDetail(Long filterId) {
Expand Down

0 comments on commit 8a078ed

Please sign in to comment.