diff --git a/src/main/java/wowmarket/wow_server/mypage/myproject/MySalesProject/dto/AdditionalQuestionDto.java b/src/main/java/wowmarket/wow_server/mypage/myproject/MySalesProject/dto/AdditionalQuestionDto.java new file mode 100644 index 0000000..950aaf6 --- /dev/null +++ b/src/main/java/wowmarket/wow_server/mypage/myproject/MySalesProject/dto/AdditionalQuestionDto.java @@ -0,0 +1,15 @@ +package wowmarket.wow_server.mypage.myproject.MySalesProject.dto; + +import lombok.Getter; +import wowmarket.wow_server.domain.OrderQuestion; + +@Getter +public class AdditionalQuestionDto { + private String question; + private boolean essential; + + public AdditionalQuestionDto(OrderQuestion orderQuestion){ + this.question = orderQuestion.getQuestion(); + this.essential = orderQuestion.isEssential(); + } +} diff --git a/src/main/java/wowmarket/wow_server/mypage/myproject/MySalesProject/dto/MySalesDetailResponseDto.java b/src/main/java/wowmarket/wow_server/mypage/myproject/MySalesProject/dto/MySalesDetailResponseDto.java index 92503fe..b58df18 100644 --- a/src/main/java/wowmarket/wow_server/mypage/myproject/MySalesProject/dto/MySalesDetailResponseDto.java +++ b/src/main/java/wowmarket/wow_server/mypage/myproject/MySalesProject/dto/MySalesDetailResponseDto.java @@ -32,9 +32,10 @@ public class MySalesDetailResponseDto { private String sellerPhoneNumber; private String sellerEmail; private String sellerEtc; + private List orderQuestionList; - public MySalesDetailResponseDto(Project project, List itemDtos){ + public MySalesDetailResponseDto(Project project, List itemDtos, List orderQuestionList){ this.projectId = project.getId(); this.projectName = project.getProjectName(); this.description = project.getDescription(); @@ -56,5 +57,6 @@ public MySalesDetailResponseDto(Project project, List itemDtos){ this.sellerPhoneNumber = project.getPhoneNumber(); this.sellerEmail = project.getEmail(); this.sellerEtc = project.getSellerEtc(); + this.orderQuestionList = orderQuestionList; } } diff --git a/src/main/java/wowmarket/wow_server/mypage/myproject/MySalesProject/service/MySalesProjectService.java b/src/main/java/wowmarket/wow_server/mypage/myproject/MySalesProject/service/MySalesProjectService.java index d2b0156..893ceeb 100644 --- a/src/main/java/wowmarket/wow_server/mypage/myproject/MySalesProject/service/MySalesProjectService.java +++ b/src/main/java/wowmarket/wow_server/mypage/myproject/MySalesProject/service/MySalesProjectService.java @@ -9,10 +9,7 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.server.ResponseStatusException; -import wowmarket.wow_server.domain.Category; -import wowmarket.wow_server.domain.Item; -import wowmarket.wow_server.domain.Project; -import wowmarket.wow_server.domain.User; +import wowmarket.wow_server.domain.*; import wowmarket.wow_server.global.jwt.SecurityUtil; import wowmarket.wow_server.mypage.myproject.MySalesProject.dto.*; import wowmarket.wow_server.repository.*; @@ -26,6 +23,7 @@ public class MySalesProjectService { private final ProjectRepository projectRepository; private final ItemRepository itemRepository; private final CategoryRepository categoryRepository; + private final OrderQuestionRepository orderQuestionRepository; @Transactional(readOnly = true) public MySalesListResponseDto findAllMySalesForm(Pageable pageable, User user){ @@ -59,7 +57,10 @@ public MySalesDetailResponseDto findMySalesDetail(Long project_id, User user){ List itemList = itemRepository.findByProject_Id(project_id); List itemDtos = itemList.stream().map(MySalesItemDto::new).collect(Collectors.toList()); - MySalesDetailResponseDto responseDto = new MySalesDetailResponseDto(project, itemDtos); + List orderQuestionList = orderQuestionRepository.findByProject_Id(project_id).stream().toList(); + List additionalQuestionDtos = orderQuestionList.stream().map(AdditionalQuestionDto::new).collect(Collectors.toList()); + + MySalesDetailResponseDto responseDto = new MySalesDetailResponseDto(project, itemDtos, additionalQuestionDtos); return responseDto; }