def getAllMessages(): rows = dao.getAllMessages() if not rows: return jsonify(Error="No Message found"), 404 result = [] for row in rows: result.append(Dic.build_extended_message_dict(row)) return jsonify(Messages=result)
def getAllChatMessages(cID): # This method will return the messages in a determined chat chat_messages = dao.getAllChatMessages(cID) if not chat_messages: return jsonify(Error="No Messages Found") result_messages = [] for row in chat_messages: result = Dic.build_extended_message_dict(row) result_messages.append(result) return jsonify(Messages=result_messages)
def searchAllChatMessage(cid, json): if len(json) != 1: return jsonify(Error = " Malformed post request, missing or extra data") else: search = json['search'] result = dao.searchAllChatMessages(cid, search) if not result: return jsonify(Error="No Chat Messages Found") mapped_result = [] for r in result: mapped_result.append(Dic.build_extended_message_dict(r)) return jsonify(Messages = mapped_result)