Files
MusicServer/pkg/api/sync.go
Sebastian 5ab19e16e5 Added a new sync that uses hash
Added a new sync that uses hash and sqlc for the queries. Added db
migration. Started adding a config file.
2024-12-19 12:11:20 +01:00

39 lines
702 B
Go

package api
import (
"music-server/pkg/server"
"net/http"
"github.com/gin-gonic/gin"
)
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) SyncGamesQuick(ctx *gin.Context) {
server.SyncGamesQuick()
server.Reset()
ctx.JSON(http.StatusOK, "Games are synced")
}
func (s *Sync) SyncGamesNew(ctx *gin.Context) {
response := server.SyncGamesNew()
server.Reset()
ctx.JSON(http.StatusOK, response)
}
func (s *Sync) ResetGames(ctx *gin.Context) {
server.ResetDB()
ctx.JSON(http.StatusOK, "Games and songs are deleted from the database")
}