From edf76708b3873cd57d75e728202bc498003aa4de Mon Sep 17 00:00:00 2001 From: zman Date: Mon, 10 Feb 2025 19:53:47 -0500 Subject: [PATCH] box bug --- app/routes/routes.py | 2 +- app/services/box.py | 1 + requests.md | 11 ++++------- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/app/routes/routes.py b/app/routes/routes.py index 7376804..4371ce9 100644 --- a/app/routes/routes.py +++ b/app/routes/routes.py @@ -291,7 +291,7 @@ async def update_cookies( ): try: # see if cookie file exists - if not os.path.exists('cookies') and os.path.exists('cookies/tcg_cookies.json'): + if not os.path.exists('cookies') or os.path.exists('cookies/tcg_cookies.json'): logger.info("Cannot find cookies") # Create cookies directory if it doesn't exist os.makedirs('cookies', exist_ok=True) diff --git a/app/services/box.py b/app/services/box.py index 573e887..e3427cd 100644 --- a/app/services/box.py +++ b/app/services/box.py @@ -94,6 +94,7 @@ class BoxService: num_cards_expected=create_box_data.num_cards_expected ) self.db.add(product) + self.db.flush() self.db.add(box) return box, True diff --git a/requests.md b/requests.md index 0a4e313..68ed031 100644 --- a/requests.md +++ b/requests.md @@ -5,13 +5,10 @@ curl -J -X POST \ -H "Content-Type: application/json" \ http://192.168.1.41:8000/api/tcgplayer/inventory/add --remote-name curl -X POST http://192.168.1.41:8000/api/boxes \ --H "Content-Type: application/json" \ --d '{ - "type": "collector", - "set_code": "MOM", - "sku": "ABC123", - "num_cards_expected": 15 -}' +-F "type=draft" \ +-F "set_code=WOE" \ +-F "sku=195166231631" \ +-F "num_cards_expected=540" curl -X POST http://192.168.1.41:8000/api/boxes/box123/open \ -H "Content-Type: application/json" \