diff --git a/internal/router/dashboard.go b/internal/router/dashboard.go new file mode 100644 index 0000000..6b3da91 --- /dev/null +++ b/internal/router/dashboard.go @@ -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) +} diff --git a/internal/router/router.go b/internal/router/router.go index 8bb5bd4..fedbe01 100644 --- a/internal/router/router.go +++ b/internal/router/router.go @@ -47,6 +47,7 @@ type Config struct { AnalyticsHandler *handlers.AnalyticsHandler QueueHandler *handlers.QueueHandler CollectionHandler *handlers.CollectionHandler + DashboardHandler *handlers.DashboardHandler OPDSHandler *handlers.OPDSHandler SystemSettingsHandler *handlers.SystemSettingsHandler ConnManager *sync.ConnectionManager @@ -164,6 +165,7 @@ func RegisterRoutes(cfg *Config) *handlers.Handler { registerDeviceRoutes(cfg) registerSyncRoutes(cfg) registerCollectionsRoutes(cfg) + registerDashboardRoutes(cfg) registerMediaRoutes(cfg) registerSearchRoutes(cfg) registerMatchingRoutes(cfg)