fix: add validation for empty media_item_id in bulk update

Add strict validation to return 400 Bad Request when any media_item_id
is empty in the bulk-update request, rather than treating it as a
partial failure with 200 OK.

This aligns the handler behavior with test expectations for the
BulkUpdateBooks_EmptyBookIDs test case.
This commit is contained in:
2026-02-10 20:51:23 -05:00
parent 0022f75a73
commit bddb411a3d
+6
View File
@@ -439,6 +439,12 @@ func (h *MediaHandler) HandleBulkUpdate(c echo.Context) error {
return c.JSON(http.StatusBadRequest, map[string]string{"error": "media_item_updates required"})
}
for _, update := range req.MediaItemUpdates {
if update.MediaItemID == "" {
return c.JSON(http.StatusBadRequest, map[string]string{"error": "media_item_id cannot be empty"})
}
}
results := make([]map[string]interface{}, 0)
successCount := 0
failedCount := 0