core/internal/app/service_server.go

29 lines
587 B
Go

package app
import (
"context"
"fmt"
"log"
"gitea.dwysokinski.me/twhelp/corev3/internal/domain"
)
type ServerService struct {
twSvc TWService
}
func NewServerService(twSvc TWService) *ServerService {
return &ServerService{twSvc: twSvc}
}
func (svc *ServerService) Sync(ctx context.Context, payload domain.SyncServersCmdPayload) error {
openServers, err := svc.twSvc.GetOpenServers(ctx, payload.URL().String())
if err != nil {
return fmt.Errorf("couldn't get open servers for version code '%s': %w", payload.VersionCode(), err)
}
log.Println(openServers)
return nil
}