Esempio n. 1
0
 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
Esempio n. 2
0
 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)
Esempio n. 3
0
 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)
Esempio n. 4
0
 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()
Esempio n. 5
0
    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()
Esempio n. 6
0
 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)
Esempio n. 7
0
 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)
Esempio n. 8
0
 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)