feat (minio): done, upload wip
This commit is contained in:
@@ -43,6 +43,7 @@ import (
|
||||
|
||||
/******************** infra ********************/
|
||||
gs "simrs-vx/internal/infra/gorm-setting"
|
||||
minio "simrs-vx/internal/infra/minio"
|
||||
ssdb "simrs-vx/internal/infra/ss-db"
|
||||
|
||||
/******************** pkg ********************/
|
||||
@@ -50,6 +51,7 @@ import (
|
||||
hc "simrs-vx/pkg/handler-crud-helper"
|
||||
lh "simrs-vx/pkg/lang-helper"
|
||||
handlerlogger "simrs-vx/pkg/middleware/handler-logger"
|
||||
mh "simrs-vx/pkg/minio-helper"
|
||||
zlc "simrs-vx/pkg/zerolog-ctx"
|
||||
|
||||
/******************** sources ********************/
|
||||
@@ -97,6 +99,8 @@ func SetRoutes() http.Handler {
|
||||
a.RegisterExtCall(zlc.Adjust)
|
||||
a.RegisterExtCall(ssdb.SetInstance)
|
||||
a.RegisterExtCall(lh.Populate)
|
||||
a.RegisterExtCall(minio.Connect)
|
||||
a.RegisterExtCall(mh.I.SetClient)
|
||||
a.RegisterExtCall(validation.RegisterValidation)
|
||||
|
||||
r := http.NewServeMux()
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
package upload
|
||||
|
||||
// "net/http"
|
||||
|
||||
// uh "simrs-vx/pkg/upload-helper"
|
||||
|
||||
// uploadHandler handles single file upload requests
|
||||
// func uploadHandler(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
// if r.Method == "OPTIONS" {
|
||||
// w.WriteHeader(http.StatusNoContent)
|
||||
// return
|
||||
// }
|
||||
|
||||
// if r.Method != "POST" {
|
||||
// writeJSONResponse(w, http.StatusMethodNotAllowed, uh.UploadResponse{
|
||||
// Success: false,
|
||||
// Message: "Method not allowed. Use POST.",
|
||||
// })
|
||||
// return
|
||||
// }
|
||||
|
||||
// // Parse multipart form (32MB max memory)
|
||||
// err := r.ParseMultipartForm(32 << 20)
|
||||
// if err != nil {
|
||||
// writeJSONResponse(w, http.StatusBadRequest, uh.UploadResponse{
|
||||
// Success: false,
|
||||
// Message: "Failed to parse multipart form",
|
||||
// })
|
||||
// return
|
||||
// }
|
||||
|
||||
// // Get file from form
|
||||
// file, header, err := r.FormFile("file")
|
||||
// if err != nil {
|
||||
// writeJSONResponse(w, http.StatusBadRequest, uh.UploadResponse{
|
||||
// Success: false,
|
||||
// Message: "No file uploaded or invalid file field name. Use 'file' as field name.",
|
||||
// })
|
||||
// return
|
||||
// }
|
||||
// defer file.Close()
|
||||
|
||||
// // Upload file
|
||||
// response, err := service.UploadFile(file, header.Filename, header.Size)
|
||||
// if err != nil {
|
||||
// writeJSONResponse(w, http.StatusInternalServerError, *response)
|
||||
// return
|
||||
// }
|
||||
|
||||
// if response.Success {
|
||||
// writeJSONResponse(w, http.StatusOK, *response)
|
||||
// } else {
|
||||
// writeJSONResponse(w, http.StatusBadRequest, *response)
|
||||
// }
|
||||
// }
|
||||
Reference in New Issue
Block a user