
Features: - Complete project management system with Epic/Story/Task hierarchy - Vue.js 3 + Element Plus frontend with kanban board - Go backend with Gin framework and GORM - OAuth2 integration with Gitea - Docker containerization with MySQL - RESTful API for project, task, and user management - JWT authentication and authorization - Responsive web interface with dashboard
59 lines
1.5 KiB
Go
59 lines
1.5 KiB
Go
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, "功能暂未实现"))
|
|
} |