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)
|
||||||
|
}
|
||||||
@@ -47,6 +47,7 @@ type Config struct {
|
|||||||
AnalyticsHandler *handlers.AnalyticsHandler
|
AnalyticsHandler *handlers.AnalyticsHandler
|
||||||
QueueHandler *handlers.QueueHandler
|
QueueHandler *handlers.QueueHandler
|
||||||
CollectionHandler *handlers.CollectionHandler
|
CollectionHandler *handlers.CollectionHandler
|
||||||
|
DashboardHandler *handlers.DashboardHandler
|
||||||
OPDSHandler *handlers.OPDSHandler
|
OPDSHandler *handlers.OPDSHandler
|
||||||
SystemSettingsHandler *handlers.SystemSettingsHandler
|
SystemSettingsHandler *handlers.SystemSettingsHandler
|
||||||
ConnManager *sync.ConnectionManager
|
ConnManager *sync.ConnectionManager
|
||||||
@@ -164,6 +165,7 @@ func RegisterRoutes(cfg *Config) *handlers.Handler {
|
|||||||
registerDeviceRoutes(cfg)
|
registerDeviceRoutes(cfg)
|
||||||
registerSyncRoutes(cfg)
|
registerSyncRoutes(cfg)
|
||||||
registerCollectionsRoutes(cfg)
|
registerCollectionsRoutes(cfg)
|
||||||
|
registerDashboardRoutes(cfg)
|
||||||
registerMediaRoutes(cfg)
|
registerMediaRoutes(cfg)
|
||||||
registerSearchRoutes(cfg)
|
registerSearchRoutes(cfg)
|
||||||
registerMatchingRoutes(cfg)
|
registerMatchingRoutes(cfg)
|
||||||
|
|||||||
Reference in New Issue
Block a user