init
This commit is contained in:
47
backend/app/schemas/room.py
Normal file
47
backend/app/schemas/room.py
Normal file
@@ -0,0 +1,47 @@
|
||||
from pydantic import BaseModel
|
||||
from uuid import UUID
|
||||
from datetime import datetime
|
||||
from typing import Optional
|
||||
from .user import UserResponse
|
||||
from .track import TrackResponse
|
||||
|
||||
|
||||
class RoomCreate(BaseModel):
|
||||
name: str
|
||||
|
||||
|
||||
class RoomResponse(BaseModel):
|
||||
id: UUID
|
||||
name: str
|
||||
owner_id: UUID
|
||||
current_track_id: Optional[UUID] = None
|
||||
playback_position: int
|
||||
is_playing: bool
|
||||
created_at: datetime
|
||||
participants_count: int = 0
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
|
||||
|
||||
class RoomDetailResponse(BaseModel):
|
||||
id: UUID
|
||||
name: str
|
||||
owner: UserResponse
|
||||
current_track: Optional[TrackResponse] = None
|
||||
playback_position: int
|
||||
is_playing: bool
|
||||
created_at: datetime
|
||||
participants: list[UserResponse] = []
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
|
||||
|
||||
class PlayerAction(BaseModel):
|
||||
action: str # play, pause, seek, next, prev
|
||||
position: Optional[int] = None # for seek
|
||||
|
||||
|
||||
class QueueAdd(BaseModel):
|
||||
track_id: UUID
|
||||
Reference in New Issue
Block a user