Moved around more code. Implemented more sqlc. Added support to generate swagger.
Added support for profiling. Removed the pkg module altogether. Everything except old sync is now using code generated by sqlc.
This commit is contained in:
@@ -2,9 +2,10 @@ package server
|
||||
|
||||
import (
|
||||
"music-server/internal/backend"
|
||||
"music-server/internal/db"
|
||||
"net/http"
|
||||
|
||||
"github.com/labstack/echo"
|
||||
"github.com/labstack/echo/v4"
|
||||
)
|
||||
|
||||
type IndexHandler struct {
|
||||
@@ -14,6 +15,16 @@ func NewIndexHandler() *IndexHandler {
|
||||
return &IndexHandler{}
|
||||
}
|
||||
|
||||
// GetVersion godoc
|
||||
//
|
||||
// @Summary Getting the version of the backend
|
||||
// @Description get string by ID
|
||||
// @Tags accounts
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Success 200 {object} backend.VersionData
|
||||
// @Failure 404 {object} string
|
||||
// @Router /version [get]
|
||||
func (i *IndexHandler) GetVersion(ctx echo.Context) error {
|
||||
versionHistory := backend.GetVersionHistory()
|
||||
if versionHistory.Version == "" {
|
||||
@@ -27,6 +38,10 @@ func (i *IndexHandler) GetDBTest(ctx echo.Context) error {
|
||||
return ctx.JSON(http.StatusOK, "TestedDB")
|
||||
}
|
||||
|
||||
func (i *IndexHandler) HealthCheck(ctx echo.Context) error {
|
||||
return ctx.JSON(http.StatusOK, db.Health())
|
||||
}
|
||||
|
||||
func (i *IndexHandler) GetCharacters(ctx echo.Context) error {
|
||||
characters := backend.GetCharacters()
|
||||
return ctx.JSON(http.StatusOK, characters)
|
||||
|
||||
Reference in New Issue
Block a user