From a5e3e63d67f22930da3d8fbdb5bd0181c1baff0c Mon Sep 17 00:00:00 2001 From: woody35545 Date: Wed, 11 Oct 2023 18:06:18 +0900 Subject: [PATCH] =?UTF-8?q?[~]=20#64=20TemplateService=EC=9D=98=20?= =?UTF-8?q?=EB=A9=94=EC=84=9C=EB=93=9C=EA=B0=80=20ServiceResult=20?= =?UTF-8?q?=EB=B0=98=ED=99=98=ED=95=98=EB=8F=84=EB=A1=9D=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/TemplateController.java | 2 +- .../kns/tenquest/service/TemplateService.java | 59 ++++++++++--------- 2 files changed, 33 insertions(+), 28 deletions(-) diff --git a/src/main/java/com/kns/tenquest/controller/TemplateController.java b/src/main/java/com/kns/tenquest/controller/TemplateController.java index 8ab099c..55e58a8 100644 --- a/src/main/java/com/kns/tenquest/controller/TemplateController.java +++ b/src/main/java/com/kns/tenquest/controller/TemplateController.java @@ -39,7 +39,7 @@ public Response_Deprecated apiGetAllTemplates(){ @GetMapping("/templates/{memberId}") public Response_Deprecated> apiGetAllMemberTemplates(@PathVariable("memberId")String memberId){ ResponseStatus responseStatus = ResponseStatus.OK; - DtoList allMemberTemplates = templateService.getAllMemberTemplates(memberId); + DtoList allMemberTemplates = templateService.getAllTemplatesByMember(memberId); return new ResponseDto>(responseStatus,allMemberTemplates).toResponse(); } diff --git a/src/main/java/com/kns/tenquest/service/TemplateService.java b/src/main/java/com/kns/tenquest/service/TemplateService.java index 13d306c..75d95d9 100644 --- a/src/main/java/com/kns/tenquest/service/TemplateService.java +++ b/src/main/java/com/kns/tenquest/service/TemplateService.java @@ -2,10 +2,7 @@ import com.kns.tenquest.DtoList; import com.kns.tenquest.RequestWrapper.TemplateWrapper; -import com.kns.tenquest.dto.MemberDto; -import com.kns.tenquest.dto.QuestionDto; -import com.kns.tenquest.dto.TemplateDocDto; -import com.kns.tenquest.dto.TemplateDto; +import com.kns.tenquest.dto.*; import com.kns.tenquest.entity.Member; import com.kns.tenquest.entity.Question; import com.kns.tenquest.entity.Template; @@ -16,7 +13,6 @@ import com.kns.tenquest.repository.TemplateRepository; import io.micrometer.common.util.StringUtils; import lombok.RequiredArgsConstructor; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import javax.transaction.Transactional; @@ -32,11 +28,11 @@ public class TemplateService { private final MemberRepository memberRepository; private final QuestionRepository questionRepository; - public DtoList getAllTemplates(){ + public ServiceResult getAllTemplates(){ DtoList TemplateDtoList = new DtoList<>(templateRepository.findAll()); - return TemplateDtoList; + return new ServiceResult().success().data(TemplateDtoList); } - public DtoList getAllMemberTemplates(String templateOwner){ + public ServiceResult getAllTemplatesByMember(String templateOwner){ List