refactor: declaring controller methods externally because the big idiot swaggo does not want to work unless the comments are attached to a gin handler func;
fix: swagger docs work now; chore: remove incomplete account and profile controllers; fix: correct client info type in request middleware
This commit is contained in:
@@ -25,32 +25,36 @@ import (
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
type ServiceController struct {}
|
||||
|
||||
func NewServiceController() Controller {
|
||||
|
||||
ctrl := &ServiceController{}
|
||||
|
||||
return &controllerImpl{
|
||||
Path: "/service",
|
||||
Middleware: []gin.HandlerFunc{},
|
||||
Methods: []ControllerMethod{
|
||||
|
||||
// Health godoc
|
||||
// @Summary Get health status
|
||||
// @Description Used internally for checking service health
|
||||
// @Tags Service
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Success 200 {object} HealthStatus "Says whether it's healthy or not"
|
||||
// @Router /service/health [get]
|
||||
{
|
||||
HttpMethod: GET,
|
||||
Path: "/health",
|
||||
Authorization: enums.GuestRole,
|
||||
Middleware: []gin.HandlerFunc{},
|
||||
Function: func(c *gin.Context) {
|
||||
|
||||
c.JSON(http.StatusOK, models.HealthStatusResponse{Healthy: true,})
|
||||
|
||||
},
|
||||
Function: ctrl.healthHandler,
|
||||
},
|
||||
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// @Summary Get health status
|
||||
// @Description Used internally for checking service health
|
||||
// @Tags Service
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Success 200 {object} models.HealthStatusResponse "Says whether it's healthy or not"
|
||||
// @Router /service/health [get]
|
||||
func (ctrl *ServiceController) healthHandler(c *gin.Context) {
|
||||
c.JSON(http.StatusOK, models.HealthStatusResponse{Healthy: true,})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user