fix(server): allow members to create agents

Remove the owner/admin role restriction on the POST /api/agents endpoint
so that workspace members can also create agents.
This commit is contained in:
Jiang Bohan
2026-04-14 22:49:50 +08:00
parent b2649fb47f
commit 0a5ee5e48e

View File

@@ -263,7 +263,7 @@ func NewRouter(pool *pgxpool.Pool, hub *realtime.Hub, bus *events.Bus) chi.Route
// Agents
r.Route("/api/agents", func(r chi.Router) {
r.Get("/", h.ListAgents)
r.With(middleware.RequireWorkspaceRole(queries, "owner", "admin")).Post("/", h.CreateAgent)
r.Post("/", h.CreateAgent)
r.Route("/{id}", func(r chi.Router) {
r.Get("/", h.GetAgent)
r.Put("/", h.UpdateAgent)