Lepsi stahovani informaci o pocasi

This commit is contained in:
Michal Kváček
2024-09-30 06:43:11 +02:00
parent 186dbd0720
commit ca3f6ef07c
14 changed files with 198 additions and 96 deletions
@@ -116,14 +116,14 @@ class BaseMutationResolver(BaseResolver):
async with get_session() as db:
return await self._do_create(db, input_data)
async def update(self, id: int, data: BaseGraphqlInputType, user_id: int) -> GQL_TYPE:
async def update(self, context, id: int, data: BaseGraphqlInputType, user_id: int) -> GQL_TYPE:
async with get_session() as db:
item = await self._get_one(db, id, user_id)
return await self._do_update(db, item, data.to_dict())
async def delete(self, user_id: int, id: int, **kwargs) -> GQL_TYPE:
async def delete(self, context, id: int, **kwargs) -> GQL_TYPE:
async with get_session() as db:
model = await self._get_one(db, id, user_id)
model = await self._get_one(db, id, context.user_id)
if hasattr(self.model, "deleted"):
model = await self.model.update(db, obj=model, data=dict(deleted=True))