요청관리 API 수정
This commit is contained in:
+8
-7
@@ -13,6 +13,7 @@ import com.eactive.testmaster.common.util.SecurityUtil;
|
|||||||
import com.eactive.testmaster.user.entity.StaffUser;
|
import com.eactive.testmaster.user.entity.StaffUser;
|
||||||
import com.eactive.testmaster.user.service.UserService;
|
import com.eactive.testmaster.user.service.UserService;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Collections;
|
||||||
import javax.transaction.Transactional;
|
import javax.transaction.Transactional;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
@@ -24,7 +25,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|||||||
@RestController
|
@RestController
|
||||||
public class ApiRequestMgmtController {
|
public class ApiRequestMgmtController {
|
||||||
|
|
||||||
private static final String SUCCESS = "success";
|
private static final String SUCCESS = "{\"success\" : true }";
|
||||||
private final ApiRequestMgmtService apiRequestMgmtService;
|
private final ApiRequestMgmtService apiRequestMgmtService;
|
||||||
|
|
||||||
private final ApiLayoutMgmtService apiLayoutMgmtService;
|
private final ApiLayoutMgmtService apiLayoutMgmtService;
|
||||||
@@ -58,7 +59,7 @@ public class ApiRequestMgmtController {
|
|||||||
collection.setOwner(user);
|
collection.setOwner(user);
|
||||||
|
|
||||||
apiRequestMgmtService.createNewApiCollection(collection);
|
apiRequestMgmtService.createNewApiCollection(collection);
|
||||||
return ResponseEntity.ok(SUCCESS);
|
return ResponseEntity.ok().body(SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -66,18 +67,18 @@ public class ApiRequestMgmtController {
|
|||||||
public ResponseEntity<String> updateApiCollection(@RequestBody ApiCollectionDTO dto) {
|
public ResponseEntity<String> updateApiCollection(@RequestBody ApiCollectionDTO dto) {
|
||||||
ApiCollection updated = apiRequestMapper.map(dto);
|
ApiCollection updated = apiRequestMapper.map(dto);
|
||||||
apiRequestMgmtService.updateApiCollectionName(updated.getId(), updated);
|
apiRequestMgmtService.updateApiCollectionName(updated.getId(), updated);
|
||||||
return ResponseEntity.ok(SUCCESS);
|
return ResponseEntity.ok().body(SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/mgmt/collections/delete.do")
|
@PostMapping("/mgmt/collections/delete.do")
|
||||||
public ResponseEntity<String> deleteApiCollection(@RequestBody ApiCollectionDTO dto) {
|
public ResponseEntity<String> deleteApiCollection(@RequestBody ApiCollectionDTO dto) {
|
||||||
apiRequestMgmtService.deleteApiCollection(dto.getId());
|
apiRequestMgmtService.deleteApiCollection(dto.getId());
|
||||||
return ResponseEntity.ok(SUCCESS);
|
return ResponseEntity.ok().body(SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/mgmt/collections/{id}/apis/save.do")
|
@PostMapping("/mgmt/collections/{id}/apis/save.do")
|
||||||
@Transactional
|
@Transactional
|
||||||
public ResponseEntity<String> addApiToCollection(@PathVariable(name = "id") String id, @RequestBody ApiRequestDTO dto) {
|
public ResponseEntity<?> addApiToCollection(@PathVariable(name = "id") String id, @RequestBody ApiRequestDTO dto) {
|
||||||
ApiRequestInfo apiRequestInfo = apiRequestMapper.map(dto);
|
ApiRequestInfo apiRequestInfo = apiRequestMapper.map(dto);
|
||||||
StaffUser user = userService.findByEsntlId(SecurityUtil.getCurrentUserEsntlId());
|
StaffUser user = userService.findByEsntlId(SecurityUtil.getCurrentUserEsntlId());
|
||||||
apiRequestInfo.setOwner(user);
|
apiRequestInfo.setOwner(user);
|
||||||
@@ -88,7 +89,7 @@ public class ApiRequestMgmtController {
|
|||||||
dto.getLayout().setId(apiId);
|
dto.getLayout().setId(apiId);
|
||||||
apiLayoutMgmtService.saveLayout(apiLayoutMapper.map(dto.getLayout()));
|
apiLayoutMgmtService.saveLayout(apiLayoutMapper.map(dto.getLayout()));
|
||||||
}
|
}
|
||||||
return ResponseEntity.ok(apiId);
|
return ResponseEntity.ok(Collections.singletonMap("apiId", apiId));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -100,7 +101,7 @@ public class ApiRequestMgmtController {
|
|||||||
apiLayoutMgmtService.deleteLayout(layout.getId());
|
apiLayoutMgmtService.deleteLayout(layout.getId());
|
||||||
}
|
}
|
||||||
apiRequestMgmtService.removeApiFromCollection(id, dto.getId());
|
apiRequestMgmtService.removeApiFromCollection(id, dto.getId());
|
||||||
return ResponseEntity.ok(SUCCESS);
|
return ResponseEntity.ok().body(SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user