6bb47d4b00
- Add full admin REST API: auth, API keys, chains, chain tokens, wallets, orders, RPC nodes, settings, dashboard stats, notifications - Add JWT-based admin authentication and API key auth middleware - Add multi-chain listeners: BSC, ETH, Polygon, Plasma, EVM WebSocket - Add RPC node health check job with automatic failover - Add Telegram notification channel for order events - Add installer for first-run database initialization - Add new DB models: admin_user, api_key, chain, chain_token, rpc_node, settings, notification_channel - Add order statistics aggregation (daily/monthly/by-chain) - Serve built admin SPA from embedded www/ assets - Add comprehensive test coverage for all new features
27 lines
789 B
Go
27 lines
789 B
Go
package admin
|
|
|
|
import (
|
|
"github.com/assimon/luuu/controller"
|
|
"github.com/assimon/luuu/middleware"
|
|
"github.com/labstack/echo/v4"
|
|
)
|
|
|
|
// Ctrl is the singleton admin controller. Keeps parity with comm.Ctrl.
|
|
var Ctrl = &BaseAdminController{}
|
|
|
|
// BaseAdminController aggregates admin-domain handlers. Split across
|
|
// *_controller.go files in this package; all receive methods hang off
|
|
// this type so a single router registration is enough.
|
|
type BaseAdminController struct {
|
|
controller.BaseController
|
|
}
|
|
|
|
// currentAdminUserID returns the admin user id injected by CheckAdminJWT.
|
|
// Returns 0 if the middleware is missing (treat as auth bug upstream).
|
|
func currentAdminUserID(ctx echo.Context) uint64 {
|
|
if v, ok := ctx.Get(middleware.AdminUserIDKey).(uint64); ok {
|
|
return v
|
|
}
|
|
return 0
|
|
}
|