Skip to content

Commit

Permalink
[feat] 판매 등록폼 상세보기 추가 질문 #160
Browse files Browse the repository at this point in the history
  • Loading branch information
yunji118 committed Jan 11, 2024
1 parent 1799594 commit 951e067
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -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();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,10 @@ public class MySalesDetailResponseDto {
private String sellerPhoneNumber;
private String sellerEmail;
private String sellerEtc;
private List<AdditionalQuestionDto> orderQuestionList;


public MySalesDetailResponseDto(Project project, List<MySalesItemDto> itemDtos){
public MySalesDetailResponseDto(Project project, List<MySalesItemDto> itemDtos, List<AdditionalQuestionDto> orderQuestionList){
this.projectId = project.getId();
this.projectName = project.getProjectName();
this.description = project.getDescription();
Expand All @@ -56,5 +57,6 @@ public MySalesDetailResponseDto(Project project, List<MySalesItemDto> itemDtos){
this.sellerPhoneNumber = project.getPhoneNumber();
this.sellerEmail = project.getEmail();
this.sellerEtc = project.getSellerEtc();
this.orderQuestionList = orderQuestionList;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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.*;
Expand All @@ -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){
Expand Down Expand Up @@ -59,7 +57,10 @@ public MySalesDetailResponseDto findMySalesDetail(Long project_id, User user){
List<Item> itemList = itemRepository.findByProject_Id(project_id);
List<MySalesItemDto> itemDtos = itemList.stream().map(MySalesItemDto::new).collect(Collectors.toList());

MySalesDetailResponseDto responseDto = new MySalesDetailResponseDto(project, itemDtos);
List<OrderQuestion> orderQuestionList = orderQuestionRepository.findByProject_Id(project_id).stream().toList();
List<AdditionalQuestionDto> additionalQuestionDtos = orderQuestionList.stream().map(AdditionalQuestionDto::new).collect(Collectors.toList());

MySalesDetailResponseDto responseDto = new MySalesDetailResponseDto(project, itemDtos, additionalQuestionDtos);
return responseDto;
}

Expand Down

0 comments on commit 951e067

Please sign in to comment.