43 lines
1.2 KiB
Go
43 lines
1.2 KiB
Go
package application_v1
|
|
|
|
import (
|
|
"github.com/gin-gonic/gin"
|
|
"leafdev.top/Ecosystem/recommender/internal/handler/http/response"
|
|
"leafdev.top/Ecosystem/recommender/internal/service/application"
|
|
"leafdev.top/Ecosystem/recommender/internal/service/auth"
|
|
"net/http"
|
|
)
|
|
|
|
type ApplicationController struct {
|
|
authService *auth.Service
|
|
applicationService *application.Service
|
|
}
|
|
|
|
func NewApplicationController(authService *auth.Service, applicationService *application.Service) *ApplicationController {
|
|
return &ApplicationController{
|
|
authService,
|
|
applicationService,
|
|
}
|
|
}
|
|
|
|
// Info godoc
|
|
// @Summary Current Application Info
|
|
// @Description 当前的应用程序信息
|
|
// @Tags application_api
|
|
// @Accept json
|
|
// @Produce json
|
|
// @Security ApiKeyAuth
|
|
// @Success 200 {object} response.ResponseBody{data=entity.Application}
|
|
// @Failure 400 {object} response.ResponseBody
|
|
// @Router /applications/v1/info [get]
|
|
func (ac *ApplicationController) Info(c *gin.Context) {
|
|
app, err := ac.authService.GetApplication(c)
|
|
if err != nil {
|
|
response.Ctx(c).Error(err).Status(http.StatusBadRequest).Send()
|
|
return
|
|
}
|
|
|
|
response.Ctx(c).Data(app).Send()
|
|
return
|
|
}
|