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 addMember(self, chat_group_id, json): dao = GroupDAO() user_id = json['user_id'] if user_id: result = dao.addContactTogroup(chat_group_id, user_id) return jsonify(result), 201 else: return jsonify(Error="Unexpected attributes in post request"), 400
def addMember(self, gID, json): dao = GroupDAO() if len(json) != 1: return jsonify(Error="Malformed post request"), 400 else: contactid = json['contactid'] if contactid: result = dao.addContactTogroup(gID, contactid) return jsonify(result), 201 else: return jsonify( Error="Unexpected attributes in post request"), 400