Change PUT method to PATCH method.

This better reflects what the interface does.
main
Dimitri Huisman 2 years ago
parent bcceac359d
commit b0569035ae
No known key found for this signature in database

@ -77,7 +77,7 @@ class Alias(Resource):
@alias.response(400, 'Input validation exception', response_fields) @alias.response(400, 'Input validation exception', response_fields)
@alias.doc(security='Bearer') @alias.doc(security='Bearer')
@common.api_token_authorization @common.api_token_authorization
def put(self, alias): def patch(self, alias):
""" Update alias """ """ Update alias """
data = api.payload data = api.payload
alias_found = models.Alias.query.filter_by(email = alias).first() alias_found = models.Alias.query.filter_by(email = alias).first()
@ -86,8 +86,7 @@ class Alias(Resource):
if 'comment' in data: if 'comment' in data:
alias_found.comment = data['comment'] alias_found.comment = data['comment']
if 'destination' in data: if 'destination' in data:
destination_csl = ",".join(data['destination']) alias_found.destination = data['destination']
alias_found.destination = destination_csl
if 'wildcard' in data: if 'wildcard' in data:
alias_found.wildcard = data['wildcard'] alias_found.wildcard = data['wildcard']
db.session.add(alias_found) db.session.add(alias_found)

@ -152,7 +152,7 @@ class Domain(Resource):
@dom.response(409, 'Duplicate domain/alternative name', response_fields) @dom.response(409, 'Duplicate domain/alternative name', response_fields)
@dom.doc(security='Bearer') @dom.doc(security='Bearer')
@common.api_token_authorization @common.api_token_authorization
def put(self, domain): def patch(self, domain):
""" Update an existing domain """ """ Update an existing domain """
if not validators.domain(domain): if not validators.domain(domain):
return { 'code': 400, 'message': f'Domain {domain} is not a valid domain'}, 400 return { 'code': 400, 'message': f'Domain {domain} is not a valid domain'}, 400

@ -80,7 +80,7 @@ class Relay(Resource):
@relay.response(409, 'Duplicate relay', response_fields) @relay.response(409, 'Duplicate relay', response_fields)
@relay.doc(security='Bearer') @relay.doc(security='Bearer')
@common.api_token_authorization @common.api_token_authorization
def put(self, name): def patch(self, name):
""" Update relay """ """ Update relay """
data = api.payload data = api.payload

@ -184,7 +184,7 @@ class User(Resource):
@user.response(409, 'Duplicate user', response_fields) @user.response(409, 'Duplicate user', response_fields)
@user.doc(security='Bearer') @user.doc(security='Bearer')
@common.api_token_authorization @common.api_token_authorization
def put(self, email): def patch(self, email):
""" Update user """ """ Update user """
data = api.payload data = api.payload
if not validators.email(email): if not validators.email(email):

Loading…
Cancel
Save