from sqlalchemy import Column, Integer, String, Float, Boolean, DateTime, ForeignKey, func from sqlalchemy.orm import relationship from app.db.base import Base class Beat(Base): __tablename__ = "beats" id = Column(Integer, primary_key=True, index=True) title = Column(String, nullable=False) description = Column(String) price = Column(Float, nullable=False) genre = Column(String, nullable=False) bpm = Column(Integer) key = Column(String) file_path = Column(String, nullable=False) preview_path = Column(String) artwork_path = Column(String) is_available = Column(Boolean, default=True) producer_id = Column(Integer, ForeignKey("users.id"), nullable=False) created_at = Column(DateTime, default=func.now()) updated_at = Column(DateTime, default=func.now(), onupdate=func.now()) producer = relationship("User", back_populates="beats")