Feat: add more tests
This commit is contained in:
@@ -8,17 +8,23 @@ import (
|
||||
"gitea.konchin.com/go2025/backend/middlewares"
|
||||
"gitea.konchin.com/go2025/backend/models"
|
||||
"gitea.konchin.com/go2025/backend/types"
|
||||
"gitea.konchin.com/go2025/backend/utils"
|
||||
"github.com/uptrace/bunrouter"
|
||||
)
|
||||
|
||||
type postImageOutput struct {
|
||||
Id int64 `json:"id"`
|
||||
Extension string `json:"extension"`
|
||||
Uploader string `json:"uploadedUserId"`
|
||||
UploadTS time.Time `json:"uploadedAt"`
|
||||
}
|
||||
|
||||
// PostImage
|
||||
//
|
||||
// @param userinfo header string true "userinfo from /auth/gen-login-url"
|
||||
// @accept image/png
|
||||
// @accept image/jpeg
|
||||
// @accept image/gif
|
||||
// @success 200
|
||||
// @success 200 {object} postImageOutput
|
||||
// @failure 401
|
||||
// @router /api/image [post]
|
||||
func (self *Handlers) PostImage(
|
||||
@@ -65,5 +71,10 @@ func (self *Handlers) PostImage(
|
||||
OriginError: err,
|
||||
}
|
||||
}
|
||||
return utils.Success(w)
|
||||
return bunrouter.JSON(w, postImageOutput{
|
||||
Id: image.Id,
|
||||
Extension: image.Extension,
|
||||
Uploader: image.Uploader,
|
||||
UploadTS: image.UploadTS,
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user