From b0569035aecdbf0b8a312d5fd35b8fb0518562c0 Mon Sep 17 00:00:00 2001 From: Dimitri Huisman Date: Thu, 12 Jan 2023 10:55:49 +0000 Subject: [PATCH] Change PUT method to PATCH method. This better reflects what the interface does. --- core/admin/mailu/api/v1/alias.py | 5 ++--- core/admin/mailu/api/v1/domains.py | 2 +- core/admin/mailu/api/v1/relay.py | 2 +- core/admin/mailu/api/v1/user.py | 2 +- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/core/admin/mailu/api/v1/alias.py b/core/admin/mailu/api/v1/alias.py index 3605c68f..600ccc04 100644 --- a/core/admin/mailu/api/v1/alias.py +++ b/core/admin/mailu/api/v1/alias.py @@ -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) diff --git a/core/admin/mailu/api/v1/domains.py b/core/admin/mailu/api/v1/domains.py index 76554a02..7043da3d 100644 --- a/core/admin/mailu/api/v1/domains.py +++ b/core/admin/mailu/api/v1/domains.py @@ -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 diff --git a/core/admin/mailu/api/v1/relay.py b/core/admin/mailu/api/v1/relay.py index f4588d22..356f8426 100644 --- a/core/admin/mailu/api/v1/relay.py +++ b/core/admin/mailu/api/v1/relay.py @@ -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 diff --git a/core/admin/mailu/api/v1/user.py b/core/admin/mailu/api/v1/user.py index 953d246b..8e3d00a9 100644 --- a/core/admin/mailu/api/v1/user.py +++ b/core/admin/mailu/api/v1/user.py @@ -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):