Fix otaceni fotek, drobny refaktoring

This commit is contained in:
Michal Kváček
2023-10-15 14:24:57 +02:00
parent bc258efa3a
commit 322e61bce3
8 changed files with 25 additions and 30 deletions
+1 -7
View File
@@ -47,10 +47,4 @@ class EventMutation:
@strawberry.mutation
@authenticated_user_only()
async def edit_event(root, info, id: int, input: EditEventInput) -> Event:
async with get_session() as db:
event = (await db.scalars(
EventQueryResolver().get_query(user_id=info.context.user_id, object_id=id)
)).one()
updated_event = await models.Event.update(db, obj=event, data=input.to_dict())
return Event(**updated_event.as_dict())
return await BaseMutationResolver(Event, models.Event).update(id, input, info.context.user_id)