mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-18 07:21:49 -05:00
Change name of update method for template folder
It was initialy called "rename" which does not comply with RESTful CRUD (create, update, read, delete) naming practice. We remove the 'rename' operation in favour of template folder resource update endpoint as it allows us to extend it with other attributes.
This commit is contained in:
@@ -15,7 +15,7 @@ from app.errors import InvalidRequest, register_errors
|
||||
from app.models import TemplateFolder
|
||||
from app.template_folder.template_folder_schema import (
|
||||
post_create_template_folder_schema,
|
||||
post_rename_template_folder_schema,
|
||||
post_update_template_folder_schema,
|
||||
post_move_template_folder_schema,
|
||||
)
|
||||
from app.schema_validation import validate
|
||||
@@ -67,11 +67,11 @@ def create_template_folder(service_id):
|
||||
return jsonify(data=template_folder.serialize()), 201
|
||||
|
||||
|
||||
@template_folder_blueprint.route('/<uuid:template_folder_id>/rename', methods=['POST'])
|
||||
def rename_template_folder(service_id, template_folder_id):
|
||||
@template_folder_blueprint.route('/<uuid:template_folder_id>', methods=['POST'])
|
||||
def update_template_folder(service_id, template_folder_id):
|
||||
data = request.get_json()
|
||||
|
||||
validate(data, post_rename_template_folder_schema)
|
||||
validate(data, post_update_template_folder_schema)
|
||||
|
||||
template_folder = dao_get_template_folder_by_id_and_service_id(template_folder_id, service_id)
|
||||
template_folder.name = data['name']
|
||||
|
||||
Reference in New Issue
Block a user