Add recursive deletion for S3 objects to enable folder deletion

This commit is contained in:
2024-10-28 14:31:57 +07:00
parent 25d62bfd14
commit 7b55f19dbb
22 changed files with 309 additions and 437 deletions

View File

@ -31,14 +31,14 @@ func DELETE(w http.ResponseWriter, r *http.Request) {
return
}
err = app.Server.Service.RemoveUserFilesCache(r.Context(), userSession.UserID)
err = app.Server.Cache.RemoveUserFilesCache(r.Context(), userSession.UserID)
if err != nil {
w.WriteHeader(http.StatusInternalServerError)
app.Server.Logger.Error(err.Error())
return
}
err = app.Server.Storage.Delete(r.Context(), fmt.Sprintf("%s/%s", file.OwnerID.String(), file.ID.String()))
err = app.Server.Storage.DeleteRecursive(r.Context(), fmt.Sprintf("%s/%s", file.OwnerID.String(), file.ID.String()))
if err != nil {
w.WriteHeader(http.StatusInternalServerError)
app.Server.Logger.Error(err.Error())