Files
Blog/app/internal/handler/downloadpresignedurlhandler.go
2025-10-24 21:44:15 +08:00

30 lines
785 B
Go

package handler
import (
"net/http"
"git.cialloo.com/CiallooWeb/Blog/app/internal/logic"
"git.cialloo.com/CiallooWeb/Blog/app/internal/svc"
"git.cialloo.com/CiallooWeb/Blog/app/internal/types"
"github.com/zeromicro/go-zero/rest/httpx"
)
// Get presigned URL for file download
func DownloadPresignedURLHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.DownloadPresignedURLReq
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := logic.NewDownloadPresignedURLLogic(r.Context(), svcCtx)
resp, err := l.DownloadPresignedURL(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
}
}