42 lines
1.3 KiB
Python
42 lines
1.3 KiB
Python
from datetime import datetime
|
|
|
|
from sqlalchemy import (Boolean, Column, DateTime, Float, ForeignKey, Index,
|
|
Integer, String, Text, UniqueConstraint)
|
|
from sqlalchemy.orm import relationship
|
|
|
|
# Import Base from the central database module instead of creating a new one
|
|
from app.core.database import Base
|
|
from models.database.base import TimestampMixin
|
|
|
|
|
|
class Shop(Base, TimestampMixin):
|
|
__tablename__ = "shops"
|
|
|
|
id = Column(Integer, primary_key=True, index=True)
|
|
shop_code = Column(
|
|
String, unique=True, index=True, nullable=False
|
|
) # e.g., "TECHSTORE", "FASHIONHUB"
|
|
shop_name = Column(String, nullable=False) # Display name
|
|
description = Column(Text)
|
|
owner_id = Column(Integer, ForeignKey("users.id"), nullable=False)
|
|
|
|
# Contact information
|
|
contact_email = Column(String)
|
|
contact_phone = Column(String)
|
|
website = Column(String)
|
|
|
|
# Business information
|
|
business_address = Column(Text)
|
|
tax_number = Column(String)
|
|
|
|
# Status
|
|
is_active = Column(Boolean, default=True)
|
|
is_verified = Column(Boolean, default=False)
|
|
|
|
# Relationships
|
|
owner = relationship("User", back_populates="owned_shops")
|
|
product = relationship("Product", back_populates="shop")
|
|
marketplace_import_jobs = relationship(
|
|
"MarketplaceImportJob", back_populates="shop"
|
|
)
|