def createGroup(self, json): dao = GroupDAO() chat_name = json['chat_name'] user_id = json['user_id'] chat_group_id = dao.createGroup(chat_name, user_id) dao.addContactTogroup(chat_group_id, user_id) #add user to group return jsonify(chat_group_id), 201
def createGroup(self, json): dao = GroupDAO() if len(json) != 2: return jsonify(Error="Malformed post request"), 400 else: groupname = json['groupname'] ownerId = json['ownerid'] if groupname and ownerId: result = dao.createGroup(groupname, ownerId) return jsonify(result), 201 else: return jsonify( Error="Unexpected attributes in post request"), 400