Feat: add swagger notes
This commit is contained in:
23
handlers/api/deleteAlias.go
Normal file
23
handlers/api/deleteAlias.go
Normal file
@@ -0,0 +1,23 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"gitea.konchin.com/go2025/backend/utils"
|
||||
"github.com/uptrace/bunrouter"
|
||||
)
|
||||
|
||||
// DeleteAlias
|
||||
//
|
||||
// @summary Delete alias
|
||||
// @description delete alias along with the links
|
||||
// @param id path int64 true "Alias Id"
|
||||
// @success 200
|
||||
// @failure 401
|
||||
// @failure 404
|
||||
// @router /api/alias/{id} [delete]
|
||||
func (self *Handlers) DeleteAlias(
|
||||
w http.ResponseWriter, req bunrouter.Request,
|
||||
) error {
|
||||
return utils.Success(w)
|
||||
}
|
||||
23
handlers/api/deleteImage.go
Normal file
23
handlers/api/deleteImage.go
Normal file
@@ -0,0 +1,23 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"gitea.konchin.com/go2025/backend/utils"
|
||||
"github.com/uptrace/bunrouter"
|
||||
)
|
||||
|
||||
// DeleteImage
|
||||
//
|
||||
// @summary Delete image
|
||||
// @description delete image along with the links
|
||||
// @param id path int64 true "Image Id"
|
||||
// @success 200
|
||||
// @failure 401
|
||||
// @failure 404
|
||||
// @router /api/image/{id} [delete]
|
||||
func (self *Handlers) DeleteImage(
|
||||
w http.ResponseWriter, req bunrouter.Request,
|
||||
) error {
|
||||
return utils.Success(w)
|
||||
}
|
||||
19
handlers/api/getAliasUpdate.go
Normal file
19
handlers/api/getAliasUpdate.go
Normal file
@@ -0,0 +1,19 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"gitea.konchin.com/go2025/backend/utils"
|
||||
"github.com/uptrace/bunrouter"
|
||||
)
|
||||
|
||||
// GetAliasUpdate
|
||||
//
|
||||
// @summary Get notification when alias update
|
||||
// @description get update notification using websocket
|
||||
// @router /api/alias-update [get]
|
||||
func (self *Handlers) GetAliasUpdate(
|
||||
w http.ResponseWriter, req bunrouter.Request,
|
||||
) error {
|
||||
return utils.Success(w)
|
||||
}
|
||||
30
handlers/api/getAliases.go
Normal file
30
handlers/api/getAliases.go
Normal file
@@ -0,0 +1,30 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
|
||||
"github.com/uptrace/bunrouter"
|
||||
)
|
||||
|
||||
type getAliasesOutputAlias struct {
|
||||
Id int64 `json:"id"`
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
// GetAliases
|
||||
//
|
||||
// @summary Get aliases
|
||||
// @description get alias ids and names
|
||||
// @success 200 {object} []getAliasesOutputAlias
|
||||
// @failure 400
|
||||
// @failure 401
|
||||
// @router /api/aliases [get]
|
||||
func (self *Handlers) GetAliases(
|
||||
w http.ResponseWriter, req bunrouter.Request,
|
||||
) error {
|
||||
// mock output
|
||||
fmt.Fprintf(w, "%s", `[{"id": 1, "name": "yajiu"}]`)
|
||||
return nil
|
||||
// return utils.Success(w)
|
||||
}
|
||||
@@ -9,14 +9,16 @@ import (
|
||||
|
||||
type getImagesOutputImage struct {
|
||||
Id int64 `json:"id"`
|
||||
Uploader string `json:"uploaded_user_id"`
|
||||
UploadTS int64 `json:"uploaded_at"`
|
||||
Uploader string `json:"uploadedUserId"`
|
||||
UploadTS int64 `json:"uploadedAt"`
|
||||
Aliases []string `json:"aliases"`
|
||||
}
|
||||
|
||||
// GetImages
|
||||
//
|
||||
// @success 200 {object} getImagesOutputImage
|
||||
// @param images query []int64 false "Image Ids" attribute(optional)
|
||||
// @param aliases query []int64 false "Alias Ids" attribute(optional)
|
||||
// @success 200 {object} []getImagesOutputImage
|
||||
// @failure 400
|
||||
// @failure 401
|
||||
// @router /api/images [get]
|
||||
|
||||
23
handlers/api/postImage.go
Normal file
23
handlers/api/postImage.go
Normal file
@@ -0,0 +1,23 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"gitea.konchin.com/go2025/backend/utils"
|
||||
"github.com/uptrace/bunrouter"
|
||||
)
|
||||
|
||||
// PostImage
|
||||
//
|
||||
// @param userinfo header string true "userinfo from /auth/gen-login-url"
|
||||
// @accept image/png
|
||||
// @accept image/jpeg
|
||||
// @accept image/gif
|
||||
// @success 200
|
||||
// @failure 401
|
||||
// @router /api/image [post]
|
||||
func (self *Handlers) PostImage(
|
||||
w http.ResponseWriter, req bunrouter.Request,
|
||||
) error {
|
||||
return utils.Success(w)
|
||||
}
|
||||
24
handlers/api/putImageAliases.go
Normal file
24
handlers/api/putImageAliases.go
Normal file
@@ -0,0 +1,24 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"gitea.konchin.com/go2025/backend/utils"
|
||||
"github.com/uptrace/bunrouter"
|
||||
)
|
||||
|
||||
type putImageAliasesInputAlias = string
|
||||
|
||||
// PutImageAliases
|
||||
//
|
||||
// @param id path int64 true "Image Id"
|
||||
// @param payload body []putImageAliasesInputAlias true "Payload"
|
||||
// @success 200
|
||||
// @failure 401
|
||||
// @failure 404
|
||||
// @router /api/image/{id}/aliases [put]
|
||||
func (self *Handlers) PutImageAliases(
|
||||
w http.ResponseWriter, req bunrouter.Request,
|
||||
) error {
|
||||
return utils.Success(w)
|
||||
}
|
||||
28
handlers/auth/postGenLoginUrl.go
Normal file
28
handlers/auth/postGenLoginUrl.go
Normal file
@@ -0,0 +1,28 @@
|
||||
package auth
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"gitea.konchin.com/go2025/backend/utils"
|
||||
"github.com/uptrace/bunrouter"
|
||||
)
|
||||
|
||||
type postGenLoginUrlInput struct {
|
||||
UserId string `json:"userId"`
|
||||
}
|
||||
|
||||
type postGenLoginUrlOutput struct {
|
||||
LoginUrl string `json:"loginUrl"`
|
||||
}
|
||||
|
||||
// PostGenLoginUrl
|
||||
//
|
||||
// @param payload body postGenLoginUrlInput true "Payload"
|
||||
// @success 200 {object} postGenLoginUrlOutput "Payload"
|
||||
// @failure 400
|
||||
// @router /auth/gen-login-url [post]
|
||||
func (self *Handlers) PostGenLoginUrl(
|
||||
w http.ResponseWriter, req bunrouter.Request,
|
||||
) error {
|
||||
return utils.Success(w)
|
||||
}
|
||||
Reference in New Issue
Block a user