i think most of this works lole

This commit is contained in:
2025-04-24 23:34:13 -04:00
parent 210a033695
commit 56ba750aad
50 changed files with 154001 additions and 2606 deletions

View File

@@ -93,8 +93,10 @@ class MTGJSONService(BaseExternalService):
subdir="identifiers"
)
with open(file_record.path, 'r') as f:
logger.debug(f"Loaded identifiers from MTGJSON: {file_record.path}")
json_file = await self._unzip_file(file_record, "identifiers", db)
with open(json_file.path, 'r') as f:
logger.debug(f"Loaded identifiers from MTGJSON: {json_file.path}")
return json.load(f)
async def get_skus(self, db: Session, use_cache: bool = True) -> Dict[str, Any]:
@@ -115,8 +117,10 @@ class MTGJSONService(BaseExternalService):
subdir="skus"
)
with open(file_record.path, 'r') as f:
logger.debug(f"Loaded SKUs from MTGJSON: {file_record.path}")
json_file = await self._unzip_file(file_record, "skus", db)
with open(json_file.path, 'r') as f:
logger.debug(f"Loaded SKUs from MTGJSON: {json_file.path}")
return json.load(f)
async def clear_cache(self, db: Session) -> None:

View File

@@ -16,6 +16,7 @@ from app.models.tcgplayer_order import (
TCGPlayerOrderProduct,
TCGPlayerOrderRefund
)
from app.models.tcgplayer_products import TCGPlayerProduct
from sqlalchemy.orm import Session
from app.db.database import transaction
import os
@@ -190,8 +191,7 @@ class OrderManagementService(BaseTCGPlayerService):
direct_fee_amount=api_order.transaction.directFeeAmount,
taxes=[{"code": t.code, "amount": t.amount} for t in api_order.transaction.taxes]
)
# Create products
# Create products
db_products = [
TCGPlayerOrderProductCreate(
order_number=api_order.orderNumber,
@@ -376,8 +376,8 @@ class OrderManagementService(BaseTCGPlayerService):
('extended_price', 'extendedPrice'),
('quantity', 'quantity'),
('url', 'url'),
('product_id', 'productId'),
('sku_id', 'skuId')
('tcgplayer_product_id', 'productId'),
('tcgplayer_sku_id', 'skuId')
]
for db_field, api_field in product_fields_to_compare: