feat: add update and delete operations for users and policies in admin interface

Add updateUser and deleteUser API client methods with PATCH and DELETE endpoints. Add updatePolicy and deletePolicy API client methods. Add email field to User type. Add Actions column to users and policies tables with Edit and Delete buttons. Implement inline edit forms for users and policies with state management for editing mode. Add update and delete mutations with query invalidation on success. Add error notices
This commit is contained in:
2026-03-17 20:49:38 +01:00
parent a52777602f
commit cf65dc0e41
14 changed files with 502 additions and 12 deletions

View File

@@ -52,6 +52,8 @@ func NewRouter(jwtSecret string, handlers Handlers) http.Handler {
r.Use(AdminOnly)
r.Get("/users", handlers.User.List)
r.Post("/users", handlers.User.Create)
r.Patch("/users/{id}", handlers.User.Update)
r.Delete("/users/{id}", handlers.User.Delete)
r.Post("/users/{id}/disable", handlers.User.Disable)
r.Post("/users/{id}/enable", handlers.User.Enable)
r.Get("/devices", handlers.Device.ListAll)
@@ -60,6 +62,8 @@ func NewRouter(jwtSecret string, handlers Handlers) http.Handler {
r.Post("/devices/{id}/rotate", handlers.Device.Rotate)
r.Get("/policies", handlers.Policy.List)
r.Post("/policies", handlers.Policy.Create)
r.Patch("/policies/{id}", handlers.Policy.Update)
r.Delete("/policies/{id}", handlers.Policy.Delete)
r.Get("/gateways", handlers.Gateway.List)
r.Get("/gateways/{id}/sync", handlers.Gateway.SyncBundle)
r.Patch("/gateways/{id}", handlers.Gateway.Update)