diff --git a/CHANGELOG.md b/CHANGELOG.md index cf359236c..c8c130177 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Change Log +## 1.16.3 + +### Improvements +- Reduce rest calls to get settings ([953](../../pull/953)) +- Add an endpoint to delete all annotations in a folder ([954](../../pull/954)) + ## 1.16.2 ### Improvements diff --git a/girder_annotation/girder_large_image_annotation/rest/annotation.py b/girder_annotation/girder_large_image_annotation/rest/annotation.py index 2ad7f51fe..739562c17 100644 --- a/girder_annotation/girder_large_image_annotation/rest/annotation.py +++ b/girder_annotation/girder_large_image_annotation/rest/annotation.py @@ -65,6 +65,7 @@ def __init__(self): self.route('GET', ('folder', ':id', 'present'), self.existFolderAnnotations) self.route('GET', ('folder', ':id', 'create'), self.canCreateFolderAnnotations) self.route('PUT', ('folder', ':id', 'access'), self.setFolderAnnotationAccess) + self.route('DELETE', ('folder', ':id'), self.deleteFolderAnnotations) self.route('GET', ('old',), self.getOldAnnotations) self.route('DELETE', ('old',), self.deleteOldAnnotations) self.route('GET', ('counts',), self.getItemListAnnotationCounts) @@ -725,6 +726,27 @@ def setFolderAnnotationAccess(self, id, params): return {'updated': count} + @autoDescribeRoute( + Description('Delete all user-owned annotations from the items in a folder') + .param('id', 'The ID of the folder', required=True, paramType='path') + .param('recurse', 'Whether or not to retrieve all ' + 'annotations from subfolders', required=False, default=False, dataType='boolean') + .errorResponse('ID was invalid.') + ) + @access.user + def deleteFolderAnnotations(self, id, params): + setResponseTimeLimit(86400) + user = self.getCurrentUser() + if not user: + return [] + count = 0 + for annotation in self.getFolderAnnotations(id, params['recurse'], user): + annot = Annotation().load(annotation['_id'], user=user, getElements=False) + Annotation().remove(annot) + count += 1 + + return {'deleted': count} + @autoDescribeRoute( Description('Report on old annotations.') .param('age', 'The minimum age in days.', required=False,