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.doc(security='Bearer')
@common.api_token_authorization
def put(self, alias):
def patch(self, alias):
""" Update alias """
data = api.payload
alias_found = models.Alias.query.filter_by(email = alias).first()
@ -86,8 +86,7 @@ class Alias(Resource):
if 'comment' in data:
alias_found.comment = data['comment']
if 'destination' in data:
destination_csl = ",".join(data['destination'])
alias_found.destination = destination_csl
alias_found.destination = data['destination']
if 'wildcard' in data:
alias_found.wildcard = data['wildcard']
db.session.add(alias_found)

@ -152,7 +152,7 @@ class Domain(Resource):
@dom.response(409, 'Duplicate domain/alternative name', response_fields)
@dom.doc(security='Bearer')
@common.api_token_authorization
def put(self, domain):
def patch(self, domain):
""" Update an existing domain """
if not validators.domain(domain):
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.doc(security='Bearer')
@common.api_token_authorization
def put(self, name):
def patch(self, name):
""" Update relay """
data = api.payload

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

Loading…
Cancel
Save