Refactor: migrate discordbot
All checks were successful
All checks were successful
This commit is contained in:
@@ -7,7 +7,7 @@ import (
|
||||
"github.com/uptrace/bunrouter"
|
||||
)
|
||||
|
||||
type getAliasesOutputAlias struct {
|
||||
type GetAliasesOutputAlias struct {
|
||||
Id int64 `json:"id"`
|
||||
Name string `json:"name"`
|
||||
}
|
||||
@@ -16,7 +16,7 @@ type getAliasesOutputAlias struct {
|
||||
//
|
||||
// @summary Get aliases
|
||||
// @description get alias ids and names
|
||||
// @success 200 {object} []getAliasesOutputAlias
|
||||
// @success 200 {object} []GetAliasesOutputAlias
|
||||
// @failure 400
|
||||
// @failure 401
|
||||
// @router /api/aliases [get]
|
||||
@@ -34,10 +34,10 @@ func (self *Handlers) GetAliases(
|
||||
}
|
||||
}
|
||||
|
||||
var output []getAliasesOutputAlias
|
||||
var output []GetAliasesOutputAlias
|
||||
|
||||
for _, alias := range aliases {
|
||||
output = append(output, getAliasesOutputAlias{
|
||||
output = append(output, GetAliasesOutputAlias{
|
||||
Id: alias.Id,
|
||||
Name: alias.Name,
|
||||
})
|
||||
|
||||
@@ -13,7 +13,7 @@ import (
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
type getImagesOutputImage struct {
|
||||
type GetImagesOutputImage struct {
|
||||
Id int64 `json:"id"`
|
||||
Extension string `json:"extension"`
|
||||
Uploader string `json:"uploadedUserId"`
|
||||
@@ -25,7 +25,7 @@ type getImagesOutputImage struct {
|
||||
//
|
||||
// @param images query []int64 false "Image Ids" attribute(optional)
|
||||
// @param aliases query []int64 false "Alias Ids" attribute(optional)
|
||||
// @success 200 {object} []getImagesOutputImage
|
||||
// @success 200 {object} []GetImagesOutputImage
|
||||
// @failure 400
|
||||
// @failure 401
|
||||
// @router /api/images [get]
|
||||
@@ -83,13 +83,13 @@ func (self *Handlers) GetImages(
|
||||
}
|
||||
}
|
||||
|
||||
var output []getImagesOutputImage
|
||||
var output []GetImagesOutputImage
|
||||
for _, img := range images {
|
||||
var aliases []int64
|
||||
for _, alias := range img.Aliases {
|
||||
aliases = append(aliases, alias.Id)
|
||||
}
|
||||
output = append(output, getImagesOutputImage{
|
||||
output = append(output, GetImagesOutputImage{
|
||||
Id: img.Id,
|
||||
Extension: img.Extension,
|
||||
Uploader: img.Uploader,
|
||||
|
||||
@@ -10,18 +10,18 @@ import (
|
||||
"github.com/uptrace/bunrouter"
|
||||
)
|
||||
|
||||
type postGenLoginUrlInput struct {
|
||||
type PostGenLoginUrlInput struct {
|
||||
UserId string `json:"userId"`
|
||||
}
|
||||
|
||||
type postGenLoginUrlOutput struct {
|
||||
type PostGenLoginUrlOutput struct {
|
||||
LoginUrl string `json:"loginUrl"`
|
||||
}
|
||||
|
||||
// PostGenLoginUrl
|
||||
//
|
||||
// @param payload body postGenLoginUrlInput true "Payload"
|
||||
// @success 200 {object} postGenLoginUrlOutput "Payload"
|
||||
// @param payload body PostGenLoginUrlInput true "Payload"
|
||||
// @success 200 {object} PostGenLoginUrlOutput "Payload"
|
||||
// @failure 400
|
||||
// @router /auth/gen-login-url [post]
|
||||
func (self *Handlers) PostGenLoginUrl(
|
||||
@@ -38,7 +38,7 @@ func (self *Handlers) PostGenLoginUrl(
|
||||
}
|
||||
}
|
||||
|
||||
var input postGenLoginUrlInput
|
||||
var input PostGenLoginUrlInput
|
||||
if err := json.Unmarshal(b, &input); err != nil {
|
||||
return middlewares.HTTPError{
|
||||
StatusCode: http.StatusBadRequest,
|
||||
@@ -56,7 +56,7 @@ func (self *Handlers) PostGenLoginUrl(
|
||||
}
|
||||
}
|
||||
|
||||
return bunrouter.JSON(w, postGenLoginUrlOutput{
|
||||
return bunrouter.JSON(w, PostGenLoginUrlOutput{
|
||||
LoginUrl: viper.GetString("external-url") +
|
||||
"/login?" +
|
||||
"token=" + token,
|
||||
|
||||
Reference in New Issue
Block a user