feat(feeds): show next run (#1074)

This commit is contained in:
ze0s 2023-09-02 23:06:21 +02:00 committed by GitHub
parent 6fd8626507
commit a6d789ee44
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 31 additions and 5 deletions

View file

@ -52,6 +52,7 @@ type Feed struct {
Indexerr FeedIndexer `json:"-"`
LastRun time.Time `json:"last_run"`
LastRunData string `json:"last_run_data"`
NextRun time.Time `json:"next_run"`
}
type FeedSettingsJSON struct {

View file

@ -91,7 +91,21 @@ func (s *service) FindByIndexerIdentifier(ctx context.Context, indexer string) (
}
func (s *service) Find(ctx context.Context) ([]domain.Feed, error) {
return s.repo.Find(ctx)
feeds, err := s.repo.Find(ctx)
if err != nil {
return nil, err
}
for i, feed := range feeds {
t, err := s.scheduler.GetNextRun(feedKey{id: feed.ID}.ToString())
if err != nil {
continue
}
feed.NextRun = t
feeds[i] = feed
}
return feeds, nil
}
func (s *service) GetCacheByID(ctx context.Context, feedId int) ([]domain.FeedCacheItem, error) {