def get_all_messages(self): dao = MessageDAO() result = dao.get_all_messages() mapped_result = [] for r in result: mapped_result.append(self.map_to_dict(r)) return jsonify(Message=mapped_result)
def get_message_by_media_uri(self, uri): dao = MessageDAO() result = dao.get_messages_by_media_uri(uri) if result is None: return jsonify(Error="NOT FOUND"), 404 else: mapped = self.map_to_dict(result) return jsonify(Message=mapped)
def get_message_by_content(self, text): dao = MessageDAO() result = dao.get_messages_by_content(text) if result is None: return jsonify(Error="NOT FOUND"), 404 else: mapped = self.map_to_dict(result) return jsonify(Message=mapped)
def get_message_by_like_reply_id(self, rid): dao = MessageDAO() result = dao.get_messages_by_reply_id(rid) if result is None: return jsonify(Error="NOT FOUND"), 404 else: mapped = self.map_to_dict(result) return jsonify(Message=mapped)
def get_message_by_like_dislike_counter(self, counter): dao = MessageDAO() result = dao.get_messages_by_likes_dislikes(counter) if result is None: return jsonify(Error="NOT FOUND"), 404 else: mapped = self.map_to_dict(result) return jsonify(Message=mapped)
def get_message_by_timestamp(self, timestamp): dao = MessageDAO() result = dao.get_messages_by_timestamp(timestamp) if result is None: return jsonify(Error="NOT FOUND"), 404 else: mapped = self.map_to_dict(result) return jsonify(Message=mapped)