def createUser(self): """Logic to create a new user""" json = request.get_json() user = User(None, json["email"], EncryptionService.hashPassword(json["password"]), json["name"], None, None, json["group_id"], json["waterschap_id"]) user.addUser() return make_response(jsonify(user.json()))
def addUser(): if not request.json or not 'name' in request.json: return jsonify({"result": False, "msg": "Failed to Add User!"}) user = User(request.json['name'], request.json['email'], request.json['password'], request.json['phone'], request.json['address'], request.json['role']) result = User.addUser(user, mysql) return jsonify({"result": True, "msg": "Successfully Added User!"})