mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-17 18:52:30 -05:00
move folders and templates to other folders
new endpoints: /services/<service_id>/move-to-folder /services/<service_id>/move-to-folder/<target_template_folder_id> * takes in a dict containing lists of `templates` and `folders` uuids. * sets parent of templates and folders to the folder specified in the URL. Or None, if there was no id specified. * if any template or folder has a differen service id, then the whole update fails * if any folder is an ancestor of the target folder, then the whole update fails (as that would cause a cyclical folder structure). * the whole function is wrapped in a single `transactional` decorator, so in case of error nothing will be saved.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
from app.schema_validation.definitions import nullable_uuid
|
||||
from app.schema_validation.definitions import nullable_uuid, uuid
|
||||
|
||||
post_create_template_folder_schema = {
|
||||
"$schema": "http://json-schema.org/draft-04/schema#",
|
||||
@@ -20,3 +20,14 @@ post_rename_template_folder_schema = {
|
||||
},
|
||||
"required": ["name"]
|
||||
}
|
||||
|
||||
post_move_template_folder_schema = {
|
||||
"$schema": "http://json-schema.org/draft-04/schema#",
|
||||
"description": "POST schema for renaming template_folder",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"templates": {"type": "array", "items": uuid},
|
||||
"folders": {"type": "array", "items": uuid},
|
||||
},
|
||||
"required": ["templates", "folders"]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user