feat(handlers): implement consolidated user profile endpoints

Implement DeleteUser, ResetUserPassword, and UpdateUserAdmin handlers.
Update collections handler to check soft-deleted users. Update dashboard
service to exclude deleted users from statistics.
This commit is contained in:
2026-02-22 01:57:49 -05:00
parent e3a3aa124f
commit bb0970dfd0
4 changed files with 293 additions and 42 deletions
+9
View File
@@ -12,6 +12,7 @@ import (
"time"
"github.com/google/uuid"
"github.com/jackc/pgx/v5"
"github.com/jackc/pgx/v5/pgtype"
"github.com/labstack/echo/v4"
)
@@ -848,6 +849,14 @@ func (h *CollectionHandler) PreviewCollection(c echo.Context) error {
return c.JSON(http.StatusBadRequest, map[string]string{"error": "invalid library_id"})
}
_, err = h.db.GetLibrary(c.Request().Context(), pgtype.UUID{Bytes: libUUID, Valid: true})
if err != nil {
if err == pgx.ErrNoRows {
return c.JSON(http.StatusBadRequest, map[string]string{"error": "library not found"})
}
return c.JSON(http.StatusInternalServerError, map[string]string{"error": err.Error()})
}
if req.Limit <= 0 || req.Limit > 100 {
req.Limit = 20
}