Added PostgreSQL RDS database. Added channels protected endpoints. Added scripts and docker config to run application locally in dev mode.
Some checks failed
AWS Deploy on Push / build (push) Failing after 41s
Some checks failed
AWS Deploy on Push / build (push) Failing after 41s
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
from .db import Base, ChannelDB
|
||||
from .schemas import ChannelCreate, ChannelResponse
|
||||
|
||||
__all__ = ["Base", "ChannelDB", "ChannelCreate", "ChannelResponse"]
|
||||
18
app/models/db.py
Normal file
18
app/models/db.py
Normal file
@@ -0,0 +1,18 @@
|
||||
from datetime import datetime, timezone
|
||||
from sqlalchemy import Column, String, JSON, DateTime
|
||||
from sqlalchemy.ext.declarative import declarative_base
|
||||
|
||||
Base = declarative_base()
|
||||
|
||||
class ChannelDB(Base):
|
||||
"""SQLAlchemy model for IPTV channels"""
|
||||
__tablename__ = "channels"
|
||||
|
||||
tvg_id = Column(String, primary_key=True)
|
||||
name = Column(String, nullable=False)
|
||||
group_title = Column(String)
|
||||
tvg_name = Column(String)
|
||||
tvg_logo = Column(String)
|
||||
urls = Column(JSON) # Stores list of URLs as JSON
|
||||
created_at = Column(DateTime, default=lambda: datetime.now(timezone.utc))
|
||||
updated_at = Column(DateTime, default=lambda: datetime.now(timezone.utc), onupdate=lambda: datetime.now(timezone.utc))
|
||||
17
app/models/schemas.py
Normal file
17
app/models/schemas.py
Normal file
@@ -0,0 +1,17 @@
|
||||
from datetime import datetime
|
||||
from typing import List
|
||||
from pydantic import BaseModel
|
||||
|
||||
class ChannelCreate(BaseModel):
|
||||
"""Pydantic model for creating channels"""
|
||||
urls: List[str]
|
||||
name: str
|
||||
group_title: str
|
||||
tvg_id: str
|
||||
tvg_logo: str
|
||||
tvg_name: str
|
||||
|
||||
class ChannelResponse(ChannelCreate):
|
||||
"""Pydantic model for channel responses"""
|
||||
created_at: datetime
|
||||
updated_at: datetime
|
||||
Reference in New Issue
Block a user