core/services/schema.py

24 lines
500 B
Python
Raw Normal View History

2023-10-05 21:34:08 +00:00
from ariadne import MutationType, QueryType, ScalarType
2021-08-01 11:40:24 +00:00
2021-07-02 09:16:43 +00:00
datetime_scalar = ScalarType("DateTime")
2022-09-03 10:50:14 +00:00
2021-07-02 09:16:43 +00:00
@datetime_scalar.serializer
def serialize_datetime(value):
2022-09-03 10:50:14 +00:00
return value.isoformat()
2021-07-02 09:16:43 +00:00
query = QueryType()
@query.field("_service")
def resolve_service(*_):
# Load the full SDL from your SDL file
2023-10-06 09:05:01 +00:00
with open("schemas/core.graphql", "r") as file:
full_sdl = file.read()
return {"sdl": full_sdl}
mutation = MutationType()
2023-10-05 21:34:08 +00:00
resolvers = [query, mutation, datetime_scalar]