From 0eddb5c0d2adc2c3340701d46fb55df51997ff41 Mon Sep 17 00:00:00 2001 From: yumzen Date: Tue, 1 Oct 2024 13:00:54 +0900 Subject: [PATCH] =?UTF-8?q?#249=20fix:=20=EC=A7=80=EC=9B=90=20=EC=8B=9C=20?= =?UTF-8?q?=ED=8F=AC=ED=8A=B8=ED=8F=B4=EB=A6=AC=EC=98=A4=20=EA=B4=80?= =?UTF-8?q?=EB=A6=AC=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/apply/dto/request/ApplyReq.java | 6 +++++- .../domain/apply/dto/response/ApplyRes.java | 4 ++++ .../apply/dto/response/SimpleApplyRes.java | 2 ++ .../domain/apply/entity/PortfolioInfo.java | 5 ++++- .../portfolio/dto/response/PortfolioRes.java | 18 ++++++++++++++++-- .../dto/response/SimplePortfolioRes.java | 18 ++++++++++++++++-- 6 files changed, 47 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/gongjakso/server/domain/apply/dto/request/ApplyReq.java b/src/main/java/com/gongjakso/server/domain/apply/dto/request/ApplyReq.java index 8cfbe996..91e9d775 100644 --- a/src/main/java/com/gongjakso/server/domain/apply/dto/request/ApplyReq.java +++ b/src/main/java/com/gongjakso/server/domain/apply/dto/request/ApplyReq.java @@ -25,6 +25,10 @@ public record ApplyReq( @Schema(description = "포트폴리오 공개 설정", example = "false", defaultValue = "false") Boolean isPrivate, + @Nullable + @Schema(description = "포트폴리오 타입", example = "NOTION | FILE") + String dataType, + @Size(max = 1000) @Schema(description = "지원 이유", example = "저는 데이터 사이언스 과목을 수강하며 데이터에 관한 기본적인 내용들을 배우며 이런 데이터를 잘 활용하고, 이용하는 것이 중요한 역량이 될 것 같다고 판단했습니다. 그래서 관련된 역량을 쌓고자 공모전에 출품하고 싶다는 생각을 가지게 되었고, 공공데이터 공모전이 적합하다고 생각했습니다!") String body, @@ -40,7 +44,7 @@ public record ApplyReq( String part ) { public static Apply toEntity(ApplyReq req, Team team, Member member, @Nullable Portfolio portfolio) { - PortfolioInfo portfolioInfo = PortfolioInfo.ofPortfolio(portfolio, req.isPrivate()); + PortfolioInfo portfolioInfo = PortfolioInfo.ofPortfolio(portfolio, req.isPrivate(), req.dataType()); return Apply.builder() .team(team) diff --git a/src/main/java/com/gongjakso/server/domain/apply/dto/response/ApplyRes.java b/src/main/java/com/gongjakso/server/domain/apply/dto/response/ApplyRes.java index c9023924..5438527e 100644 --- a/src/main/java/com/gongjakso/server/domain/apply/dto/response/ApplyRes.java +++ b/src/main/java/com/gongjakso/server/domain/apply/dto/response/ApplyRes.java @@ -46,6 +46,9 @@ public record ApplyRes( @Nullable String portfolioName, + @Nullable + String dataType, + Boolean isPrivate, @Size(max = 1000) @@ -119,6 +122,7 @@ public static ApplyRes of(Apply apply) { .leaderName(apply.getTeam().getMember().getName()) .portfolioId(apply.getPortfolioInfo().isPrivate() ? null : apply.getPortfolioInfo().getPortfolio().getId()) .portfolioName(apply.getPortfolioInfo().isPrivate() ? null : apply.getPortfolioInfo().getPortfolio().getPortfolioName()) + .dataType(apply.getPortfolioInfo().isPrivate() ? null : apply.getPortfolioInfo().getDataType()) .isPrivate(apply.getPortfolioInfo().isPrivate()) .body(apply.getBody()) .status(apply.getStatus().getDescription()) diff --git a/src/main/java/com/gongjakso/server/domain/apply/dto/response/SimpleApplyRes.java b/src/main/java/com/gongjakso/server/domain/apply/dto/response/SimpleApplyRes.java index b42cdc9f..3436251b 100644 --- a/src/main/java/com/gongjakso/server/domain/apply/dto/response/SimpleApplyRes.java +++ b/src/main/java/com/gongjakso/server/domain/apply/dto/response/SimpleApplyRes.java @@ -22,6 +22,7 @@ public record SimpleApplyRes( String applicantName, Long portfolioId, String portfolioName, + String dataType, String status, String applyPart, Boolean isViewed @@ -34,6 +35,7 @@ public static SimpleApplyRes of(Apply apply){ .applicantName(apply.getMember().getName()) .portfolioId(apply.getPortfolioInfo().getPortfolio() != null ? apply.getPortfolioInfo().getPortfolio().getId() : null) .portfolioName(apply.getPortfolioInfo().getPortfolio() != null ? apply.getPortfolioInfo().getPortfolio().getPortfolioName() : null) + .dataType(apply.getPortfolioInfo().getDataType()) .status(apply.getStatus().name()) .applyPart(apply.getPart()) .isViewed(apply.isViewed()) diff --git a/src/main/java/com/gongjakso/server/domain/apply/entity/PortfolioInfo.java b/src/main/java/com/gongjakso/server/domain/apply/entity/PortfolioInfo.java index c396f75a..6db0d8b6 100644 --- a/src/main/java/com/gongjakso/server/domain/apply/entity/PortfolioInfo.java +++ b/src/main/java/com/gongjakso/server/domain/apply/entity/PortfolioInfo.java @@ -20,10 +20,13 @@ public class PortfolioInfo { private boolean isPrivate; - public static PortfolioInfo ofPortfolio(Portfolio portfolio, boolean isPrivate) { + private String dataType; + + public static PortfolioInfo ofPortfolio(Portfolio portfolio, boolean isPrivate, String dataType) { return PortfolioInfo.builder() .portfolio(portfolio) .isPrivate(isPrivate) + .dataType(dataType) .build(); } } diff --git a/src/main/java/com/gongjakso/server/domain/portfolio/dto/response/PortfolioRes.java b/src/main/java/com/gongjakso/server/domain/portfolio/dto/response/PortfolioRes.java index a809f0db..a2918163 100644 --- a/src/main/java/com/gongjakso/server/domain/portfolio/dto/response/PortfolioRes.java +++ b/src/main/java/com/gongjakso/server/domain/portfolio/dto/response/PortfolioRes.java @@ -5,6 +5,7 @@ import com.gongjakso.server.domain.portfolio.vo.PortfolioData; import lombok.Builder; import java.util.List; +import java.util.Objects; @Builder @JsonInclude(JsonInclude.Include.NON_NULL) @@ -17,11 +18,23 @@ public record PortfolioRes ( List awardList, List certificateList, List snsList, + String dataType, String fileUri, String notionUri ) { public static PortfolioRes from(Portfolio portfolio) { PortfolioData portfolioData = portfolio.getPortfolioData(); + String dataType; + if (portfolio.getFileUri() != null && portfolio.getNotionUri() != null) { + dataType = "HYBRID"; + } else if (portfolio.getFileUri() != null) { + dataType = "FILE"; + } else if (portfolio.getNotionUri() != null) { + dataType = "NOTION"; + } else { + dataType = null; + } + return new PortfolioRes( portfolio.getId(), portfolio.getPortfolioName(), @@ -31,8 +44,9 @@ public static PortfolioRes from(Portfolio portfolio) { portfolioData != null ? portfolioData.awardList() : null, portfolioData != null ? portfolioData.certificateList(): null, portfolioData != null ? portfolioData.snsList(): null, - portfolio.getFileUri(), - portfolio.getNotionUri() + dataType, + Objects.equals(dataType, "NOTION") ? null : portfolio.getFileUri(), + Objects.equals(dataType, "FILE") ? null : portfolio.getNotionUri() ); } } \ No newline at end of file diff --git a/src/main/java/com/gongjakso/server/domain/portfolio/dto/response/SimplePortfolioRes.java b/src/main/java/com/gongjakso/server/domain/portfolio/dto/response/SimplePortfolioRes.java index b7e2cfd3..ee7447e5 100644 --- a/src/main/java/com/gongjakso/server/domain/portfolio/dto/response/SimplePortfolioRes.java +++ b/src/main/java/com/gongjakso/server/domain/portfolio/dto/response/SimplePortfolioRes.java @@ -11,15 +11,29 @@ public record SimplePortfolioRes( String PortfolioName, LocalDateTime modifiedAt, Boolean isRegistered, - Boolean isExistedPortfolio + Boolean isExistedPortfolio, + String dataType ) { public static SimplePortfolioRes of(Portfolio portfolio, Boolean isRegistered, Boolean isExistedPortfolio) { + + String dataType; + if (portfolio.getFileUri() != null && portfolio.getNotionUri() != null) { + dataType = "HYBRID"; + } else if (portfolio.getFileUri() != null) { + dataType = "FILE"; + } else if (portfolio.getNotionUri() != null) { + dataType = "NOTION"; + } else { + dataType = null; + } + return new SimplePortfolioRes( isRegistered ? portfolio.getId() : null, isRegistered ? portfolio.getPortfolioName() : null, isRegistered ? portfolio.getModifiedAt() : null, isRegistered, - isExistedPortfolio + isExistedPortfolio, + isExistedPortfolio ? dataType : null ); } }