add database and add model

main
Ernest Litvinenko 2024-07-15 18:39:41 +03:00
parent 2b8c4472c4
commit 7ecb3901e3
7 changed files with 42 additions and 1 deletions

View File

View File

@ -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
core/external/__init__.py vendored Normal file
View File

12
core/external/base.py vendored Normal file
View File

@ -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()

0
core/external/s3.py vendored Normal file
View File

0
core/graphql/__init__.py Normal file
View File

View File

@ -5,9 +5,10 @@ from database import Base
class MPUpdate(Base):
__tablename__ = "MP_UPDATE"
id: Mapped[int] = mapped_column(autoincrement=True, primary_key=True)
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)
download_link_android: 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):
__tablename__ = "MP_PROGRAM"
id: Mapped[int] = mapped_column(autoincrement=True, primary_key=True)
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)