def resolve_rules(self, info, intentid, offset=None, limit=None): return [Rule(**r) for r in StoreProxy.store().Rule.findByParent(parentid=intentid)]
def resolve_variables(self, info, entityid, offset=None, limit=None): return [Variable(**v) for v in StoreProxy.store().Variable.findByParent(parentid=entityid)]
def resolve_intent(self, *args, **kwargs): return Intent(**StoreProxy.store().Intent.findById(id=kwargs["id"]))
def resolve_entity(self, *args, **kwargs): return Entity(**StoreProxy.store().Entity.findById(id=kwargs["id"]))
return [Variable(**v) for v in StoreProxy.store().Variable.findByParent(parentid=entityid)] def resolve_rules(self, info, intentid, offset=None, limit=None): return [Rule(**r) for r in StoreProxy.store().Rule.findByParent(parentid=intentid)] def resolve_rule(self, *args, **kwargs): return Rule(**Query.store().Rule.findById(id=kwargs["id"])) def resolve_bots(self, info, offset=0, size=10): return [Bot(**b) for b in Query.store().Bot.list(offset=offset, size=size)] if __name__ == "__main__": from server.databot.model.models import Models StoreProxy.store(Models) schema = graphene.Schema(query=Query) r = schema.execute(""" { rules(intentid:"qnxarmz") { parent, id, name, description, replacements } } """) print r.errors print r.data
def resolve_bot(self): return Bot(**StoreProxy.store().Bot.findById(id=self.parent))