Error logging, uprava dotazovani na seznam letu u kopilota
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user