package transport import ( "github.com/geo-platform/tenant-api/internal/bootstrap" "github.com/geo-platform/tenant-api/internal/shared/auth" "github.com/geo-platform/tenant-api/internal/shared/middleware" ) func RegisterRoutes(app *bootstrap.App) { authAPI := app.Engine.Group("/api/auth") authHandler := NewAuthHandler(app) authAPI.POST("/login", authHandler.Login) authAPI.POST("/refresh", authHandler.Refresh) protected := app.Engine.Group("/api") protected.Use(auth.Middleware(app.JWT, app.Sessions)) protected.Use(middleware.TenantScope()) protected.GET("/auth/me", authHandler.Me) protected.POST("/auth/logout", authHandler.Logout) workspace := protected.Group("/tenant/workspace") wsHandler := NewWorkspaceHandler(app) workspace.GET("/overview", wsHandler.Overview) workspace.GET("/recent-articles", wsHandler.RecentArticles) workspace.GET("/quota-summary", wsHandler.QuotaSummary) workspace.GET("/template-cards", wsHandler.TemplateCards) templates := protected.Group("/tenant/templates") tplHandler := NewTemplateHandler(app) templates.GET("", tplHandler.List) templates.GET("/:id", tplHandler.Detail) templates.GET("/:id/schema", tplHandler.Schema) templates.POST("/:id/generate", tplHandler.Generate) articles := protected.Group("/tenant/articles") artHandler := NewArticleHandler(app) articles.GET("", artHandler.List) articles.GET("/:id", artHandler.Detail) articles.GET("/:id/stream", artHandler.Stream) articles.GET("/:id/versions", artHandler.Versions) articles.DELETE("/:id", artHandler.Delete) brands := protected.Group("/tenant/brands") brandHandler := NewBrandHandler(app) brands.GET("", brandHandler.List) brands.POST("", brandHandler.Create) brands.GET("/:id", brandHandler.Detail) brands.PUT("/:id", brandHandler.Update) brands.DELETE("/:id", brandHandler.Delete) brands.GET("/:id/keywords", brandHandler.ListKeywords) brands.POST("/:id/keywords", brandHandler.CreateKeyword) brands.PUT("/:id/keywords/:kid", brandHandler.UpdateKeyword) brands.DELETE("/:id/keywords/:kid", brandHandler.DeleteKeyword) brands.GET("/:id/questions", brandHandler.ListQuestions) brands.POST("/:id/questions", brandHandler.CreateQuestion) brands.PUT("/:id/questions/:qid", brandHandler.UpdateQuestion) brands.DELETE("/:id/questions/:qid", brandHandler.DeleteQuestion) brands.GET("/:id/question-versions", brandHandler.ListQuestionVersions) brands.GET("/:id/competitors", brandHandler.ListCompetitors) brands.POST("/:id/competitors", brandHandler.CreateCompetitor) brands.PUT("/:id/competitors/:cid", brandHandler.UpdateCompetitor) brands.DELETE("/:id/competitors/:cid", brandHandler.DeleteCompetitor) }