Closed Emsu closed 6 years ago
@syrusakbary so far the above is working for me. Might be nice to add it in since it's an NDB supported property. Or I could open a PR with the one line change?
Just listing what ended up doing
diff --git a/api/lib/graphene_gae/ndb/converter.py b/api/lib/graphene_gae/ndb/converter.py
index 2450cd7..d580c06 100644
--- a/api/lib/graphene_gae/ndb/converter.py
+++ b/api/lib/graphene_gae/ndb/converter.py
@@ -6,7 +6,7 @@ from google.appengine.ext import ndb
from graphene import String, Boolean, Int, Float, List, NonNull, Field, Dynamic
from graphene.types.json import JSONString
-from graphene.types.datetime import DateTime
+from graphene.types.datetime import DateTime, Time
from .fields import DynamicNdbKeyStringField, DynamicNdbKeyReferenceField
@@ -60,6 +60,10 @@ def convert_ndb_datetime_property(ndb_prop):
return Field(DateTime, description=ndb_prop._name)
+def convert_ndb_time_property(ndb_prop):
+ return Field(Time, description=ndb_prop._name)
+
+
def convert_ndb_key_propety(ndb_key_prop):
"""
Two conventions for handling KeyProperties:
@@ -135,6 +139,7 @@ converters = {
ndb.FloatProperty: convert_ndb_float_property,
ndb.JsonProperty: convert_ndb_json_property,
ndb.DateProperty: convert_ndb_datetime_property,
+ ndb.TimeProperty: convert_ndb_time_property,
ndb.DateTimeProperty: convert_ndb_datetime_property,
ndb.KeyProperty: convert_ndb_key_propety,
ndb.StructuredProperty: convert_local_structured_property,
@ekampf created PR #37 for this
NDB has support for TimeProperty but it seems to be missing.
In
https://github.com/graphql-python/graphene-gae/blob/master/graphene_gae/ndb/converter.py#L129
I see:Is it as simple as just adding
ndb.TimeProperty: convert_ndb_datetime_property
?