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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user