def resolve_people(self, info, id, name, surname, patronymic, phone, department, specialization): id_matcher = re.compile(id + '.*') department_id_matcher = re.compile(department + '.*') specialization_id_matcher = re.compile(specialization + '.*') return [PersonMapper.init_scalar(item)\ for item in mongo_native.select_people(name = name, surname = surname, patronymic = patronymic, phone = phone)\ if id_matcher.match(str(item['_id'])) and department_id_matcher.match(str(item['department'])) and specialization_id_matcher.match(str(item['specialization']))]
def resolve_people(self, info): from person_mapper import PersonMapper return [PersonMapper(id = id) for id in mongo_native.get_people_ids_with_spec(self.id)]
def resolve_workers(self, info): return [PersonMapper(id = worker_id) for worker_id in neo4j_adapter.get_workers_id(self.id)]
def resolve_chief(self, info): return PersonMapper(id = neo4j_adapter.get_shift_chief_id(self.id))
def resolve_executors(self, info): return [PersonMapper(id = executor_id) for executor_id in neo4j_adapter.get_executors_id(self.id)]
def resolve_head(self, info): return PersonMapper(id = neo4j_adapter.get_operation_head_id(self.id))
def mutate(self, info, id): deleted = mongo_native.eradicate_person(id) person = PersonMapper(id=id, name=deleted['name']) ok = True return EradicatePerson(person=person, ok=ok)
def resolve_director(self, info): from person_mapper import PersonMapper return PersonMapper(id=neo4j_adapter.get_director_id(self.id))
def resolve_supervisor(self, info): return PersonMapper.init_scalar(mongo_native.get_person_by_id(self.supervisor))
def resolve_user(self, info): return PersonMapper(id=self.userid)