コード例 #1
0
 def getNameByChatId(self, id):
     dao = ChatDAO()
     result = dao.getNameByChatId(id)
     mappedResult = []
     for r in result:
         mappedResult.append(self.mapToAdminDictionary(r))
     return jsonify(Admin=mappedResult)
コード例 #2
0
 def getAllChatsMember(self, id):
     dao = ChatDAO()
     result = dao.getAllChatsMember(id)
     mappedResult = []
     for r in result:
         mappedResult.append(self.mapToDictionaryNames(r))
     return mappedResult
コード例 #3
0
 def getChatById(self, id):
     dao = ChatDAO()
     result = dao.getChatById(id)
     if result == None:
         return jsonify(Error="CHAT NOT FOUND"), 404
     else:
         return self.mapToDictionary(result)
コード例 #4
0
 def getAllChats(self):
     dao = ChatDAO()
     result = dao.getAllChats()
     mappedResult = []
     for r in result:
         mappedResult.append(self.mapToDictionary(r))
     return jsonify(Chats=mappedResult)
コード例 #5
0
 def getAllChatsMemberJSON(self, id):
     dao = ChatDAO()
     result = dao.getAllChatsMember(id)
     mappedResult = []
     for r in result:
         mappedResult.append(self.mapToDictionaryNames(r))
     print(mappedResult)
     return jsonify(Chats=mappedResult)
コード例 #6
0
 def addContactToChat(self, chatId, contact):
     ChatDAO().addContactToChat(chatId, contact)
     return jsonify(ContactAddedToChat="User with id " + contact +
                    " has been added to chat " + chatId)
コード例 #7
0
 def replyToMessage(self, message, replying):
     dao = ChatDAO()
     dao.reply(message, replying)
     return jsonify(Reply="Message '" + message +
                    " has posted a reply to message: " + replying)
コード例 #8
0
 def likeMessage(self, userId, messageId, like):
     ChatDAO().likeMessage(userId, messageId, like)
コード例 #9
0
 def postMessage(self, chat, user, message):
     dao = ChatDAO()
     mid = dao.postMessage(chat, user, message)
     return mid