marketplace refactoring
This commit is contained in:
@@ -23,10 +23,10 @@ except ImportError as e:
|
||||
print(f" ✗ User model failed: {e}")
|
||||
|
||||
try:
|
||||
from models.database.product import Product
|
||||
print(" ✓ Product model imported")
|
||||
from models.database.marketplace_product import MarketplaceProduct
|
||||
print(" ✓ MarketplaceProduct model imported")
|
||||
except ImportError as e:
|
||||
print(f" ✗ Product model failed: {e}")
|
||||
print(f" ✗ MarketplaceProduct model failed: {e}")
|
||||
|
||||
try:
|
||||
from models.database.stock import Stock
|
||||
@@ -41,7 +41,7 @@ except ImportError as e:
|
||||
print(f" ✗ Shop models failed: {e}")
|
||||
|
||||
try:
|
||||
from models.database.marketplace import MarketplaceImportJob
|
||||
from models.database.marketplace_import_job import MarketplaceImportJob
|
||||
print(" ✓ Marketplace model imported")
|
||||
except ImportError as e:
|
||||
print(f" ✗ Marketplace model failed: {e}")
|
||||
|
||||
@@ -22,7 +22,7 @@ def upgrade() -> None:
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_table('products',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('product_id', sa.String(), nullable=False),
|
||||
sa.Column('marketplace_product_id', sa.String(), nullable=False),
|
||||
sa.Column('title', sa.String(), nullable=False),
|
||||
sa.Column('description', sa.String(), nullable=True),
|
||||
sa.Column('link', sa.String(), nullable=True),
|
||||
@@ -73,7 +73,7 @@ def upgrade() -> None:
|
||||
op.create_index(op.f('ix_products_gtin'), 'products', ['gtin'], unique=False)
|
||||
op.create_index(op.f('ix_products_id'), 'products', ['id'], unique=False)
|
||||
op.create_index(op.f('ix_products_marketplace'), 'products', ['marketplace'], unique=False)
|
||||
op.create_index(op.f('ix_products_product_id'), 'products', ['product_id'], unique=True)
|
||||
op.create_index(op.f('ix_products_product_id'), 'products', ['marketplace_product_id'], unique=True)
|
||||
op.create_index(op.f('ix_products_shop_name'), 'products', ['shop_name'], unique=False)
|
||||
op.create_table('users',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
@@ -139,7 +139,7 @@ def upgrade() -> None:
|
||||
op.create_table('shop_products',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('shop_id', sa.Integer(), nullable=False),
|
||||
sa.Column('product_id', sa.Integer(), nullable=False),
|
||||
sa.Column('marketplace_product_id', sa.Integer(), nullable=False),
|
||||
sa.Column('shop_product_id', sa.String(), nullable=True),
|
||||
sa.Column('shop_price', sa.Float(), nullable=True),
|
||||
sa.Column('shop_sale_price', sa.Float(), nullable=True),
|
||||
@@ -153,10 +153,10 @@ def upgrade() -> None:
|
||||
sa.Column('max_quantity', sa.Integer(), nullable=True),
|
||||
sa.Column('created_at', sa.DateTime(), nullable=True),
|
||||
sa.Column('updated_at', sa.DateTime(), nullable=True),
|
||||
sa.ForeignKeyConstraint(['product_id'], ['products.id'], ),
|
||||
sa.ForeignKeyConstraint(['marketplace_product_id'], ['products.id'], ),
|
||||
sa.ForeignKeyConstraint(['shop_id'], ['shops.id'], ),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
sa.UniqueConstraint('shop_id', 'product_id', name='uq_shop_product')
|
||||
sa.UniqueConstraint('shop_id', 'marketplace_product_id', name='uq_shop_product')
|
||||
)
|
||||
op.create_index('idx_shop_product_active', 'shop_products', ['shop_id', 'is_active'], unique=False)
|
||||
op.create_index('idx_shop_product_featured', 'shop_products', ['shop_id', 'is_featured'], unique=False)
|
||||
|
||||
Reference in New Issue
Block a user