Пример #1
0
 def do_query(self, uid: str):
     with UsersDBSession():
         user_id = self._user_mgr.resolve_user_id_from_uid(uid)
         user_feedbacks = self._feedback_mgr.get_user_feedbacks(user_id)
         response = [UserFeedbackDTO.create_from_user_feedback_db_model(user_feedback) for user_feedback in
                     user_feedbacks]
         return response
    def do_logic(self, uid: str, expertise_id: int, expertise_name: str):
        with UsersDBSession():
            expertise = self._user_expertise_mgr.get_expertise(expertise_id)
            self._validate_action(expertise, uid)
            expertise.expertise_name = expertise_name

            return UserExpertiseDTO(id=expertise.id,
                                    expertise_name=expertise.expertise_name)
Пример #3
0
 def do_logic(self, feedback_from_uid: str, feedback_about_uid: str,
              description: str, ratings: List[FeedbackRatingDTO]):
     with UsersDBSession():
         from_user_id = self._user_mgr.resolve_user_id_from_uid(
             feedback_from_uid)
         about_user_id = self._user_mgr.resolve_user_id_from_uid(
             feedback_about_uid)
         return self._feedback_mgr.add_feedback_to_user(
             from_user_id, about_user_id, description, ratings)
 def do_query(self, uid: str):
     with UsersDBSession():
         user_expertises = self._user_expertises_mgr.get_user_expertises(
             uid)
         response = [
             UserExpertiseDTO(id=db_model.id,
                              expertise_name=db_model.expertise_name)
             for db_model in user_expertises
         ]
         return response
 def create_user(self, email: str, password: str, user_account_type: str):
     with UsersDBSession():
         hashed_password = self._hashing_helper.hash_password(password)
         return self._user_details_manager.create_user(
             email, hashed_password, user_account_type)
Пример #6
0
 def do_logic(self, uid: str, expertise_name: str):
     with UsersDBSession():
         user_id = self._user_mgr.resolve_user_id_from_uid(uid)
         expertise_id = self._user_expertise_mgr.add_user_expertise(
             user_id, uid, expertise_name)
         return expertise_id
Пример #7
0
 def do_logic(self, uid: str, expertise_id: int):
     with UsersDBSession():
         expertise = self._user_expertise_mgr.get_expertise(expertise_id)
         self._validate_action(expertise, uid)
         expertise.deleted = True
 def do_logic(self, feedback_id: int):
     with UsersDBSession():
         return self._feedback_mgr.delete_feedback(feedback_id)