feat: enhance Letzshop order import with EAN matching and stats
- Add historical order import with pagination support - Add customer_locale, shipping_country_iso, billing_country_iso columns - Add gtin/gtin_type columns to Product table for EAN matching - Fix order stats to count all orders server-side (not just visible page) - Add GraphQL introspection script with tracking workaround tests - Enrich inventory units with EAN, MPN, SKU, product name - Add LetzshopOrderStats schema for proper status counts Migrations: - a9a86cef6cca: Add locale and country fields to letzshop_orders - cb88bc9b5f86: Add gtin columns to products table 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
"""add_letzshop_order_locale_and_country_fields
|
||||
|
||||
Revision ID: a9a86cef6cca
|
||||
Revises: fcfdc02d5138
|
||||
Create Date: 2025-12-17 20:55:41.477848
|
||||
|
||||
"""
|
||||
from typing import Sequence, Union
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision: str = 'a9a86cef6cca'
|
||||
down_revision: Union[str, None] = 'fcfdc02d5138'
|
||||
branch_labels: Union[str, Sequence[str], None] = None
|
||||
depends_on: Union[str, Sequence[str], None] = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
# Add new columns to letzshop_orders for customer locale and country
|
||||
op.add_column('letzshop_orders', sa.Column('customer_locale', sa.String(length=10), nullable=True))
|
||||
op.add_column('letzshop_orders', sa.Column('shipping_country_iso', sa.String(length=5), nullable=True))
|
||||
op.add_column('letzshop_orders', sa.Column('billing_country_iso', sa.String(length=5), nullable=True))
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
op.drop_column('letzshop_orders', 'billing_country_iso')
|
||||
op.drop_column('letzshop_orders', 'shipping_country_iso')
|
||||
op.drop_column('letzshop_orders', 'customer_locale')
|
||||
@@ -0,0 +1,37 @@
|
||||
"""add_gtin_columns_to_product_table
|
||||
|
||||
Revision ID: cb88bc9b5f86
|
||||
Revises: a9a86cef6cca
|
||||
Create Date: 2025-12-18 20:54:55.185857
|
||||
|
||||
"""
|
||||
from typing import Sequence, Union
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision: str = 'cb88bc9b5f86'
|
||||
down_revision: Union[str, None] = 'a9a86cef6cca'
|
||||
branch_labels: Union[str, Sequence[str], None] = None
|
||||
depends_on: Union[str, Sequence[str], None] = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
# Add GTIN (EAN/UPC barcode) columns to products table for order EAN matching
|
||||
# gtin: The barcode number (e.g., "0889698273022")
|
||||
# gtin_type: The format type from Letzshop (e.g., "gtin13", "gtin14", "isbn13")
|
||||
op.add_column('products', sa.Column('gtin', sa.String(length=50), nullable=True))
|
||||
op.add_column('products', sa.Column('gtin_type', sa.String(length=20), nullable=True))
|
||||
|
||||
# Add index for EAN lookups during order matching
|
||||
op.create_index('idx_product_gtin', 'products', ['gtin'], unique=False)
|
||||
op.create_index('idx_product_vendor_gtin', 'products', ['vendor_id', 'gtin'], unique=False)
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
op.drop_index('idx_product_vendor_gtin', table_name='products')
|
||||
op.drop_index('idx_product_gtin', table_name='products')
|
||||
op.drop_column('products', 'gtin_type')
|
||||
op.drop_column('products', 'gtin')
|
||||
Reference in New Issue
Block a user