def getGroupChatbyUserId(self, uid): dao = UsersDAO() result = dao.getGroupChatbyUserId(uid) mapped_result = [] for r in result: mapped_result.append(buildDict.build_groupchats_dict(self, r)) return jsonify(GroupChats=mapped_result)
def getAllGroupChats(self): dao = GroupChatsDAO() result = dao.getAllGroupChats() mapped_result = [] for r in result: mapped_result.append(buildDict.build_groupchats_dict(self, r)) return jsonify(GroupChats=mapped_result)
def getGroupChatById(self, gid): dao = GroupChatsDAO() result = dao.getGroupChatById(gid) if result is None: return jsonify(Error="NOT FOUND"), 404 else: mapped = buildDict.build_groupchats_dict(self, result) return jsonify(GroupChats=mapped)
def createGroupChat(self, uid, form): gname = form['gname'] result = GroupChatsDAO().createGroupChat(uid, gname) if result is None: return jsonify(Error="NOT FOUND"), 404 else: mapped_result = [] for r in result: mapped_result.append(buildDict.build_groupchats_dict(self, r)) return jsonify(GroupChats=mapped_result)
def availableGroupChats(self, uid): values = GroupChatsDAO().availableGroupChats(uid) mapped_result = [] for r in values: mapped_result.append(buildDict.build_groupchats_dict(self, r)) return jsonify(GroupChats=mapped_result), 201