Code refactoring. Add support genres and actors to routes

This commit is contained in:
2024-06-26 23:13:47 +04:00
parent fc3bcc343d
commit b9e22fcc4c
28 changed files with 545 additions and 250 deletions

View File

@@ -0,0 +1,19 @@
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 MovieGenresCRUD(EntityCRUD[mdl.MovieGenre]):
@staticmethod
async def get_all(db: AsyncSession):
return await Database.get_all(db, mdl.MovieGenre)
@staticmethod
async def add(db: AsyncSession,
info: sch.MovieGenreCreate):
movie_genre = mdl.MovieGenre(**info.model_dump())
return await Database.add(db, movie_genre)