25 lines
1.0 KiB
Python
25 lines
1.0 KiB
Python
from sqlalchemy import Column, String, Float, Boolean, Integer, DateTime, ForeignKey
|
|
from sqlalchemy.sql import func
|
|
from ..db.database import Base
|
|
|
|
class SharePlayRoom(Base):
|
|
__tablename__ = "shareplay_rooms"
|
|
|
|
id = Column(String, primary_key=True, index=True)
|
|
creator_user = Column(String, nullable=False)
|
|
created_at = Column(DateTime(timezone=True), server_default=func.now())
|
|
current_song_id = Column(String, ForeignKey("songs.id"))
|
|
position_sec = Column(Float, default=0)
|
|
is_playing = Column(Boolean, default=False)
|
|
shuffle_mode = Column(Boolean, default=False)
|
|
active_connections = Column(Integer, default=0)
|
|
|
|
class SharePlayCue(Base):
|
|
__tablename__ = "shareplay_cue"
|
|
|
|
id = Column(String, primary_key=True, index=True)
|
|
room_id = Column(String, ForeignKey("shareplay_rooms.id"), nullable=False)
|
|
song_id = Column(String, ForeignKey("songs.id"), nullable=False)
|
|
position = Column(Integer, default=0)
|
|
added_by = Column(String)
|
|
added_at = Column(DateTime(timezone=True), server_default=func.now()) |