26 lines
425 B
Go
26 lines
425 B
Go
package api
|
|
|
|
import (
|
|
"github.com/gin-gonic/gin"
|
|
"music-server/pkg/server"
|
|
"net/http"
|
|
)
|
|
|
|
type Sync struct {
|
|
}
|
|
|
|
func NewSync() *Sync {
|
|
return &Sync{}
|
|
}
|
|
|
|
func (s *Sync) SyncGames(ctx *gin.Context) {
|
|
server.SyncGames()
|
|
server.Reset()
|
|
ctx.JSON(http.StatusOK, "Games are synced")
|
|
}
|
|
|
|
func (s *Sync) ResetGames(ctx *gin.Context) {
|
|
server.ResetDB()
|
|
ctx.JSON(http.StatusOK, "Games and songs are deleted from the database")
|
|
}
|