diff --git a/src/main/java/com/gongjakso/server/domain/portfolio/dto/request/PortfolioReq.java b/src/main/java/com/gongjakso/server/domain/portfolio/dto/request/PortfolioReq.java index 0248b7e4..3043f9bb 100644 --- a/src/main/java/com/gongjakso/server/domain/portfolio/dto/request/PortfolioReq.java +++ b/src/main/java/com/gongjakso/server/domain/portfolio/dto/request/PortfolioReq.java @@ -1,11 +1,16 @@ package com.gongjakso.server.domain.portfolio.dto.request; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.annotation.Nullable; +import jakarta.validation.constraints.Size; import java.time.LocalDate; import java.util.List; import lombok.Builder; @Builder public record PortfolioReq ( + @Nullable + String portfolioName, List educationList, List workList, List activityList, @@ -35,18 +40,21 @@ public record Activty ( Boolean isActive ) { } + public record Award ( String contestName, String awardName, LocalDate awardDate ) { } + public record Certificate ( String name, String rating, LocalDate certificationDate ) { } + public record Sns ( String snsLink ) { 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 8771a902..a28ea0fb 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 @@ -10,6 +10,7 @@ @JsonInclude(JsonInclude.Include.NON_NULL) public record PortfolioRes ( Long id, + String portfolioName, List educationList, List workList, List activityList, @@ -21,6 +22,7 @@ public static PortfolioRes from(Portfolio portfolio) { PortfolioData portfolioData = portfolio.getPortfolioData(); return new PortfolioRes( portfolio.getId(), + portfolioData.portfolioName(), portfolioData.educationList(), portfolioData.workList(), portfolioData.activityList(), diff --git a/src/main/java/com/gongjakso/server/domain/portfolio/repository/PortfolioRepository.java b/src/main/java/com/gongjakso/server/domain/portfolio/repository/PortfolioRepository.java index d61eea7f..d4bc90fc 100644 --- a/src/main/java/com/gongjakso/server/domain/portfolio/repository/PortfolioRepository.java +++ b/src/main/java/com/gongjakso/server/domain/portfolio/repository/PortfolioRepository.java @@ -6,4 +6,6 @@ public interface PortfolioRepository extends JpaRepository { Optional findByIdAndDeletedAtIsNull(Long portfolioId); + + long countByDeletedAtIsNull(); } diff --git a/src/main/java/com/gongjakso/server/domain/portfolio/service/PortfolioService.java b/src/main/java/com/gongjakso/server/domain/portfolio/service/PortfolioService.java index 6c8c2f3f..f2e64faf 100644 --- a/src/main/java/com/gongjakso/server/domain/portfolio/service/PortfolioService.java +++ b/src/main/java/com/gongjakso/server/domain/portfolio/service/PortfolioService.java @@ -22,6 +22,12 @@ public class PortfolioService { // PortfolioReq -> PortfolioData 변환 private PortfolioData convertToPortfolioData(PortfolioReq portfolioReq) { + String portfolioName = portfolioReq.portfolioName(); + if (portfolioName == null || portfolioName.isEmpty()) { + long existingPortfolioCount = portfolioRepository.countByDeletedAtIsNull(); + portfolioName = "포트폴리오 " + (existingPortfolioCount + 1); + } + List educationList = portfolioReq.educationList() != null ? portfolioReq.educationList().stream() .map(education -> new PortfolioData.Education( @@ -82,7 +88,7 @@ private PortfolioData convertToPortfolioData(PortfolioReq portfolioReq) { .toList() : List.of(); - return new PortfolioData(educationList, workList, activityList, awardList, certificateList, snsList); + return new PortfolioData(portfolioName, educationList, workList, activityList, awardList, certificateList, snsList); } @Transactional diff --git a/src/main/java/com/gongjakso/server/domain/portfolio/vo/PortfolioData.java b/src/main/java/com/gongjakso/server/domain/portfolio/vo/PortfolioData.java index 28f80f00..a67c8420 100644 --- a/src/main/java/com/gongjakso/server/domain/portfolio/vo/PortfolioData.java +++ b/src/main/java/com/gongjakso/server/domain/portfolio/vo/PortfolioData.java @@ -4,6 +4,7 @@ import java.util.List; public record PortfolioData ( + String portfolioName, List educationList, List workList, List activityList, @@ -17,6 +18,7 @@ public record Education ( Boolean isActive ) { } + public record Work ( String company, String partition, @@ -26,23 +28,27 @@ public record Work ( String detail ) { } + public record Activity ( String name, Boolean isActive ) { } + public record Award ( String contestName, String awardName, LocalDate awardDate ) { } + public record Certificate ( String name, String rating, LocalDate certificationDate ) { } + public record Sns ( String snsLink ) {