newsbot-api/internal/services/cron/ffxivJob.go

31 lines
645 B
Go
Raw Normal View History

package cron
import (
"log"
"git.jamestombleson.com/jtom38/newsbot-api/internal/domain"
"git.jamestombleson.com/jtom38/newsbot-api/internal/services/input"
)
func (c *Cron) CheckFfxiv() {
sources, err := c.repo.Sources.ListBySource(*c.ctx, 0, 10, domain.SourceCollectorFfxiv)
if err != nil {
log.Printf("[FFXIV] No sources found to query - %v\r", err)
}
for _, source := range sources {
if !source.Enabled {
continue
}
fc := input.NewFFXIVClient(source)
items, err := fc.CheckSource()
if err != nil {
log.Println(err)
}
c.SaveNewArticles(items, domain.SourceCollectorFfxiv)
}
log.Printf("[FFXIV Done!]")
}