def getUsersWhoDislikeMessage(self, mid): dao = MessagesDAO() result = dao.getUsersWhoDislikeMessage(mid) mapped_result = [] for r in result: mapped_result.append(buildDict.build_users_dict(self, r)) return jsonify(Users=mapped_result)
def getContactsOfUser(self, uid): dao = UsersDAO() result = dao.getContactsOfUser(uid) mapped_result = [] for r in result: mapped_result.append(buildDict.build_users_dict(self, r)) return jsonify(Contacts=mapped_result)
def loginUser(self, form): username = form['username'] password = form['password'] dao = UsersDAO() result = dao.loginUser(username, password) mapped = buildDict.build_users_dict(self, result) return jsonify(Users=mapped)
def getAllUsers(self): dao = UsersDAO() result = dao.getAllUsers() mapped_result = [] for r in result: mapped_result.append(buildDict.build_users_dict(self, r)) return jsonify(Users=mapped_result)
def getUsersInAGroupChat(self, gid): dao = GroupChatsDAO() result = dao.getUsersInAGroupChat(gid) mapped = [] for r in result: mapped.append(buildDict.build_users_dict(self, r)) return jsonify(Users=mapped)
def getUserById(self, id): dao = UsersDAO() result = dao.getUserById(id) if result is None: return jsonify(Error="NOT FOUND"), 404 else: mapped = buildDict.build_users_dict(self, result) return jsonify(Users=mapped)
def getOwnerOfGroupChat(self, gid): dao = GroupChatsDAO() result = dao.getOwnerOfGroupChat(gid) if result is None: return jsonify(Error="NOT FOUND"), 404 else: mapped = buildDict.build_users_dict(self, result) return jsonify(Owner=mapped)
def getUserInformationByUsername(self, username): dao = UsersDAO() result = dao.getUserInformationByUsername(username) if result is None: return jsonify(Error="NOT FOUND"), 404 else: # TODO: Edit mapped = buildDict.build_users_dict(self, result) return jsonify(Users=mapped)