3
0

Reorganize & move ctrls under route groups

This commit is contained in:
Denis Arh 2019-08-30 14:40:27 +02:00
parent ff54adac97
commit 0ab59c791b
3 changed files with 8 additions and 9 deletions

View File

@ -23,7 +23,8 @@ func MountRoutes(r chi.Router) {
// Initialize handlers & controllers.
r.Group(func(r chi.Router) {
handlers.NewPermissions(Permissions{}.New()).MountRoutes(r)
// Use alternative handlers that support file serving
handlers.NewAttachment(attachment).MountRoutes(r)
})
// Protect all _private_ routes
@ -37,11 +38,9 @@ func MountRoutes(r chi.Router) {
handlers.NewRecord(record).MountRoutes(r)
handlers.NewChart(chart).MountRoutes(r)
handlers.NewNotification(notification).MountRoutes(r)
handlers.NewPermissions(Permissions{}.New()).MountRoutes(r)
handlers.NewAutomationScript(automationScript).MountRoutes(r)
handlers.NewAutomationTrigger(automationTrgger).MountRoutes(r)
})
// Use alternative handlers that support file serving
handlers.NewAttachment(attachment).MountRoutes(r)
}

View File

@ -12,7 +12,6 @@ func MountRoutes(r chi.Router) {
r.Group(func(r chi.Router) {
handlers.NewAttachment(Attachment{}.New()).MountRoutes(r)
handlers.NewWebhooksPublic(WebhooksPublic{}.New()).MountRoutes(r)
handlers.NewPermissions(Permissions{}.New()).MountRoutes(r)
})
// Protect all _private_ routes
@ -27,5 +26,6 @@ func MountRoutes(r chi.Router) {
handlers.NewStatus(Status{}.New()).MountRoutes(r)
handlers.NewCommands(Commands{}.New()).MountRoutes(r)
handlers.NewWebhooks(Webhooks{}.New()).MountRoutes(r)
handlers.NewPermissions(Permissions{}.New()).MountRoutes(r)
})
}

View File

@ -10,10 +10,10 @@ import (
func MountRoutes(r chi.Router) {
NewExternalAuth().ApiServerRoutes(r)
// Provide raw `/auth` handlers
handlers.NewAuth((Auth{}).New()).MountRoutes(r)
handlers.NewAuthInternal((AuthInternal{}).New()).MountRoutes(r)
r.Group(func(r chi.Router) {
handlers.NewAuth((Auth{}).New()).MountRoutes(r)
handlers.NewAuthInternal((AuthInternal{}).New()).MountRoutes(r)
})
// Protect all _private_ routes
r.Group(func(r chi.Router) {