40 lines
872 B
Go
40 lines
872 B
Go
package auth
|
|
|
|
import (
|
|
dto "quyun/v2/app/http/super/v1/dto"
|
|
"quyun/v2/app/services"
|
|
|
|
"github.com/gofiber/fiber/v3"
|
|
)
|
|
|
|
// @provider
|
|
type auth struct{}
|
|
|
|
// Login
|
|
//
|
|
// @Router /super/v1/auth/login [post]
|
|
// @Summary Login
|
|
// @Description Login
|
|
// @Tags Auth
|
|
// @Accept json
|
|
// @Produce json
|
|
// @Param form body dto.LoginForm true "Login form"
|
|
// @Success 200 {object} dto.LoginResponse
|
|
// @Bind form body
|
|
func (c *auth) Login(ctx fiber.Ctx, form *dto.LoginForm) (*dto.LoginResponse, error) {
|
|
return services.Super.Login(ctx, form)
|
|
}
|
|
|
|
// Check Token
|
|
//
|
|
// @Router /super/v1/auth/token [get]
|
|
// @Summary Check token
|
|
// @Description Check token
|
|
// @Tags Auth
|
|
// @Accept json
|
|
// @Produce json
|
|
// @Success 200 {object} dto.LoginResponse
|
|
func (c *auth) CheckToken(ctx fiber.Ctx) (*dto.LoginResponse, error) {
|
|
return services.Super.CheckToken(ctx, ctx.Get("Authorization"))
|
|
}
|