comm: swagger doc

This commit is contained in:
fallen-angle
2022-04-30 11:30:55 +08:00
parent 09b8e8e262
commit 2482141d0f
9 changed files with 538 additions and 128 deletions

View File

@@ -15,7 +15,7 @@ import (
// @Accept json
// @Produce json
// @Summary user register account
// @Success 200 {object} utils.GinResponse{}
// @Success 200 {object} utils.GinResponse{data=models.BackUser}
// @Router /user/register [post]
// @Param json body models.UserRegister true "json"
func UserRegisterHandler(c *gin.Context) {
@@ -72,7 +72,9 @@ func UserLoginHandler(c *gin.Context) {
}
token := user.Login(jsonMap)
if token == "" {
// TODO: change to request error
// Login failed reasons as follow:
// 1. account or password incorrect
// 2. account apply not pass
utils.Succ(c, map[string]interface{}{"msg": "failed"})
return
}
@@ -87,6 +89,7 @@ func UserLoginHandler(c *gin.Context) {
// @Success 200 {object} utils.GinResponse{}
// @Router /user/registers/{approved} [get]
// @Param Token header string true "token"
// @Param approved path string true "string enums" Enums(approved, notapproved)
func ListRegisterUserHandler(c *gin.Context) {
approved := c.Param("approved")
claims := utils.ClaimsFromHeader(c)
@@ -111,7 +114,7 @@ func ListRegisterUserHandler(c *gin.Context) {
// @Produce json
// @Summary send verify code
// @Success 200 {object} utils.GinResponse{}
// @Router /user/{code} [get]
// @Router /user/code/{email} [get]
// @Param email path string true "email"
func SendEmailCodeHandler(c *gin.Context) {
email := c.Param("email")