def get_person(self, person_id, person_type=None): logging.info("Get person %s" % person_id) with self._database_engine.new_session() as session: dao = PersonDAO(session) member = dao.get(person_id) member_data = member.to_dict() return member_data
def delete_person_sport(self, person_id, sport_id): with self._database_engine.new_session() as session: person_dao = PersonDAO(session) person = person_dao.get(person_id) sport_dao = SportDAO(session) sport = sport_dao.get(sport_id) person.delete_sport(sport, session)
def add_person_sport(self, person_id, sport_id, level): with self._database_engine.new_session() as session: person_dao = PersonDAO(session) person = person_dao.get(person_id) sport_dao = SportDAO(session) sport = sport_dao.get(sport_id) person.add_sport(sport, level, session)
def update_person(self, person_id, person_data): self._check_profile_data(person_data, update=True) with self._database_engine.new_session() as session: person_dao = PersonDAO(session) person = person_dao.get(person_id) person = person_dao.update(person, person_data) return person.to_dict()
def _update_person(self, member_id, member_data, person_type=None): logging.info("Update %s with data: %s" % (member_id, str(member_data))) with self._database_engine.new_session() as session: dao = PersonDAO(session) person = dao.get(member_id) person = dao.update(person, member_data) return person.to_dict()
def delete_person(self, member_id, person_type=None): logging.info("Delete person %s" % member_id) with self._database_engine.new_session() as session: dao = PersonDAO(session) member = dao.get(member_id) dao.delete(member)
def delete_person(self, person_id): with self._database_engine.new_session() as session: person_dao = PersonDAO(session) person = person_dao.get(person_id) person_dao.delete(person)
def delete_person(self, member_id, person_type=None): with self._database_engine.new_session() as session: dao = PersonDAO(session).get_dao(type=person_type) member = dao.get(member_id) dao.delete(member)