Esempio n. 1
0
    def insertChatJson(self, json):
        cname = json['cname']
        uid = json['uid']
        if cname and uid:
            dao = ChatDAO()
            cid = dao.insert(cname, uid)
            dao.insertMember(cid, uid)
            result = self.build_chat_attributes(cid, cname, uid)

            return jsonify(Chat=result), 201
        else:
            return jsonify(Error="Unexpected attributes in post request"), 400
Esempio n. 2
0
 def insertChat(self, form):
     print("form: ", form)
     if len(form) != 2:
         return jsonify(Error="Malformed post request"), 400
     else:
         cname = form['cname']
         uid = form['uid']
         if cname and uid:
             dao = ChatDAO()
             cid = dao.insert(cname, uid)
             result = self.build_post_attributes(cid, cname, uid)
             return jsonify(Chat=result), 201
         else:
             return jsonify(
                 Error="Unexpected attributes in post request"), 400