package net.northking.cctp.dw.api;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import net.northking.cctp.common.http.ResultWrapper;
import net.northking.cctp.dw.api.service.BugChartService;
import net.northking.cctp.dw.db.entity.BugDensityChart;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author: puchao.ma
 * @date: 2021/12/17 11:12
 */
@RestController
@RequestMapping("/v1/bugManagement")
@Api(tags = "缺陷图表")
public class BugChartCtrl {
    @Autowired
    private BugChartService apiService;

    @ApiOperation("缺陷密度")
    @PostMapping("queryBugDensity/{projectId}")
    public ResultWrapper<List<BugDensityChart>> queryBugDensity(@PathVariable("projectId") String projectId) {
        ResultWrapper<List<BugDensityChart>> wrapper = new ResultWrapper<>();
        List<BugDensityChart> bugDensityCharts = apiService.queryBugDensity(projectId);
        return wrapper.success(bugDensityCharts);
    }
}
