diff --git a/jaknaeso-core/src/main/java/org/nexters/jaknaesocore/domain/survey/dto/SurveySubmissionCommand.java b/jaknaeso-core/src/main/java/org/nexters/jaknaesocore/domain/survey/dto/SurveySubmissionCommand.java new file mode 100644 index 00000000..a887c004 --- /dev/null +++ b/jaknaeso-core/src/main/java/org/nexters/jaknaesocore/domain/survey/dto/SurveySubmissionCommand.java @@ -0,0 +1,3 @@ +package org.nexters.jaknaesocore.domain.survey.dto; + +public record SurveySubmissionCommand(Long optionId, String comment) {} diff --git a/jaknaeso-core/src/main/java/org/nexters/jaknaesocore/domain/survey/dto/SurveySubmissionServiceRequest.java b/jaknaeso-core/src/main/java/org/nexters/jaknaesocore/domain/survey/dto/SurveySubmissionServiceRequest.java deleted file mode 100644 index df1c31b0..00000000 --- a/jaknaeso-core/src/main/java/org/nexters/jaknaesocore/domain/survey/dto/SurveySubmissionServiceRequest.java +++ /dev/null @@ -1,3 +0,0 @@ -package org.nexters.jaknaesocore.domain.survey.dto; - -public record SurveySubmissionServiceRequest(Long optionId, String comment) {} diff --git a/jaknaeso-core/src/main/java/org/nexters/jaknaesocore/domain/survey/service/SurveyService.java b/jaknaeso-core/src/main/java/org/nexters/jaknaesocore/domain/survey/service/SurveyService.java index 57bd3a61..34700f0b 100644 --- a/jaknaeso-core/src/main/java/org/nexters/jaknaesocore/domain/survey/service/SurveyService.java +++ b/jaknaeso-core/src/main/java/org/nexters/jaknaesocore/domain/survey/service/SurveyService.java @@ -8,7 +8,7 @@ import org.nexters.jaknaesocore.domain.survey.dto.SurveyHistoryDetailResponse; import org.nexters.jaknaesocore.domain.survey.dto.SurveyHistoryResponse; import org.nexters.jaknaesocore.domain.survey.dto.SurveyResponse; -import org.nexters.jaknaesocore.domain.survey.dto.SurveySubmissionServiceRequest; +import org.nexters.jaknaesocore.domain.survey.dto.SurveySubmissionCommand; import org.nexters.jaknaesocore.domain.survey.model.*; import org.nexters.jaknaesocore.domain.survey.repository.SurveyBundleRepository; import org.nexters.jaknaesocore.domain.survey.repository.SurveyRepository; @@ -94,7 +94,7 @@ private SurveyHistoryResponse createCurrentBundleSurveyHistory( } @Transactional - public void submitSurvey(Long surveyId, Long memberId, SurveySubmissionServiceRequest request) { + public void submitSurvey(Long surveyId, Long memberId, SurveySubmissionCommand request) { Survey survey = surveyRepository.findById(surveyId).orElseThrow(() -> CustomException.SURVEY_NOT_FOUND); SurveyOption surveyOption = survey.getOptionById(request.optionId()); diff --git a/jaknaeso-core/src/test/java/org/nexters/jaknaesocore/domain/survey/service/SurveyServiceTest.java b/jaknaeso-core/src/test/java/org/nexters/jaknaesocore/domain/survey/service/SurveyServiceTest.java index a24c7678..dacb7d27 100644 --- a/jaknaeso-core/src/test/java/org/nexters/jaknaesocore/domain/survey/service/SurveyServiceTest.java +++ b/jaknaeso-core/src/test/java/org/nexters/jaknaesocore/domain/survey/service/SurveyServiceTest.java @@ -14,7 +14,7 @@ import org.nexters.jaknaesocore.domain.member.repository.MemberRepository; import org.nexters.jaknaesocore.domain.survey.dto.SurveyHistoryResponse; import org.nexters.jaknaesocore.domain.survey.dto.SurveyResponse; -import org.nexters.jaknaesocore.domain.survey.dto.SurveySubmissionServiceRequest; +import org.nexters.jaknaesocore.domain.survey.dto.SurveySubmissionCommand; import org.nexters.jaknaesocore.domain.survey.model.*; import org.nexters.jaknaesocore.domain.survey.model.BalanceSurvey; import org.nexters.jaknaesocore.domain.survey.model.Keyword; @@ -100,8 +100,8 @@ void throwMemberNotFoundException() { SurveyOption.builder().survey(balanceSurvey).scores(scores).content("질문 옵션 내용").build(); surveyOptionRepository.save(option); - SurveySubmissionServiceRequest request = - new SurveySubmissionServiceRequest(option.getId(), "나는 행복한게 좋으니까"); + SurveySubmissionCommand request = + new SurveySubmissionCommand(option.getId(), "나는 행복한게 좋으니까"); // when // then @@ -130,8 +130,8 @@ class shouldSubmitted { SurveyOption.builder().survey(balanceSurvey).scores(scores).content("질문 옵션 내용").build(); surveyOptionRepository.save(option); - SurveySubmissionServiceRequest request = - new SurveySubmissionServiceRequest(option.getId(), "나는 행복한게 좋으니까"); + SurveySubmissionCommand request = + new SurveySubmissionCommand(option.getId(), "나는 행복한게 좋으니까"); // when surveyService.submitSurvey(balanceSurvey.getId(), member.getId(), request); @@ -165,8 +165,8 @@ void throwSurveyNotFoundException() { SurveyOption.builder().survey(balanceSurvey).scores(scores).content("질문 옵션 내용").build(); surveyOptionRepository.save(option); - SurveySubmissionServiceRequest request = - new SurveySubmissionServiceRequest(option.getId(), "나는 행복한게 좋으니까"); + SurveySubmissionCommand request = + new SurveySubmissionCommand(option.getId(), "나는 행복한게 좋으니까"); // when // then diff --git a/jaknaeso-server/src/main/java/org/nexters/jaknaesoserver/domain/survey/controller/dto/SurveySubmissionRequest.java b/jaknaeso-server/src/main/java/org/nexters/jaknaesoserver/domain/survey/controller/dto/SurveySubmissionRequest.java index 4974da1c..82d51d74 100644 --- a/jaknaeso-server/src/main/java/org/nexters/jaknaesoserver/domain/survey/controller/dto/SurveySubmissionRequest.java +++ b/jaknaeso-server/src/main/java/org/nexters/jaknaesoserver/domain/survey/controller/dto/SurveySubmissionRequest.java @@ -1,10 +1,10 @@ package org.nexters.jaknaesoserver.domain.survey.controller.dto; import jakarta.validation.constraints.NotNull; -import org.nexters.jaknaesocore.domain.survey.dto.SurveySubmissionServiceRequest; +import org.nexters.jaknaesocore.domain.survey.dto.SurveySubmissionCommand; public record SurveySubmissionRequest(@NotNull Long optionId, String comment) { - public SurveySubmissionServiceRequest toServiceRequest() { - return new SurveySubmissionServiceRequest(optionId(), comment()); + public SurveySubmissionCommand toServiceRequest() { + return new SurveySubmissionCommand(optionId(), comment()); } } diff --git a/jaknaeso-server/src/test/java/org/nexters/jaknaesoserver/domain/survey/controller/SurveyControllerTest.java b/jaknaeso-server/src/test/java/org/nexters/jaknaesoserver/domain/survey/controller/SurveyControllerTest.java index 9aefd7df..731e33d6 100644 --- a/jaknaeso-server/src/test/java/org/nexters/jaknaesoserver/domain/survey/controller/SurveyControllerTest.java +++ b/jaknaeso-server/src/test/java/org/nexters/jaknaesoserver/domain/survey/controller/SurveyControllerTest.java @@ -23,7 +23,7 @@ import org.nexters.jaknaesocore.domain.survey.dto.SurveyHistoryResponse; import org.nexters.jaknaesocore.domain.survey.dto.SurveyOptionsResponse; import org.nexters.jaknaesocore.domain.survey.dto.SurveyResponse; -import org.nexters.jaknaesocore.domain.survey.dto.SurveySubmissionServiceRequest; +import org.nexters.jaknaesocore.domain.survey.dto.SurveySubmissionCommand; import org.nexters.jaknaesoserver.common.support.ControllerTest; import org.nexters.jaknaesoserver.common.support.WithMockCustomUser; import org.nexters.jaknaesoserver.domain.survey.controller.dto.SurveySubmissionRequest; @@ -128,7 +128,7 @@ void getSurveyHistory() throws Exception { SurveySubmissionRequest request = new SurveySubmissionRequest(1L, "나는 행복해요"); willDoNothing() .given(surveyService) - .submitSurvey(anyLong(), anyLong(), any(SurveySubmissionServiceRequest.class)); + .submitSurvey(anyLong(), anyLong(), any(SurveySubmissionCommand.class)); mockMvc .perform(