Introduced groups and added all related endpoints
All checks were successful
AWS Deploy on Push / build (push) Successful in 7m39s
All checks were successful
AWS Deploy on Push / build (push) Successful in 7m39s
This commit is contained in:
@@ -53,12 +53,54 @@ class ChannelURLResponse(ChannelURLBase):
|
||||
pass
|
||||
|
||||
|
||||
# New Group Schemas
|
||||
class GroupCreate(BaseModel):
|
||||
"""Pydantic model for creating groups"""
|
||||
|
||||
name: str
|
||||
sort_order: int = Field(default=0, ge=0)
|
||||
|
||||
|
||||
class GroupUpdate(BaseModel):
|
||||
"""Pydantic model for updating groups"""
|
||||
|
||||
name: Optional[str] = None
|
||||
sort_order: Optional[int] = Field(None, ge=0)
|
||||
|
||||
|
||||
class GroupResponse(BaseModel):
|
||||
"""Pydantic model for group responses"""
|
||||
|
||||
id: UUID
|
||||
name: str
|
||||
sort_order: int
|
||||
created_at: datetime
|
||||
updated_at: datetime
|
||||
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
|
||||
class GroupSortUpdate(BaseModel):
|
||||
"""Pydantic model for updating a single group's sort order"""
|
||||
|
||||
sort_order: int = Field(ge=0)
|
||||
|
||||
|
||||
class GroupBulkSort(BaseModel):
|
||||
"""Pydantic model for bulk updating group sort orders"""
|
||||
|
||||
groups: list[dict] = Field(
|
||||
description="List of dicts with group_id and new sort_order",
|
||||
json_schema_extra={"example": [{"group_id": "uuid", "sort_order": 1}]},
|
||||
)
|
||||
|
||||
|
||||
class ChannelCreate(BaseModel):
|
||||
"""Pydantic model for creating channels"""
|
||||
|
||||
urls: list[ChannelURLCreate] # List of URL objects with priority
|
||||
name: str
|
||||
group_title: str
|
||||
group_id: UUID
|
||||
tvg_id: str
|
||||
tvg_logo: str
|
||||
tvg_name: str
|
||||
@@ -76,7 +118,7 @@ class ChannelUpdate(BaseModel):
|
||||
"""Pydantic model for updating channels (all fields optional)"""
|
||||
|
||||
name: Optional[str] = Field(None, min_length=1)
|
||||
group_title: Optional[str] = Field(None, min_length=1)
|
||||
group_id: Optional[UUID] = None
|
||||
tvg_id: Optional[str] = Field(None, min_length=1)
|
||||
tvg_logo: Optional[str] = None
|
||||
tvg_name: Optional[str] = Field(None, min_length=1)
|
||||
@@ -87,7 +129,7 @@ class ChannelResponse(BaseModel):
|
||||
|
||||
id: UUID
|
||||
name: str
|
||||
group_title: str
|
||||
group_id: UUID
|
||||
tvg_id: str
|
||||
tvg_logo: str
|
||||
tvg_name: str
|
||||
|
||||
Reference in New Issue
Block a user