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 mutate(self, info, id, name, surname, patronymic, phone, department, specialization, set_name, set_surname, set_patronymic, set_phone, set_department, set_specialization): #print('omg') new_people = mongo_native.update_people(_id = ObjectId(id) if id else None, name = name, surname = surname, patronymic = patronymic,\ phone = phone, department = ObjectId(department) if department else None, specialization = ObjectId(specialization) if specialization else None, set_name = set_name, set_surname = set_surname, set_patronymic = set_patronymic,\ set_phone = set_phone, set_department = ObjectId(set_department) if set_department else None,\ set_specialization = ObjectId(set_specialization) if set_specialization else None) people = [PersonMapper.init_scalar(item) for item in new_people] ok = True return UpdatePeople(people=people, ok=ok)
def resolve_supervisor(self, info): return PersonMapper.init_scalar( mongo_native.get_person_by_id(self.supervisor))
def resolve_supervisor(self, info): return PersonMapper.init_scalar(mongo_native.get_person_by_id(self.supervisor))