Skip to content
Snippets Groups Projects
Commit 1ce38068 authored by Anusha Ranganathan's avatar Anusha Ranganathan
Browse files

Merge branch 'bug_fix/430-zip-file-count-mismatch' into 'develop'

Clear file on s3 on destroy fileset

Closes FDM/rdm-system/antleaf-projectmanagement#430

See merge request !349
parents aa41daaa 06f2da47
No related branches found
No related tags found
1 merge request!349Clear file on s3 on destroy fileset
Pipeline #18246 canceled
......@@ -5,7 +5,7 @@ class FileSet < ActiveFedora::Base
self.indexer = CrcFileSetIndexer
after_save :create_file_set_with_fast_load_meta_data
after_destroy :destroy_set_meta_data
before_destroy :destroy_set_meta_data
property :for_complex_identifier, predicate: ::RDF::Vocab::Rdms.forComplexIdentifier, multiple: false do |index|
index.as :stored_searchable, :facetable
......@@ -79,7 +79,13 @@ class FileSet < ActiveFedora::Base
end
def destroy_set_meta_data
s3 = S3StorageService.new
s3.init_client
bucket_name = s3.sanitise_name(self.parent.id)
meta_data = FileSetFastLoadMetadata.find_by(fedora_file_set_id: self.id)
meta_data.destroy! if meta_data.present?
s3.delete_object(bucket_name, self.object_key_on_s3)
parent.update(date_modified: DateTime.now)
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment