fixed tests
This commit is contained in:
@@ -276,6 +276,51 @@ async def remove_from_queue(
|
||||
)
|
||||
|
||||
|
||||
@router.delete("/", status_code=status.HTTP_204_NO_CONTENT)
|
||||
async def remove_multiple_from_queue(
|
||||
request: QueueOperationRequest,
|
||||
_: dict = Depends(require_auth),
|
||||
download_service: DownloadService = Depends(get_download_service),
|
||||
):
|
||||
"""Remove multiple items from the download queue.
|
||||
|
||||
Removes multiple download items from the queue based on provided IDs.
|
||||
Items that are currently downloading will be cancelled.
|
||||
|
||||
Requires authentication.
|
||||
|
||||
Args:
|
||||
request: Request containing list of item IDs to remove
|
||||
|
||||
Raises:
|
||||
HTTPException: 401 if not authenticated, 404 if no items found,
|
||||
500 on service error
|
||||
"""
|
||||
try:
|
||||
removed_ids = await download_service.remove_from_queue(
|
||||
request.item_ids
|
||||
)
|
||||
|
||||
if not removed_ids:
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_404_NOT_FOUND,
|
||||
detail="No matching items found in queue",
|
||||
)
|
||||
|
||||
except DownloadServiceError as e:
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_400_BAD_REQUEST,
|
||||
detail=str(e),
|
||||
)
|
||||
except HTTPException:
|
||||
raise
|
||||
except Exception as e:
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR,
|
||||
detail=f"Failed to remove items from queue: {str(e)}",
|
||||
)
|
||||
|
||||
|
||||
@router.post("/start", status_code=status.HTTP_200_OK)
|
||||
async def start_queue(
|
||||
_: dict = Depends(require_auth),
|
||||
@@ -423,8 +468,7 @@ async def reorder_queue(
|
||||
500 on service error
|
||||
"""
|
||||
try:
|
||||
# For now, this is a no-op that returns success
|
||||
# A full implementation would reorder the pending queue
|
||||
await download_service.reorder_queue(request.item_ids)
|
||||
return {
|
||||
"status": "success",
|
||||
"message": f"Queue reordered with {len(request.item_ids)} items",
|
||||
|
||||
Reference in New Issue
Block a user