package handlers import ( "net/http" "strconv" "giteapm/internal/models" "github.com/gin-gonic/gin" ) func (h *Handlers) ListEpics(c *gin.Context) { page, _ := strconv.Atoi(c.DefaultQuery("page", "1")) limit, _ := strconv.Atoi(c.DefaultQuery("limit", "20")) offset := (page - 1) * limit filters := make(map[string]interface{}) if projectID := c.Query("project_id"); projectID != "" { if id, err := strconv.ParseUint(projectID, 10, 32); err == nil { filters["project_id"] = uint(id) } } epics, total, err := models.ListEpics(offset, limit, filters) if err != nil { c.JSON(http.StatusInternalServerError, ErrorResponse(500, "获取Epic列表失败")) return } c.JSON(http.StatusOK, PaginatedSuccessResponse(epics, total, page, limit)) } func (h *Handlers) CreateEpic(c *gin.Context) { c.JSON(http.StatusNotImplemented, ErrorResponse(501, "功能暂未实现")) } func (h *Handlers) GetEpic(c *gin.Context) { id, err := strconv.ParseUint(c.Param("id"), 10, 32) if err != nil { c.JSON(http.StatusBadRequest, ErrorResponse(400, "无效的Epic ID")) return } epic, err := models.GetEpicByID(uint(id)) if err != nil { c.JSON(http.StatusNotFound, ErrorResponse(404, "Epic不存在")) return } c.JSON(http.StatusOK, SuccessResponse(epic)) } func (h *Handlers) UpdateEpic(c *gin.Context) { c.JSON(http.StatusNotImplemented, ErrorResponse(501, "功能暂未实现")) } func (h *Handlers) DeleteEpic(c *gin.Context) { c.JSON(http.StatusNotImplemented, ErrorResponse(501, "功能暂未实现")) }