feat(dashboard): register dashboard API routes
Add dashboard route registration and wire up handler: Router Changes: - Add DashboardHandler to router.Config struct - Create internal/router/dashboard.go with dashboard route registration - Register dashboard routes in main RegisterRoutes function Dashboard Routes (all protected by JWT): - GET /api/dashboard/sections: Get dashboard sections for user * Query params: library_id (required), limit (optional, default 20, max 100) * Returns: JSON with sections array - PUT /api/dashboard/preferences: Update dashboard preferences * Body: library_id, hidden_collections, collection_order, items_per_section * Returns: Updated preferences - POST /api/dashboard/restore-system-collection: Restore system collection to defaults * Body: collection_name (must be valid system collection) * Returns: Success message Server Integration: - Create dashboardHandler in cmd/server/main.go - Add dashboardHandler to routerConfig - Routes are automatically registered on server startup
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
package router
|
||||
|
||||
func registerDashboardRoutes(cfg *Config) {
|
||||
e := cfg.Echo
|
||||
|
||||
jwtMiddleware := createJWTMiddleware(cfg)
|
||||
protected := e.Group("/api", jwtMiddleware)
|
||||
|
||||
dashboard := protected.Group("/dashboard")
|
||||
dashboard.GET("/sections", cfg.DashboardHandler.GetSections)
|
||||
dashboard.PUT("/preferences", cfg.DashboardHandler.UpdatePreferences)
|
||||
dashboard.POST("/restore-system-collection", cfg.DashboardHandler.RestoreSystemCollection)
|
||||
}
|
||||
Reference in New Issue
Block a user