fix: Delete collection exports (#2595)

This commit is contained in:
Saumya Pandey
2021-10-07 09:38:45 +05:30
committed by GitHub
parent be905a6993
commit 81718c8ee1
12 changed files with 204 additions and 23 deletions

View File

@@ -34,10 +34,14 @@ const FileOperation = sequelize.define("file_operations", {
},
});
FileOperation.beforeDestroy(async (model) => {
await deleteFromS3(model.key);
});
FileOperation.prototype.expire = async function () {
this.state = "expired";
await deleteFromS3(this.key);
this.save();
await this.save();
};
FileOperation.associate = (models) => {