- Deleted old super.go file and moved all related HTTP handlers to new package structure under backend/app/http/super/v1. - Updated service imports in super.go and super_test.go to reflect new DTO paths. - Created new auth, contents, orders, tenants, and users handlers with corresponding routes and methods. - Added new DTO definitions for authentication and content management in the super/v1/dto directory. - Implemented new migration for content_access table and created model for it.
40 lines
864 B
Go
40 lines
864 B
Go
package v1
|
|
|
|
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.Context(), 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.Context())
|
|
}
|