Add Redis support for session and user management

This commit is contained in:
2024-09-08 00:03:43 +07:00
parent b9ac29d301
commit 2c5de2b336
26 changed files with 642 additions and 548 deletions

View File

@ -4,7 +4,6 @@ import (
"encoding/json"
"errors"
"github.com/fossyy/filekeeper/app"
"github.com/fossyy/filekeeper/cache"
"io"
"net/http"
"os"
@ -31,7 +30,7 @@ func POST(w http.ResponseWriter, r *http.Request) {
return
}
fileData, err := cache.GetUserFile(fileInfo.Name, userSession.UserID.String())
fileData, err := app.Server.Service.GetUserFile(fileInfo.Name, userSession.UserID.String())
if err != nil {
if errors.Is(err, gorm.ErrRecordNotFound) {
upload, err := handleNewUpload(userSession, fileInfo)