Пример #1
0
 def searchMessagesByUserId(self, id):
     dao = MessageDAO()
     result = dao.searchMessagesByUserId(id)
     mapped_results = []
     for r in result:
         mapped_results.append(self.medMsgToDict(r))
     return jsonify(Messages=mapped_results)
Пример #2
0
 def getRepliesForMessage(self, msgID):
     dao = MessageDAO()
     result = dao.getRepliesForMessage(msgID)
     mapped_results = []
     for r in result:
         mapped_results.append(self.nameToDict(r))
     return jsonify(Messages_Replied=mapped_results)
Пример #3
0
 def searchMessagesByGroupId(self, id):  #
     dao = MessageDAO()
     result = dao.searchMessagesByGroupId(id)
     mapped_result = []
     for r in result:
         mapped_result.append(self.messagesDict(r))
     return jsonify(Messages=mapped_result)
Пример #4
0
 def searchMessagesOfUserFromGroup(self, uid, cid):  #
     dao = MessageDAO()
     result = dao.searchMessagesOfUserFromGroup(uid, cid)
     mapped_results = []
     for r in result:
         mapped_results.append(self.simpleMsgToDict(r))
     return jsonify(Messages=mapped_results)
Пример #5
0
 def getAllMessages(self):  #
     dao = MessageDAO()
     results = dao.getAllMessages()
     mapped_results = []
     for r in results:
         mapped_results.append(self.medMsgToDict(r))
     return jsonify(Messages=mapped_results)
Пример #6
0
 def getMessageByMsgId(self, msgID):
     dao = MessageDAO()
     result = dao.getMessageByMsgId(msgID)
     mapped_results = []
     for r in result:
         mapped_results.append(self.msgToDict(r))
     return jsonify(Message=mapped_results)
Пример #7
0
 def getMessageThatReplied(self, msgID):
     dao = MessageDAO()
     result = dao.getMessageThatReplied(msgID)
     mapped_results = []
     for r in result:
         mapped_results.append(self.msgToDict(r))
     return jsonify(Replies_To=mapped_results)
Пример #8
0
 def postMessage(self, userId, groupId, form2):
     if len(form2) != 3:
         return jsonify(Error="Malformed post request"), 400
     else:
         newText = form2['newText']
         replyValue = form2['replyValue']
         replyId = form2['replyId']
         if newText:
             dao = MessageDAO()
             result_list = dao.postMessage(userId, groupId, newText,
                                           replyValue, replyId)
             result = self.build_message_attributes(result_list)
             return jsonify(Message=result), 201
         else:
             return jsonify(
                 Error="Unexpected attributes in post request"), 400
Пример #9
0
 def getReplyForDisplay(self, repID):
     dao = MessageDAO()
     result = dao.getRepliesRec(repID)
     mapped = {'replyString': result}
     return jsonify(ReplyMessage=mapped)