inbox/services/schema.py

21 lines
517 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")
@datetime_scalar.serializer
def serialize_datetime(value):
return value.isoformat()
2023-10-04 21:43:07 +00:00
2023-10-04 21:46:16 +00:00
query = QueryType()
@query.field("_service")
def resolve_service(*_):
print("Inside the _service resolver")
# For now, return a placeholder SDL.
sdl = "type Query { _service: _Service } type _Service { sdl: String }"
return {"sdl": sdl}
2023-10-04 21:46:16 +00:00
mutation = MutationType()
resolvers = [query, mutation, datetime_scalar]