diff --git a/controller/files.go b/controller/files.go index c92af9a..ed3414c 100644 --- a/controller/files.go +++ b/controller/files.go @@ -3,6 +3,7 @@ package controller import ( "errors" "git.lumeweb.com/LumeWeb/portal/cid" + "git.lumeweb.com/LumeWeb/portal/controller/response" "git.lumeweb.com/LumeWeb/portal/logger" "git.lumeweb.com/LumeWeb/portal/service/files" "github.com/kataras/iris/v12" @@ -13,13 +14,6 @@ import ( type FilesController struct { Ctx iris.Context } -type UploadResponse struct { - Cid string `json:"cid"` -} - -type StatusResponse struct { - Status string `json:"status"` -} func (f *FilesController) PostUpload() { ctx := f.Ctx @@ -44,7 +38,7 @@ func (f *FilesController) PostUpload() { return } - err = ctx.JSON(&UploadResponse{Cid: cidString}) + err = ctx.JSON(&response.UploadResponse{Cid: cidString}) if err != nil { logger.Get().Error("failed to create response", zap.Error(err)) @@ -101,7 +95,7 @@ func (f *FilesController) GetStatusBy(cidString string) { break } - err := ctx.JSON(&StatusResponse{Status: statusCode}) + err := ctx.JSON(&response.StatusResponse{Status: statusCode}) if err != nil { logger.Get().Error("failed to create response", zap.Error(err)) diff --git a/controller/response/status.go b/controller/response/status.go new file mode 100644 index 0000000..674f260 --- /dev/null +++ b/controller/response/status.go @@ -0,0 +1,5 @@ +package response + +type StatusResponse struct { + Status string `json:"status"` +} diff --git a/controller/response/upload.go b/controller/response/upload.go new file mode 100644 index 0000000..0cb075d --- /dev/null +++ b/controller/response/upload.go @@ -0,0 +1,5 @@ +package response + +type UploadResponse struct { + Cid string `json:"cid"` +}