Add Swag annotations to all handler endpoints for OpenAPI documentation
This commit is contained in:
@@ -15,6 +15,14 @@ func NewSyncHandler() *SyncHandler {
|
||||
return &SyncHandler{}
|
||||
}
|
||||
|
||||
// SyncProgress godoc
|
||||
// @Summary Get sync progress
|
||||
// @Description Returns the current sync progress or result
|
||||
// @Tags sync
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Success 200 {object} map[string]interface{}
|
||||
// @Router /sync/progress [get]
|
||||
func (s *SyncHandler) SyncProgress(ctx echo.Context) error {
|
||||
if backend.Syncing {
|
||||
log.Println("Getting progress")
|
||||
@@ -26,6 +34,15 @@ func (s *SyncHandler) SyncProgress(ctx echo.Context) error {
|
||||
return ctx.JSON(http.StatusOK, response)
|
||||
}
|
||||
|
||||
// SyncGamesNewOnlyChanges godoc
|
||||
// @Summary Sync games with only changes
|
||||
// @Description Starts syncing games with only new changes
|
||||
// @Tags sync
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Success 200 {string} string "Start syncing games"
|
||||
// @Failure 423 {string} string "Syncing is in progress"
|
||||
// @Router /sync [get]
|
||||
func (s *SyncHandler) SyncGamesNewOnlyChanges(ctx echo.Context) error {
|
||||
if backend.Syncing {
|
||||
log.Println("Syncing is in progress")
|
||||
@@ -36,6 +53,15 @@ func (s *SyncHandler) SyncGamesNewOnlyChanges(ctx echo.Context) error {
|
||||
return ctx.JSON(http.StatusOK, "Start syncing games")
|
||||
}
|
||||
|
||||
// SyncGamesNewFull godoc
|
||||
// @Summary Sync all games fully
|
||||
// @Description Starts a full sync of all games
|
||||
// @Tags sync
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Success 200 {string} string "Start syncing games full"
|
||||
// @Failure 423 {string} string "Syncing is in progress"
|
||||
// @Router /sync/full [get]
|
||||
func (s *SyncHandler) SyncGamesNewFull(ctx echo.Context) error {
|
||||
if backend.Syncing {
|
||||
log.Println("Syncing is in progress")
|
||||
@@ -46,6 +72,15 @@ func (s *SyncHandler) SyncGamesNewFull(ctx echo.Context) error {
|
||||
return ctx.JSON(http.StatusOK, "Start syncing games full")
|
||||
}
|
||||
|
||||
// ResetGames godoc
|
||||
// @Summary Reset games database
|
||||
// @Description Resets the games database by deleting all games and songs
|
||||
// @Tags sync
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Success 200 {string} string "Games and songs are deleted from the database"
|
||||
// @Failure 423 {string} string "Syncing is in progress"
|
||||
// @Router /sync/reset [get]
|
||||
func (s *SyncHandler) ResetGames(ctx echo.Context) error {
|
||||
if backend.Syncing {
|
||||
log.Println("Syncing is in progress")
|
||||
|
||||
Reference in New Issue
Block a user