Error logging, uprava dotazovani na seznam letu u kopilota

This commit is contained in:
Michal Kváček
2023-11-07 17:45:26 +01:00
parent e3ab6ba7f0
commit bd5b84c9e7
17 changed files with 88 additions and 136 deletions
+5
View File
@@ -1,6 +1,7 @@
from typing import List
import strawberry
from decorators.endpoints import authenticated_user_only
from decorators.error_logging import error_logging
from .resolvers.aircraft import AircraftMutationResolver, AircraftQueryResolver
from graphql_schema.entities.types.mutation_input import CreateAircraftInput, EditAircraftInput
from graphql_schema.entities.types.types import Aircraft
@@ -9,6 +10,7 @@ from graphql_schema.entities.types.types import Aircraft
@strawberry.type
class AircraftQueries:
@strawberry.field()
@error_logging
@authenticated_user_only()
async def aircrafts(root, info) -> List[Aircraft]:
return await AircraftQueryResolver().get_list(
@@ -17,6 +19,7 @@ class AircraftQueries:
)
@strawberry.field()
@error_logging
@authenticated_user_only()
async def aircraft(root, info, id: int) -> Aircraft:
return await AircraftQueryResolver().get_one(
@@ -27,11 +30,13 @@ class AircraftQueries:
@strawberry.type
class AircraftMutation:
@strawberry.mutation
@error_logging
@authenticated_user_only()
async def create_aircraft(root, info, input: CreateAircraftInput) -> Aircraft:
return await AircraftMutationResolver().create_new(input, info.context.user_id)
@strawberry.mutation
@error_logging
@authenticated_user_only()
async def edit_aircraft(root, info, id: int, input: EditAircraftInput) -> Aircraft:
return await AircraftMutationResolver().edit(id, user_id=info.context.user_id, data=input)