✨ encapsulate object storage service operations
This commit is contained in:
21
app/auth/api/internal/handler/file/upload_file_handler.go
Normal file
21
app/auth/api/internal/handler/file/upload_file_handler.go
Normal file
@@ -0,0 +1,21 @@
|
||||
package file
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"schisandra-album-cloud-microservices/app/auth/api/internal/logic/storage"
|
||||
"schisandra-album-cloud-microservices/common/xhttp"
|
||||
|
||||
"schisandra-album-cloud-microservices/app/auth/api/internal/svc"
|
||||
)
|
||||
|
||||
func UploadFileHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
l := storage.NewUploadFileLogic(r.Context(), svcCtx)
|
||||
resp, err := l.UploadFile(r)
|
||||
if err != nil {
|
||||
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
|
||||
} else {
|
||||
xhttp.JsonBaseResponseCtx(r.Context(), w, resp)
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user