-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* ✨ Controller 작성 * 🎨 응답 dto 추가 * 🎨 서비스 인터페이스 작성 * 🎨 서비스 로직 오버라이드 * 🎨 응답 구조 변경 * ✨ Pageable 매개변수 추가 * 🎨 응답 구조 변경 * 🚧 응답 확인 * 🎨 작업 가능 필드 응답 변경 * ✨ 최소 비용 응답에 포함 * ✨ 가격 조건 추가 * 🎨 응답 dto에 포트폴리오 썸네일 이미지 경로 추가 * ✨ 가격순 정렬 추가 * ✨ 카테고리 정렬 기능 추가 * 📝 Swagger 문서 업데이트 (응답) * 📝 가능한 작업 카테고리 예시 추가 * 📝 Swagger 문서 업데이트(Parameter) * 🎨 작업가능 필드 응답 한글로 변경
- Loading branch information
1 parent
733fa74
commit 7bd2235
Showing
8 changed files
with
239 additions
and
10 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
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
52 changes: 52 additions & 0 deletions
52
src/main/java/org/example/gather_back_end/creator/dto/filtering/CreatorInfo.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,52 @@ | ||
package org.example.gather_back_end.creator.dto.filtering; | ||
|
||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import java.util.Comparator; | ||
import java.util.List; | ||
import java.util.stream.Collectors; | ||
import org.example.gather_back_end.domain.Portfolio; | ||
import org.example.gather_back_end.domain.User; | ||
import org.example.gather_back_end.domain.Work; | ||
import org.example.gather_back_end.util.format.WorkTypeConverter; | ||
|
||
public record CreatorInfo( | ||
@Schema(description = "크리에이터명", example = "hello") | ||
String nickname, | ||
|
||
@Schema(description = "가능한 작업 카테고리", example = "[\"SNS\", \"인쇄물\", \"비디오\"]") | ||
List<String> availableWork, | ||
|
||
@Schema(description = "크리에이터 소개글 제목", example = "안녕하세요") | ||
String introductionTitle, | ||
|
||
@Schema(description = "작업 시작 가격", example = "5000") | ||
String startPrice, | ||
|
||
@Schema(description = "포트폴리오 썸네일 주소", example = "dfdfd") | ||
String thumbnailImgUrl | ||
) { | ||
|
||
public static CreatorInfo from(User user, List<String> availableWork, List<Portfolio> portfolioList) { | ||
|
||
// workList에서 startPrice 중 가장 작은 값 찾기 | ||
String minStartPrice = user.getWorkList().stream() | ||
.map(Work::getStartPrice) | ||
.min(Comparator.naturalOrder()) | ||
.map(String::valueOf) // int를 String으로 변환 | ||
.orElse("N/A"); // workList가 비어 있을 경우 기본값 | ||
|
||
// availableWork를 한글명으로 변환 | ||
List<String> translatedAvailableWork = user.getWorkList().stream() | ||
.map(work -> WorkTypeConverter.toKorean(work.getCategory())) | ||
.distinct() | ||
.collect(Collectors.toList()); | ||
|
||
return new CreatorInfo( | ||
user.getNickname(), | ||
translatedAvailableWork, | ||
user.getIntroductionTitle(), | ||
minStartPrice, | ||
portfolioList.getFirst().getThumbnailImgUrl() | ||
); | ||
} | ||
} |
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
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
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
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
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