shop product refactoring
This commit is contained in:
@@ -20,9 +20,9 @@ class MarketplaceImportJob(Base, TimestampMixin):
|
||||
marketplace = Column(
|
||||
String, nullable=False, index=True, default="Letzshop"
|
||||
) # Index for marketplace filtering
|
||||
shop_name = Column(String, nullable=False, index=True) # Index for shop filtering
|
||||
shop_id = Column(
|
||||
Integer, ForeignKey("shops.id"), nullable=False
|
||||
vendor_name = Column(String, nullable=False, index=True) # Index for vendor filtering
|
||||
vendor_id = Column(
|
||||
Integer, ForeignKey("vendors.id"), nullable=False
|
||||
) # Add proper foreign key
|
||||
user_id = Column(
|
||||
Integer, ForeignKey("users.id"), nullable=False
|
||||
@@ -44,19 +44,19 @@ class MarketplaceImportJob(Base, TimestampMixin):
|
||||
|
||||
# Relationship to user
|
||||
user = relationship("User", foreign_keys=[user_id])
|
||||
shop = relationship("Shop", back_populates="marketplace_import_jobs")
|
||||
vendor = relationship("Vendor", back_populates="marketplace_import_jobs")
|
||||
|
||||
# Additional indexes for marketplace import job queries
|
||||
__table_args__ = (
|
||||
Index(
|
||||
"idx_marketplace_import_user_marketplace", "user_id", "marketplace"
|
||||
), # User's marketplace imports
|
||||
Index("idx_marketplace_import_shop_status", "status"), # Shop import status
|
||||
Index("idx_marketplace_import_shop_id", "shop_id"),
|
||||
Index("idx_marketplace_import_vendor_status", "status"), # Vendor import status
|
||||
Index("idx_marketplace_import_vendor_id", "vendor_id"),
|
||||
)
|
||||
|
||||
def __repr__(self):
|
||||
return (
|
||||
f"<MarketplaceImportJob(id={self.id}, marketplace='{self.marketplace}', shop='{self.shop_name}', "
|
||||
f"<MarketplaceImportJob(id={self.id}, marketplace='{self.marketplace}', vendor='{self.vendor_name}', "
|
||||
f"status='{self.status}', imported={self.imported_count})>"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user