mirror of
https://github.com/StepanovPlaton/torrent_backend.git
synced 2026-04-03 20:30:38 +04:00
Add file upload
This commit is contained in:
@@ -5,7 +5,9 @@ from .. import models as mdl
|
||||
from .. import schemas as sch
|
||||
from ..database import add_transaction
|
||||
|
||||
async def add_game(db: AsyncSession, game_info: sch.GameCreate, user_id: int):
|
||||
async def add_game(db: AsyncSession,
|
||||
game_info: sch.GameCreate,
|
||||
user_id: int):
|
||||
game = mdl.Game(**game_info.model_dump(), owner_id=user_id)
|
||||
return await add_transaction(db, game)
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ class Game(Base):
|
||||
|
||||
id = Column(Integer, primary_key=True)
|
||||
cover = Column(String)
|
||||
title = Column(String, nullable=False)
|
||||
title = Column(String, nullable=False, unique=True)
|
||||
description = Column(String)
|
||||
torrent_file = Column(String, nullable=False)
|
||||
language = Column(String)
|
||||
|
||||
@@ -2,8 +2,8 @@ from pydantic import BaseModel
|
||||
|
||||
|
||||
class GameBase(BaseModel):
|
||||
cover: str | None = None
|
||||
title: str
|
||||
cover: str | None = None
|
||||
description: str | None = None
|
||||
torrent_file: str
|
||||
language: str | None = None
|
||||
|
||||
Reference in New Issue
Block a user