inbox/services/schema.py

23 lines
484 B
Python
Raw Normal View History

2023-10-04 21:48:08 +00:00
from ariadne import ScalarType, QueryType, MutationType
2023-10-04 21:43:07 +00:00
datetime_scalar = ScalarType("DateTime")
2023-10-06 09:49:22 +00:00
query = QueryType()
mutation = MutationType()
2023-10-04 21:43:07 +00:00
@datetime_scalar.serializer
def serialize_datetime(value):
return value.isoformat()
2023-10-04 21:43:07 +00:00
@query.field("_service")
def resolve_service(*_):
2023-10-06 07:12:58 +00:00
# Load the full SDL from your SDL file
with open("inbox.graphql", "r") as file:
full_sdl = file.read()
2023-10-06 09:49:22 +00:00
2023-10-06 07:12:58 +00:00
return {"sdl": full_sdl}
resolvers = [query, mutation, datetime_scalar]