feat: Enhance admin user management system

- Add admin override capability to DELETE /api/auth/account endpoint
- Move /api/auth/users to admin-only with complete user fields (first_name, last_name, role, theme)
- Consolidate Bruno requests: remove duplicate List Users (Admin), merge Delete Account functionality
- Update all documentation to reflect enhanced capabilities
- Implement pgx 5 standards compliance with proper error handling

BREAKING CHANGES:
- /api/auth/users endpoint now requires admin role (was previously accessible)
- DELETE /api/auth/account accepts optional user_id parameter for admin deletion
This commit is contained in:
2026-01-27 13:36:11 -05:00
parent 9262a35f68
commit 71584c1b55
11 changed files with 345 additions and 52 deletions
+2 -2
View File
@@ -70,10 +70,10 @@ func main() {
protected := e.Group("/api", jwtMiddleware)
protected.GET("/auth/profile", authHandler.GetProfile)
protected.PUT("/auth/profile", authHandler.UpdateProfile)
protected.GET("/auth/users", authHandler.ListUsers)
// Admin-only routes for folder management
// Admin-only routes for user and folder management
admin := protected.Group("/auth", handlers.AdminMiddleware)
admin.GET("/users", authHandler.ListUsers)
admin.POST("/ebook-folders", authHandler.AddEbookFolder)
admin.GET("/ebook-folders", authHandler.GetEbookFolders)
admin.DELETE("/ebook-folders", authHandler.DeleteEbookFolder)