fix: correct user context handling and error responses

- Fix SearchMediaItems to retrieve user object from context instead of string
- Remove redundant UUID parsing, use user.ID directly
- Add error logging for search failures with query details
- Fix JWT middleware to use echo.NewHTTPError for consistent error format
- Improves debugging and error response consistency across API
This commit is contained in:
2026-03-06 01:52:36 -05:00
parent 79690751c8
commit 2ac42a8d91
2 changed files with 12 additions and 9 deletions
+1 -1
View File
@@ -83,7 +83,7 @@ func createJWTMiddleware(cfg *Config) echo.MiddlewareFunc {
userIDStr, _ := claims["user_id"].(string)
userUUID, err := uuid.Parse(userIDStr)
if err != nil {
c.JSON(http.StatusBadRequest, map[string]string{"error": "invalid user ID in token"})
c.Error(echo.NewHTTPError(http.StatusBadRequest, "invalid user ID in token"))
return
}