diff --git a/backend/epimetheus/src/main/java/uos/capstone/epimetheus/controller/TaskController.java b/backend/epimetheus/src/main/java/uos/capstone/epimetheus/controller/TaskController.java index 8c0024c8..319a4eed 100644 --- a/backend/epimetheus/src/main/java/uos/capstone/epimetheus/controller/TaskController.java +++ b/backend/epimetheus/src/main/java/uos/capstone/epimetheus/controller/TaskController.java @@ -3,6 +3,7 @@ import lombok.RequiredArgsConstructor; import lombok.extern.log4j.Log4j2; import org.springframework.http.HttpStatus; +import org.springframework.http.HttpStatusCode; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; @@ -28,12 +29,14 @@ public Flux getTaskData(@RequestBody String taskName) { @PostMapping(path = "/save") public ResponseEntity saveCode(@RequestBody TaskStep taskStep){ String response = taskSerivce.saveCode(taskStep); + HttpStatusCode status; if(response.equals("not code")){ - return ResponseEntity.badRequest().body("not code"); - }else if(response.equals("sucess")){ - return ResponseEntity.ok().body("sucess"); + status = HttpStatus.BAD_REQUEST; + }else if(response.equals("success")){ + status = HttpStatus.OK; }else{ - return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(response); + status = HttpStatus.INTERNAL_SERVER_ERROR; } + return ResponseEntity.status(status).body(response); } } diff --git a/backend/epimetheus/src/main/java/uos/capstone/epimetheus/service/TaskServiceStreamImpl.java b/backend/epimetheus/src/main/java/uos/capstone/epimetheus/service/TaskServiceStreamImpl.java index f7b1327d..30dc5f6e 100644 --- a/backend/epimetheus/src/main/java/uos/capstone/epimetheus/service/TaskServiceStreamImpl.java +++ b/backend/epimetheus/src/main/java/uos/capstone/epimetheus/service/TaskServiceStreamImpl.java @@ -143,7 +143,7 @@ public String saveCode(TaskStep taskStep){ return "not code"; }else{ databaseService.saveCode(taskStep); - return "sucess"; + return "success"; } }catch (Exception e){ return e.toString();