Esempio n. 1
0
 def removeMember(self, cid, uid):
     result = ChatDAO()
     if not result.getChatByID(cid):
         return jsonify(Error="Chat not found."), 404
     else:
         result.removeMember(cid, uid)
         return jsonify(DeleteStatus="OK"), 200
Esempio n. 2
0
 def chatOwnerId(self, cid):
     dao = ChatDAO()
     row = dao.getChatByID(cid)
     if not row:
         return jsonify(Error="Chat Not Found"), 404
     else:
         user = self.build_owner_dict(row)
         return jsonify(User=user)
Esempio n. 3
0
 def getChatByID(self, cgid):
     dao = ChatDAO()
     result = dao.getChatByID(cgid)
     mapped_result = []
     if not result:
         return jsonify(Error="Not Found"), 404
     for r in result:
         mapped_result.append(self.mapToDict(r))
     return jsonify(Chat=mapped_result)
Esempio n. 4
0
 def removeChat(self, cID, ownerID):
     result = ChatDAO()
     user = UsersDAO()
     if not result.getChatByID(cID):
         return jsonify(Error="Chat not found."), 404
     else:
         print(ownerID, user.chatOwner(cID)[0])
         if ownerID == user.chatOwner(cID)[0]:
             print(ownerID, user.chatOwner(cID))
             result.delete(cID)
             return jsonify(DeleteStatus="OK"), 200
         else:
             return jsonify(Error="Not chat admin"), 404