mengstack-api/internal/modules/notification/interfaces/routes.go
MengStack Dev df809f1045
Some checks failed
CI / Build & Test (push) Failing after 1m31s
feat: user CRUD API + dashboard stats + kernel infrastructure
- 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
2026-10-03 03:42:58 +08:00

39 lines
954 B
Go

package interfaces
import (
"mengstack/internal/app/middleware"
"mengstack/internal/kernel/tenant"
"mengstack/internal/modules/notification/application"
"mengstack/internal/modules/notification/infrastructure"
"github.com/gin-gonic/gin"
"go.uber.org/fx"
)
func SetupRoutes(
r *gin.Engine,
h *Handler,
authMW gin.HandlerFunc,
tenantResolver tenant.Resolver,
) {
notifications := r.Group("/api/v1/notifications")
notifications.Use(authMW, middleware.MultiTenant(tenantResolver))
{
notifications.POST("", h.Create)
notifications.GET("/:id", h.Get)
notifications.DELETE("/:id", h.Delete)
notifications.PUT("/:id/read", h.MarkAsRead)
notifications.PUT("/read-all", h.MarkAllAsRead)
notifications.GET("/unread-count", h.CountUnread)
notifications.GET("/user/:userId", h.ListByUser)
}
}
var Module = fx.Module("notification",
fx.Provide(
infrastructure.NewNotificationRepository,
application.NewService,
NewHandler,
),
)