refactor(消息管理): 修改机器人获取列表接口

This commit is contained in:
guoyuqi 2023-09-27 15:11:00 +08:00 committed by fit2-zhao
parent 1a9d36534a
commit 58966bda2f
4 changed files with 11 additions and 11 deletions

View File

@ -18,7 +18,7 @@ import org.springframework.web.bind.annotation.*;
import java.util.List;
@Tag(name = "项目管理-项目与权限-消息管理-机器人")
@Tag(name = "项目管理-消息管理-机器人")
@RestController
@RequestMapping("/project/robot/")
public class ProjectRobotController {
@ -27,15 +27,15 @@ public class ProjectRobotController {
private ProjectRobotService projectRobotService;
@PostMapping("/list/{projectId}")
@Operation(summary = "项目管理-项目与权限-消息管理-获取机器人列表")
@GetMapping("/list/{projectId}")
@Operation(summary = "项目管理-消息管理-获取机器人列表")
@RequiresPermissions(PermissionConstants.PROJECT_MESSAGE_READ)
public List<ProjectRobot> listResourcePools(@PathVariable(value = "projectId") String projectId) {
return projectRobotService.getList(projectId);
}
@PostMapping("add")
@Operation(summary = "项目管理-项目与权限-消息管理-新增机器人")
@Operation(summary = "项目管理-消息管理-新增机器人")
@RequiresPermissions(PermissionConstants.PROJECT_MESSAGE_READ_ADD)
public void add(@Validated({Created.class}) @RequestBody ProjectRobotDTO projectRobotDTO) {
ProjectRobot projectRobot = new ProjectRobot();
@ -48,7 +48,7 @@ public class ProjectRobotController {
}
@PostMapping("update")
@Operation(summary = "项目管理-项目与权限-消息管理-更新机器人")
@Operation(summary = "项目管理-消息管理-更新机器人")
@RequiresPermissions(PermissionConstants.PROJECT_MESSAGE_READ_UPDATE)
public void update(@Validated({Updated.class}) @RequestBody ProjectRobotDTO projectRobotDTO) {
ProjectRobot projectRobot = new ProjectRobot();
@ -61,21 +61,21 @@ public class ProjectRobotController {
}
@GetMapping("get/{id}")
@Operation(summary = "项目管理-项目与权限-消息管理-获取机器人详情")
@Operation(summary = "项目管理-消息管理-获取机器人详情")
@RequiresPermissions(PermissionConstants.PROJECT_MESSAGE_READ)
public ProjectRobotDTO getDetail(@PathVariable(value = "id") String id) {
return projectRobotService.getDetail(id);
}
@GetMapping("delete/{id}")
@Operation(summary = "项目管理-项目与权限-消息管理-删除机器人")
@Operation(summary = "项目管理-消息管理-删除机器人")
@RequiresPermissions(PermissionConstants.PROJECT_MESSAGE_READ_DELETE)
public void delete(@PathVariable(value = "id") String id) {
projectRobotService.delete(id);
}
@GetMapping("enable/{id}")
@Operation(summary = "项目管理-项目与权限-消息管理-禁用机器人")
@Operation(summary = "项目管理-消息管理-禁用机器人")
@RequiresPermissions(PermissionConstants.PROJECT_MESSAGE_READ_UPDATE)
public void enable(@PathVariable(value = "id") String id) {
projectRobotService.enable(id, SessionUtils.getUserId(), System.currentTimeMillis());

View File

@ -53,7 +53,7 @@ public class CleanupRobotResourceTests extends BaseTest {
}
private List<ProjectRobot> getList() throws Exception {
MvcResult mvcResult = mockMvc.perform(MockMvcRequestBuilders.post(ROBOT_LIST + "test")
MvcResult mvcResult = mockMvc.perform(MockMvcRequestBuilders.get(ROBOT_LIST + "test")
.header(SessionConstants.HEADER_TOKEN, sessionId)
.header(SessionConstants.CSRF_TOKEN, csrfToken)
.contentType(MediaType.APPLICATION_JSON))

View File

@ -43,7 +43,7 @@ public class CreateRobotResourceTests extends BaseTest {
}
private List<ProjectRobot> getList() throws Exception {
MvcResult mvcResult = mockMvc.perform(MockMvcRequestBuilders.post(ROBOT_LIST + "test")
MvcResult mvcResult = mockMvc.perform(MockMvcRequestBuilders.get(ROBOT_LIST + "test")
.header(SessionConstants.HEADER_TOKEN, sessionId)
.header(SessionConstants.CSRF_TOKEN, csrfToken)
.contentType(MediaType.APPLICATION_JSON))

View File

@ -363,7 +363,7 @@ public class ProjectRobotControllerTests extends BaseTest {
}
private List<ProjectRobot> getList(String projectId) throws Exception {
MvcResult mvcResult = mockMvc.perform(MockMvcRequestBuilders.post(ROBOT_LIST + projectId)
MvcResult mvcResult = mockMvc.perform(MockMvcRequestBuilders.get(ROBOT_LIST + projectId)
.header(SessionConstants.HEADER_TOKEN, sessionId)
.header(SessionConstants.CSRF_TOKEN, csrfToken)
.contentType(MediaType.APPLICATION_JSON))