架构性调整【懒得区分了,哈哈哈哈】,主要是跑通了第一个功能测试

This commit is contained in:
guo
2024-07-11 22:59:16 +08:00
parent 39539e5ef6
commit b1358eaca0
24 changed files with 460 additions and 148 deletions
@@ -1,26 +1,59 @@
package com.guo.learningprogresstracker.controller;
import com.guo.learningprogresstracker.entity.CommonResult;
import com.guo.learningprogresstracker.dto.request.TaskRequest;
import com.guo.learningprogresstracker.service.TasksService;
import com.guo.learningprogresstracker.service.impl.TasksServiceImpl;
import org.springframework.stereotype.Controller;
import io.swagger.v3.oas.annotations.Operation;
import lombok.RequiredArgsConstructor;
import org.springframework.scheduling.config.Task;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
/**
* 任务控制层
* @author guo
*/
@Controller
@RestController
@RequiredArgsConstructor
public class TaskController {
private final TasksService tasksService;
public TaskController(TasksServiceImpl tasksService) {
this.tasksService = tasksService;
@PostMapping("/tasks")
@Operation(summary = "添加新任务")
public CommonResult addTask(@RequestBody TaskRequest taskRequest) {
return CommonResult.success(tasksService.addTask(taskRequest));
}
@Operation(summary = "任务详情API-未完成")
@GetMapping("/tasks/{taskId}")
public CommonResult<TaskInfoResult> showTask(@PathVariable("taskId") String taskId) {
public CommonResult showTask(@PathVariable("taskId") String taskId) {
return CommonResult.success(tasksService.showTask(taskId));
}
@PutMapping("/tasks/{taskId}")
@Operation(summary = "更新任务详情")
public CommonResult updateTask(@PathVariable("taskId") String taskId, @RequestBody Task updatedTask) {
// return CommonResult.success(tasksService.updateTask(taskId, updatedTask));
return null;
}
@DeleteMapping("/tasks/{taskId}")
@Operation(summary = "删除指定任务")
public CommonResult deleteTask(@PathVariable("taskId") String taskId) {
// return CommonResult.success(tasksService.deleteTask(taskId));
return null;
}
@GetMapping("/tasks")
@Operation(summary = "获取所有任务列表")
public CommonResult listTasks() {
// return CommonResult.success(tasksService.listTasks());
return null;
}
}