add database and add model
parent
2b8c4472c4
commit
7ecb3901e3
|
@ -0,0 +1,18 @@
|
||||||
|
from fastapi import APIRouter, Path
|
||||||
|
|
||||||
|
router = APIRouter(prefix="/update")
|
||||||
|
|
||||||
|
|
||||||
|
@router.get('/check/{program_name}')
|
||||||
|
def check_update(program_name: str = Path()):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
@router.get('/download/{program_name}')
|
||||||
|
def download_latest_update(program_name: str = Path()):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
@router.get("/download/{program_name}/{version}")
|
||||||
|
def download_specific_version(program_name: str = Path(), version: str = Path()):
|
||||||
|
pass
|
|
@ -0,0 +1,12 @@
|
||||||
|
import abc
|
||||||
|
from config import Settings
|
||||||
|
|
||||||
|
|
||||||
|
class ExternalService(abc.ABC):
|
||||||
|
@abc.abstractmethod
|
||||||
|
async def connect(self, config: Settings):
|
||||||
|
raise NotImplemented()
|
||||||
|
|
||||||
|
@abc.abstractmethod
|
||||||
|
async def get_session(self):
|
||||||
|
raise NotImplemented()
|
|
@ -5,9 +5,10 @@ from database import Base
|
||||||
|
|
||||||
|
|
||||||
class MPUpdate(Base):
|
class MPUpdate(Base):
|
||||||
|
__tablename__ = "MP_UPDATE"
|
||||||
id: Mapped[int] = mapped_column(autoincrement=True, primary_key=True)
|
id: Mapped[int] = mapped_column(autoincrement=True, primary_key=True)
|
||||||
version: Mapped[str] = mapped_column(nullable=False)
|
version: Mapped[str] = mapped_column(nullable=False)
|
||||||
program_id: Mapped[int] = mapped_column(ForeignKey("MPProgram.id", ondelete="CASCADE"))
|
program_id: Mapped[int] = mapped_column(ForeignKey("MP_PROGRAM.id", ondelete="CASCADE"))
|
||||||
description: Mapped[str | None] = mapped_column(nullable=True)
|
description: Mapped[str | None] = mapped_column(nullable=True)
|
||||||
download_link_android: Mapped[str | None] = mapped_column(nullable=True)
|
download_link_android: Mapped[str | None] = mapped_column(nullable=True)
|
||||||
download_link_ios: Mapped[str | None] = mapped_column(nullable=True)
|
download_link_ios: Mapped[str | None] = mapped_column(nullable=True)
|
||||||
|
@ -15,5 +16,15 @@ class MPUpdate(Base):
|
||||||
|
|
||||||
|
|
||||||
class MPProgram(Base):
|
class MPProgram(Base):
|
||||||
|
__tablename__ = "MP_PROGRAM"
|
||||||
id: Mapped[int] = mapped_column(autoincrement=True, primary_key=True)
|
id: Mapped[int] = mapped_column(autoincrement=True, primary_key=True)
|
||||||
name: Mapped[str]
|
name: Mapped[str]
|
||||||
|
|
||||||
|
|
||||||
|
class MPUser(Base):
|
||||||
|
__tablename__ = "MP_USER"
|
||||||
|
id: Mapped[int] = mapped_column(autoincrement=True, primary_key=True)
|
||||||
|
username: Mapped[str] = mapped_column(nullable=False)
|
||||||
|
email: Mapped[str] = mapped_column(nullable=False)
|
||||||
|
password: Mapped[str] = mapped_column(nullable=False)
|
||||||
|
is_active: Mapped[bool] = mapped_column(nullable=False)
|
||||||
|
|
Loading…
Reference in New Issue