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

@ -12,7 +12,7 @@ import (
func GET(w http.ResponseWriter, r *http.Request) {
userSession := r.Context().Value("user").(types.User)
files, err := app.Server.Service.GetUserFiles(r.Context(), userSession.UserID)
files, err := app.Server.Cache.GetUserFiles(r.Context(), userSession.UserID)
if err != nil {
w.WriteHeader(http.StatusInternalServerError)
app.Server.Logger.Error(err.Error())
@ -21,7 +21,7 @@ func GET(w http.ResponseWriter, r *http.Request) {
var filesData []types.FileData
for _, file := range files {
userFile, err := app.Server.Service.GetFileDetail(r.Context(), file.ID)
userFile, err := app.Server.Cache.GetFileDetail(r.Context(), file.ID)
if err != nil {
w.WriteHeader(http.StatusInternalServerError)
app.Server.Logger.Error(err.Error())
@ -38,7 +38,7 @@ func GET(w http.ResponseWriter, r *http.Request) {
return
}
usage, err := app.Server.Service.CalculateUserStorageUsage(r.Context(), userSession.UserID.String())
usage, err := app.Server.Cache.CalculateUserStorageUsage(r.Context(), userSession.UserID.String())
if err != nil {
w.WriteHeader(http.StatusInternalServerError)
app.Server.Logger.Error(err.Error())