mirror of
https://github.com/StepanovPlaton/torrent_backend.git
synced 2026-04-04 04:40:40 +04:00
Code refactoring. Add support genres and actors to routes
This commit is contained in:
20
database/crud/game_genres.py
Normal file
20
database/crud/game_genres.py
Normal file
@@ -0,0 +1,20 @@
|
||||
from time import strftime
|
||||
from sqlalchemy.ext.asyncio import AsyncSession
|
||||
|
||||
from database.database import Database, EntityCRUD
|
||||
|
||||
from .. import models as mdl
|
||||
from .. import schemas as sch
|
||||
|
||||
|
||||
class GameGenresCRUD(EntityCRUD[mdl.GameGenre]):
|
||||
|
||||
@staticmethod
|
||||
async def get_all(db: AsyncSession):
|
||||
return await Database.get_all(db, mdl.GameGenre)
|
||||
|
||||
@staticmethod
|
||||
async def add(db: AsyncSession,
|
||||
info: sch.GameGenreCreate):
|
||||
game_genre = mdl.GameGenre(**info.model_dump())
|
||||
return await Database.add(db, game_genre)
|
||||
Reference in New Issue
Block a user