Example #1
0
 def mutate(self, info, **kwargs):
     from_name = kwargs.pop('from_name')
     to_name = kwargs.pop('to_name')
     relationship_type = kwargs.pop('relationship_type')
     repository = PersonRelations(info.context.graph_db)
     success = repository.add_relation(from_name, to_name,
                                       RelationshipType[relationship_type])
     return AddRelationship(success=success)
Example #2
0
 def resolve_people_with_parents(self, info):
     repository = PersonRelations(info.context.graph_db)
     peoples = repository.find_people()
     output = []
     for person in peoples:
         output.append(
             PeopleWithRelations(
                 person_name=person.name
             )
         )
     return output
Example #3
0
 def mutate(self, info, name, birthdate, gender):
     person_input = {'name': name, 'birthdate': birthdate, 'gender': gender}
     repository = PersonRelations(info.context.graph_db)
     person = repository.update_or_create(person_input)
     return CreatePerson(person=person, success=True)
Example #4
0
 def mutate(self, info, person_input):
     input_data = input_to_dictionary(person_input)
     repository = PersonRelations(info.context.graph_db)
     person = repository.update_or_create(input_data)
     return BasePersonMutation(updated_person=person, success=True)
Example #5
0
 def resolve_grandparents(self, info, name):
     repository = PersonRelations(info.context.graph_db)
     check_name(repository, name)
     return list_to_schema(repository.find_grandparents(name))
Example #6
0
 def resolve_person(self, info, name):
     repository = PersonRelations(info.context.graph_db)
     person = check_name(repository, name)
     return PersonSchema(**person.as_dict())
Example #7
0
 def resolve_people(self, info, **kwargs):
     repository = PersonRelations(info.context.graph_db)
     return repository.find_people()
Example #8
0
 def resolve_married_with(self, info, **kwargs):
     repository = PersonRelations(info.context.graph_db)
     check_name(repository, self.person_name)
     return list_to_schema(repository.find_partner(self.person_name))