GPQBot
1from app.db.crud import CRUD2from app.db.sqlalchemy import AsyncSession3from app.db.models import FidbackModel4
5from app.schemas.shemas import FidbackCreate, Fidback6
7
8class FidbackRepo:9def __init__(self, session: AsyncSession):10self._crud = CRUD(session=session, cls_model=FidbackModel)11
12async def create_fidback(self, fidback_in_creation: FidbackCreate) -> Fidback:13model_data = {14"division": fidback_in_creation.division,15"subdivision": fidback_in_creation.subdivision,16"description": fidback_in_creation.discription,17}18row = await self._crud.create(model_data=model_data)19
20fidback_in_db = await self._crud.get(pkey_val=row.id)21
22return self._to_domain(fidback_in_db)23
24async def get_fidback(self, fidback_id: int) -> Fidback:25fidback_in_db = await self._crud.get(pkey_val=fidback_id)26return self._to_domain(fidback_in_db)27