Changeset 0.28.4 (#190)

This commit is contained in:
2026-03-14 19:36:33 +00:00
parent fa6b04434a
commit 85d5e3cc13
54 changed files with 7355 additions and 102 deletions

View File

@@ -39,6 +39,7 @@ func TestRouteRegistration(t *testing.T) {
} else {
stores = postgres.NewStores(database.TestDB)
}
userCache := middleware.NewUserStatusCache()
// This must not panic. If it does, there's a wildcard conflict.
r := gin.New()
@@ -55,7 +56,7 @@ func TestRouteRegistration(t *testing.T) {
// Protected API routes
protected := api.Group("")
protected.Use(middleware.Auth(cfg))
protected.Use(middleware.Auth(cfg, stores.Users, userCache))
// Channels (the route group that conflicts with workflow)
channels := NewChannelHandler()
@@ -99,7 +100,7 @@ func TestRouteRegistration(t *testing.T) {
// Session API (the /w/:id group)
wfAPI := base.Group("/api/v1/w")
wfAPI.Use(middleware.AuthOrSession(cfg, stores))
wfAPI.Use(middleware.AuthOrSession(cfg, stores, userCache))
wfAPI.POST("/:id/messages", msgs.CreateMessage)
wfAPI.GET("/:id/messages", msgs.ListMessages)
@@ -111,9 +112,9 @@ func TestRouteRegistration(t *testing.T) {
pageEngine := pages.New(cfg, stores)
pageEngine.RegisterPageRoutes(base, pages.PageRouteMiddleware{
Authenticated: middleware.AuthOrRedirect(cfg),
Admin: []gin.HandlerFunc{middleware.AuthOrRedirect(cfg), middleware.RequireAdminPage()},
Session: middleware.AuthOrSession(cfg, stores),
Authenticated: middleware.AuthOrRedirect(cfg, stores.Users, userCache),
Admin: []gin.HandlerFunc{middleware.AuthOrRedirect(cfg, stores.Users, userCache), middleware.RequireAdminPage()},
Session: middleware.AuthOrSession(cfg, stores, userCache),
})
// ── Verify routes actually resolve ────