Files
iptv-manager-service/app/models/schemas.py
Stefano c96ee307db
All checks were successful
AWS Deploy on Push / build (push) Successful in 1m8s
Moved channel URLs to channels_urls table. Create CRUD endpoints for new table.
2025-05-23 11:36:04 -05:00

53 lines
1.3 KiB
Python

from datetime import datetime
from typing import List
from uuid import UUID
from pydantic import BaseModel
class ChannelURLCreate(BaseModel):
"""Pydantic model for creating channel URLs"""
url: str
class ChannelURLBase(ChannelURLCreate):
"""Base Pydantic model for channel URL responses"""
id: UUID
created_at: datetime
updated_at: datetime
class Config:
from_attributes = True
class ChannelURLResponse(ChannelURLBase):
"""Pydantic model for channel URL responses"""
pass
class ChannelCreate(BaseModel):
"""Pydantic model for creating channels"""
urls: List[str] # List of URLs to create with the channel
name: str
group_title: str
tvg_id: str
tvg_logo: str
tvg_name: str
class ChannelUpdate(BaseModel):
"""Pydantic model for updating channels"""
name: str | None = None
group_title: str | None = None
tvg_id: str | None = None
tvg_logo: str | None = None
tvg_name: str | None = None
class ChannelResponse(BaseModel):
"""Pydantic model for channel responses"""
id: UUID
name: str
group_title: str
tvg_id: str
tvg_logo: str
tvg_name: str
urls: List[ChannelURLResponse] # List of URL objects without channel_id
created_at: datetime
updated_at: datetime
class Config:
from_attributes = True