f5d6745ed0
Full-stack IPTV management system with Xtream Codes API compatibility, multi-account provider fan-out, Jellyfin local library integration, real-time dashboard, EPG support, and A/V-sync-safe stream recovery.
30 lines
1.2 KiB
Python
30 lines
1.2 KiB
Python
from sqlalchemy import Column, Integer, String, Boolean, DateTime, Enum, ForeignKey, func
|
|
from sqlalchemy.orm import relationship
|
|
from ..database import Base
|
|
from .channel import ContentType
|
|
|
|
|
|
class CustomCategory(Base):
|
|
__tablename__ = "custom_categories"
|
|
|
|
id = Column(Integer, primary_key=True, index=True)
|
|
name = Column(String(200), nullable=False)
|
|
type = Column(Enum(ContentType), nullable=False)
|
|
position = Column(Integer, default=0, nullable=False)
|
|
is_visible = Column(Boolean, default=True, nullable=False)
|
|
created_at = Column(DateTime(timezone=True), server_default=func.now())
|
|
|
|
items = relationship("CustomCategoryItem", back_populates="category", cascade="all, delete-orphan")
|
|
|
|
|
|
class CustomCategoryItem(Base):
|
|
__tablename__ = "custom_category_items"
|
|
|
|
id = Column(Integer, primary_key=True, index=True)
|
|
custom_category_id = Column(Integer, ForeignKey("custom_categories.id"), nullable=False)
|
|
channel_id = Column(Integer, ForeignKey("channels.id"), nullable=False)
|
|
position = Column(Integer, default=0, nullable=False)
|
|
|
|
category = relationship("CustomCategory", back_populates="items")
|
|
channel = relationship("Channel")
|