admin page updates
This commit is contained in:
@@ -30,7 +30,7 @@ func addRoutes(
|
||||
audit *auditlog.Logger,
|
||||
) error {
|
||||
// Create the routes
|
||||
pageroutes := []hws.Route{
|
||||
baseRoutes := []hws.Route{
|
||||
{
|
||||
Path: "/static/",
|
||||
Method: hws.MethodGET,
|
||||
@@ -41,6 +41,9 @@ func addRoutes(
|
||||
Method: hws.MethodGET,
|
||||
Handler: handlers.Index(s),
|
||||
},
|
||||
}
|
||||
|
||||
authRoutes := []hws.Route{
|
||||
{
|
||||
Path: "/login",
|
||||
Methods: []hws.Method{hws.MethodGET, hws.MethodPOST},
|
||||
@@ -61,11 +64,9 @@ func addRoutes(
|
||||
Methods: []hws.Method{hws.MethodGET, hws.MethodPOST},
|
||||
Handler: auth.LoginReq(handlers.Logout(s, auth, conn, discordAPI)),
|
||||
},
|
||||
{
|
||||
Path: "/notification-tester",
|
||||
Methods: []hws.Method{hws.MethodGET, hws.MethodPOST},
|
||||
Handler: perms.RequireAdmin(s)(handlers.NotifyTester(s)),
|
||||
},
|
||||
}
|
||||
|
||||
seasonRoutes := []hws.Route{
|
||||
{
|
||||
Path: "/seasons",
|
||||
Method: hws.MethodGET,
|
||||
@@ -121,6 +122,9 @@ func addRoutes(
|
||||
Method: hws.MethodPOST,
|
||||
Handler: perms.RequirePermission(s, permissions.TeamsAddToLeague)(handlers.SeasonLeagueAddTeam(s, conn, audit)),
|
||||
},
|
||||
}
|
||||
|
||||
leagueRoutes := []hws.Route{
|
||||
{
|
||||
Path: "/leagues",
|
||||
Method: hws.MethodGET,
|
||||
@@ -136,6 +140,9 @@ func addRoutes(
|
||||
Method: hws.MethodPOST,
|
||||
Handler: perms.RequirePermission(s, permissions.LeaguesCreate)(handlers.NewLeagueSubmit(s, conn, audit)),
|
||||
},
|
||||
}
|
||||
|
||||
teamRoutes := []hws.Route{
|
||||
{
|
||||
Path: "/teams",
|
||||
Method: hws.MethodGET,
|
||||
@@ -206,6 +213,11 @@ func addRoutes(
|
||||
|
||||
// Admin routes
|
||||
adminRoutes := []hws.Route{
|
||||
{
|
||||
Path: "/notification-tester",
|
||||
Methods: []hws.Method{hws.MethodGET, hws.MethodPOST},
|
||||
Handler: perms.RequireAdmin(s)(handlers.NotifyTester(s)),
|
||||
},
|
||||
// Full page routes (for direct navigation and refreshes)
|
||||
{
|
||||
Path: "/admin",
|
||||
@@ -288,13 +300,11 @@ func addRoutes(
|
||||
Method: hws.MethodPOST,
|
||||
Handler: perms.RequireActualAdmin(s)(handlers.AdminPreviewRoleStop(s)),
|
||||
},
|
||||
// Audit log filtering (returns only results table, no URL push)
|
||||
{
|
||||
Path: "/admin/audit/filter",
|
||||
Method: hws.MethodPOST,
|
||||
Handler: perms.RequireAdmin(s)(handlers.AdminAuditLogsFilter(s, conn)),
|
||||
},
|
||||
// Audit log detail modal
|
||||
{
|
||||
Path: "/admin/audit/{id}",
|
||||
Method: hws.MethodGET,
|
||||
@@ -302,9 +312,13 @@ func addRoutes(
|
||||
},
|
||||
}
|
||||
|
||||
routes := append(pageroutes, htmxRoutes...)
|
||||
routes := append(baseRoutes, htmxRoutes...)
|
||||
routes = append(routes, wsRoutes...)
|
||||
routes = append(routes, authRoutes...)
|
||||
routes = append(routes, adminRoutes...)
|
||||
routes = append(routes, seasonRoutes...)
|
||||
routes = append(routes, leagueRoutes...)
|
||||
routes = append(routes, teamRoutes...)
|
||||
|
||||
// Register the routes with the server
|
||||
err := s.AddRoutes(routes...)
|
||||
|
||||
Reference in New Issue
Block a user