inventory bug

This commit is contained in:
2025-02-10 20:12:20 -05:00
parent edf76708b3
commit c896a6ea0f
2 changed files with 25 additions and 18 deletions

View File

@@ -1,4 +1,4 @@
from fastapi import APIRouter, Depends, HTTPException, UploadFile, File, BackgroundTasks
from fastapi import APIRouter, Depends, HTTPException, UploadFile, File, BackgroundTasks, Request
from fastapi.responses import StreamingResponse
from typing import Optional, List
from io import BytesIO
@@ -232,18 +232,20 @@ async def delete_open_box(
logger.error(f"Delete open box failed: {str(e)}")
raise HTTPException(status_code=400, detail=str(e)
)
class InventoryAddRequest(BaseModel):
open_box_ids: List[str]
@router.post("/tcgplayer/inventory/add", response_class=StreamingResponse)
async def create_inventory_add_file(
request: dict, # Just use a dict instead
body: InventoryAddRequest,
pricing_service: PricingService = Depends(get_pricing_service),
):
"""Create a new inventory add file for download."""
try:
# Get IDs directly from the dict
open_box_ids = request.get('open_box_ids', [])
content = pricing_service.generate_tcgplayer_inventory_update_file_with_pricing(open_box_ids)
content = pricing_service.generate_tcgplayer_inventory_update_file_with_pricing(body.open_box_ids)
stream = BytesIO(content)
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")