Skip to content

Commit

Permalink
[~] #64 TemplateDocService 메서드들이 ServiceResult를 반환하도록 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
woody35545 committed Oct 12, 2023
1 parent c3625d9 commit 3537082
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ public class TemplateController {
public Response apiGetAllTemplates() {
ServiceResult sr = templateService.getAllTemplates();
return sr.isFailed() ?
new Response().BadRequest().message(sr.getMessage());
new Response().Ok().data(sr.getData());
new Response().BadRequest().message(sr.getMessage()) :
new Response().Ok().data(sr.getData());
}

@ResponseBody
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/kns/tenquest/controller/ViewController.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,14 @@ public String replyerView(Model model) {

@GetMapping("/templates")
public String templateView(Model model) {
DtoList<TemplateDto> templateList = templateService.getAllTemplates();
DtoList<TemplateDto> templateList = (DtoList<TemplateDto>)templateService.getAllTemplates().getData();
model.addAttribute("templateList", templateList);
return "template_view";
}

@GetMapping("/template-docs")
public String templateDocView(Model model) {
DtoList<TemplateDocDto> templateDocList = templateDocService.getAllTemplateDocs();
DtoList<TemplateDocDto> templateDocList = (DtoList<TemplateDocDto>)templateDocService.getAllTemplateDocs().getData();
model.addAttribute("templateDocList", templateDocList);
return "template_doc_view";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.kns.tenquest.DtoList;
import com.kns.tenquest.dto.ResponseDto;
import com.kns.tenquest.dto.ServiceResult;
import com.kns.tenquest.dto.TemplateDocDto;
import com.kns.tenquest.dto.TemplateDto;
import com.kns.tenquest.repository.TemplateDocRepository;
Expand All @@ -15,9 +16,10 @@ public class TemplateDocService {

private final TemplateDocRepository templateDocRepository;

public DtoList<TemplateDocDto> getAllTemplateDocs(){
public ServiceResult getAllTemplateDocs(){

DtoList<TemplateDocDto> templateDocDtoList = new DtoList<>(templateDocRepository.findAll());
return templateDocDtoList;
return new ServiceResult().success().data(templateDocDtoList);
}

// public ResponseDto<TemplateDocDto> createTemplateDoc (DtoList<TemplateDocDto> )
Expand Down

0 comments on commit 3537082

Please sign in to comment.