feat: implement file deletion

This commit is contained in:
2024-09-17 11:21:04 +07:00
parent e07360d2b3
commit cd9a7503b5
6 changed files with 355 additions and 137 deletions

View File

@ -6,6 +6,7 @@ import (
googleOauthSetupHandler "github.com/fossyy/filekeeper/handler/auth/google/setup"
totpHandler "github.com/fossyy/filekeeper/handler/auth/totp"
fileHandler "github.com/fossyy/filekeeper/handler/file"
deleteHandler "github.com/fossyy/filekeeper/handler/file/delete"
downloadHandler "github.com/fossyy/filekeeper/handler/file/download"
uploadHandler "github.com/fossyy/filekeeper/handler/file/upload"
visibilityHandler "github.com/fossyy/filekeeper/handler/file/visibility"
@ -118,6 +119,10 @@ func SetupRoutes() *http.ServeMux {
middleware.Auth(uploadHandler.POST, w, r)
})
handler.HandleFunc("DELETE /file/{id}", func(w http.ResponseWriter, r *http.Request) {
middleware.Auth(deleteHandler.DELETE, w, r)
})
handler.HandleFunc("GET /file/{id}", func(w http.ResponseWriter, r *http.Request) {
downloadHandler.GET(w, r)
})