feat: 添加通知模块的 API 处理器和路由配置

This commit is contained in:
2026-01-28 09:12:58 +08:00
parent a18564c2d8
commit 1b6feae015
2 changed files with 14 additions and 5 deletions

View File

@@ -205,11 +205,10 @@ func (h *NotificationHandler) CreateNotification(c *gin.Context) {
api.Created(c, notification)
}
// RegisterRoutes registers all notification routes to the given router group
func (h *NotificationHandler) RegisterRoutes(rg *gin.RouterGroup) {
// RegisterUserRoutes registers notification routes for regular users
func (h *NotificationHandler) RegisterUserRoutes(rg *gin.RouterGroup) {
notifications := rg.Group("/notifications")
{
notifications.POST("", h.CreateNotification)
notifications.GET("", h.GetNotifications)
notifications.GET("/unread-count", h.GetUnreadCount)
notifications.PUT("/:id/read", h.MarkAsRead)
@@ -217,3 +216,11 @@ func (h *NotificationHandler) RegisterRoutes(rg *gin.RouterGroup) {
notifications.DELETE("/:id", h.DeleteNotification)
}
}
// RegisterAdminRoutes registers notification routes for admin/system use
func (h *NotificationHandler) RegisterAdminRoutes(rg *gin.RouterGroup) {
notifications := rg.Group("/notifications")
{
notifications.POST("", h.CreateNotification)
}
}