Some checks failed
CI / Build & Test (push) Failing after 1m31s
- Add user management endpoints (list/create/get/update/delete) with pagination and search - Add dashboard stats endpoint with tenant/user/online counts and growth metrics - Add tenant resolver middleware for multi-tenant request scoping - Add i18n kernel with zh/en message files and AcceptLanguage middleware - Add WebSocket hub/handler for real-time communication - Add job scheduler kernel with cron support - Add plugin sandbox for isolated execution - Add storage kernel (local filesystem) - Add event bus kernel for pub/sub - Add cache kernel abstraction - Add database migration runner and version upgrade checker - Add rate limiting middleware with Redis backend - Add SQL migrations for rbac, audit_logs, settings, notifications, examples - Extend user repository with list/delete/count operations - Register all module routes with tenant resolver
48 lines
966 B
Go
48 lines
966 B
Go
package upgrade
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"mengstack/internal/app/version"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
// Handler exposes升级检查接口。
|
|
type Handler struct {
|
|
checker Checker
|
|
}
|
|
|
|
func NewHandler() *Handler {
|
|
return &Handler{}
|
|
}
|
|
|
|
// SetChecker sets the upgrade checker implementation.
|
|
// Called when a concrete Checker is available.
|
|
func (h *Handler) SetChecker(c Checker) {
|
|
h.checker = c
|
|
}
|
|
|
|
// Check godoc
|
|
// @Summary 升级检查
|
|
// @Description 检查是否有新版本可用(当前为预留接口,返回当前版本信息)
|
|
// @Tags System
|
|
// @Produce json
|
|
// @Success 200 {object} UpgradeStatus
|
|
// @Router /api/upgrade/check [get]
|
|
func (h *Handler) Check(c *gin.Context) {
|
|
status := &UpgradeStatus{
|
|
CurrentVersion: version.Version,
|
|
Available: false,
|
|
}
|
|
|
|
if h.checker != nil {
|
|
result, err := h.checker.Check(version.Version)
|
|
if err == nil {
|
|
status = result
|
|
}
|
|
}
|
|
|
|
c.JSON(http.StatusOK, status)
|
|
}
|