Пример #1
0
 def getUserAllReaction(self, uid):
     dao = UserDao()
     user_reaction_list = dao.getUserReaction(uid)
     result_list = []
     for row in user_reaction_list:
         result = self.build_user_reaction_dict(row)
         result_list.append(result)
     return jsonify(ReactionsByUser=result_list)
Пример #2
0
 def getUserById(self, uid):
     dao = UserDao()
     row = dao.getUserById(uid)
     if not row:
         return jsonify(Error="User Not Found"), 404
     else:
         user = self.build_user_dict(row)
         return jsonify(User=user)
Пример #3
0
 def getAllUser(self):
     dao = UserDao()
     user_list = dao.getAllUser()
     result_list = []
     for row in user_list:
         result = self.build_user_dict(row)
         result_list.append(result)
     return jsonify(User=result_list)
Пример #4
0
    def updateUser(self, uid, form):
        dao = UserDao()
        user = dao.update(uid)
        if not user:
            return jsonify(Error="USER NOT FOUND"), 404

        result = self.build_user_dict(user)
        return jsonify(User=result), 200
Пример #5
0
 def getPostsFromUser(self, uid):
     posts = UserDao().postsFromUser(uid)
     if not posts:
         return jsonify(Error="NOT FOUND POSTS FROM USER"), 404
     result = []
     for p in posts:
         result.append(self.build_post_dict(p))
     return jsonify(PostsFromUser=result)
Пример #6
0
    def getUsername(self, uid):
        username = UserDao().getUsername(uid)

        if not username:
            return jsonify(Error="USER NOT FOUND"), 404

        result = {}
        result['username'] = username
        return jsonify(Username=result)
Пример #7
0
 def getCredentials(self):
     dao = UserDao()
     result = dao.getCredentials('', '')
     return jsonify(User=self.build_credential_dict(result))
Пример #8
0
 def insertUser(self):
     dao = UserDao()
     user = dao.insertUser()
     result = self.build_user_dict(user)
     return jsonify(User=result), 201