refactor: move more response structs to response package

This commit is contained in:
Derrick Hammer 2023-06-07 13:17:11 -04:00
parent cfa7ceb2f4
commit 98fd2a097e
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
3 changed files with 13 additions and 9 deletions

View File

@ -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))

View File

@ -0,0 +1,5 @@
package response
type StatusResponse struct {
Status string `json:"status"`
}

View File

@ -0,0 +1,5 @@
package response
type UploadResponse struct {
Cid string `json:"cid"`
}