// Code scaffolded by goctl. Safe to edit.
// goctl 1.10.1

package file

import (
	"net/http"

	"sundynix-micro-go/app/file/api/internal/logic/file"
	"sundynix-micro-go/app/file/api/internal/svc"
	"sundynix-micro-go/common/response"
)

// 上传文件
func UploadFileHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
	return func(w http.ResponseWriter, r *http.Request) {
		l := file.NewUploadFileLogic(r.Context(), svcCtx)
		resp, err := l.UploadFile(r)
		if err != nil {
			response.Fail(w, err.Error())
		} else {
			response.OkWithData(w, resp)
		}
	}
}
