Skip to content

Commit

Permalink
[+] #65 ReplyerController 메서드 반환 타입 통일
Browse files Browse the repository at this point in the history
  • Loading branch information
woody35545 committed Oct 22, 2023
1 parent c633ead commit ec65cf6
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions src/main/java/com/kns/tenquest/controller/ReplyerController.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
import com.kns.tenquest.ENV;
import com.kns.tenquest.dto.ReplyerDto;
import com.kns.tenquest.dto.ResponseDto;
import com.kns.tenquest.dto.ServiceResult;
import com.kns.tenquest.entity.Replyer;
import com.kns.tenquest.response.Response_Deprecated;
import com.kns.tenquest.response.Response;
import com.kns.tenquest.response.ResponseStatus;
import com.kns.tenquest.service.ReplyerService;
import lombok.RequiredArgsConstructor;
Expand All @@ -27,20 +29,23 @@ public class ReplyerController {

@ResponseBody
@GetMapping("/replyers")
public List<Replyer> apiGetReplyers(){
return replyerService.getAllReplyers();
public Response apiGetReplyers(){

ServiceResult sr = replyerService.getAllReplyers();

return sr.isFailed() ?
new Response().BadRequest() :
new Response().Ok().data(sr.getData());
}

@GetMapping("/replyers/{replyerid}")
public Response_Deprecated<ReplyerDto> apiGetReplyerByReplyerId(@PathVariable(value = "replyerid")int replyerId){
ReplyerDto replyerDto = replyerService.getReplyerByReplyerId(replyerId);
ResponseStatus responseStatus = ResponseStatus.OK;

if (replyerDto.getReplyerId()==-1){
responseStatus = ResponseStatus.NOT_FOUND;
}
return new ResponseDto<ReplyerDto>(responseStatus,replyerDto).toResponse();
public Response apiGetReplyerByReplyerId(@PathVariable(value = "replyerid")int replyerId){

ServiceResult sr = replyerService.getReplyerByReplyerId(replyerId);

return sr.isFailed() ?
new Response().BadRequest() :
new Response().Ok().data(sr.getData());
}


}

0 comments on commit ec65cf6

Please sign in to comment.