39 lines
1.2 KiB
Python
39 lines
1.2 KiB
Python
from sqlalchemy import (Boolean, Column, ForeignKey, Integer, String, Text)
|
|
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 Vendor(Base, TimestampMixin):
|
|
__tablename__ = "vendors"
|
|
|
|
id = Column(Integer, primary_key=True, index=True)
|
|
vendor_code = Column(
|
|
String, unique=True, index=True, nullable=False
|
|
) # e.g., "TECHSTORE", "FASHIONHUB"
|
|
vendor_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_vendors")
|
|
product = relationship("Product", back_populates="vendor")
|
|
marketplace_import_jobs = relationship(
|
|
"MarketplaceImportJob", back_populates="vendor"
|
|
)
|