28 lines
552 B
Go
28 lines
552 B
Go
package app
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
|
|
"gitea.dwysokinski.me/twhelp/corev3/internal/domain"
|
|
)
|
|
|
|
type TribeService struct {
|
|
twSvc TWService
|
|
}
|
|
|
|
func NewTribeService(twSvc TWService) *TribeService {
|
|
return &TribeService{twSvc: twSvc}
|
|
}
|
|
|
|
func (svc *TribeService) Sync(ctx context.Context, payload domain.ServerSyncedEventPayload) error {
|
|
tribes, err := svc.twSvc.GetTribes(ctx, payload.URL())
|
|
if err != nil {
|
|
return fmt.Errorf("couldn't get tribes for server %s: %w", payload.Key(), err)
|
|
}
|
|
|
|
fmt.Println(payload.URL(), len(tribes))
|
|
|
|
return nil
|
|
}
|