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):
|
2023-10-06 06:24:31 +00:00
|
|
|
return value.isoformat()
|
2023-10-04 21:43:07 +00:00
|
|
|
|
2023-10-04 21:46:16 +00:00
|
|
|
query = QueryType()
|
2023-10-06 06:24:31 +00:00
|
|
|
|
|
|
|
@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()
|
2023-10-06 06:24:31 +00:00
|
|
|
|
|
|
|
resolvers = [query, mutation, datetime_scalar]
|