feat: add file visibility toggle for files

This commit is contained in:
2024-09-15 23:59:19 +07:00
parent dc330cc72f
commit b246d85fac
22 changed files with 738 additions and 144 deletions

View File

@ -8,6 +8,7 @@ import (
fileHandler "github.com/fossyy/filekeeper/handler/file"
downloadHandler "github.com/fossyy/filekeeper/handler/file/download"
uploadHandler "github.com/fossyy/filekeeper/handler/file/upload"
visibilityHandler "github.com/fossyy/filekeeper/handler/file/visibility"
forgotPasswordHandler "github.com/fossyy/filekeeper/handler/forgotPassword"
forgotPasswordVerifyHandler "github.com/fossyy/filekeeper/handler/forgotPassword/verify"
indexHandler "github.com/fossyy/filekeeper/handler/index"
@ -121,6 +122,10 @@ func SetupRoutes() *http.ServeMux {
downloadHandler.GET(w, r)
})
handler.HandleFunc("PUT /file/{id}", func(w http.ResponseWriter, r *http.Request) {
middleware.Auth(visibilityHandler.PUT, w, r)
})
handler.HandleFunc("GET /logout", func(w http.ResponseWriter, r *http.Request) {
middleware.Auth(logoutHandler.GET, w, r)
})