mirror of
https://github.com/idanoo/autobrr
synced 2025-07-23 00:39:13 +00:00
feat(feeds): view latest RSS and Torznab feed (#609)
feat(feeds): view latest run
This commit is contained in:
parent
5972d421d8
commit
fd67a7b24e
11 changed files with 205 additions and 47 deletions
|
@ -172,6 +172,33 @@ func (r *FeedRepo) Find(ctx context.Context) ([]domain.Feed, error) {
|
|||
return feeds, nil
|
||||
}
|
||||
|
||||
func (r *FeedRepo) GetLastRunDataByID(ctx context.Context, id int) (string, error) {
|
||||
queryBuilder := r.db.squirrel.
|
||||
Select(
|
||||
"last_run_data",
|
||||
).
|
||||
From("feed").
|
||||
Where(sq.Eq{"id": id})
|
||||
|
||||
query, args, err := queryBuilder.ToSql()
|
||||
if err != nil {
|
||||
return "", errors.Wrap(err, "error building query")
|
||||
}
|
||||
|
||||
row := r.db.handler.QueryRowContext(ctx, query, args...)
|
||||
if err := row.Err(); err != nil {
|
||||
return "", errors.Wrap(err, "error executing query")
|
||||
}
|
||||
|
||||
var data sql.NullString
|
||||
|
||||
if err := row.Scan(&data); err != nil {
|
||||
return "", errors.Wrap(err, "error scanning row")
|
||||
}
|
||||
|
||||
return data.String, nil
|
||||
}
|
||||
|
||||
func (r *FeedRepo) Store(ctx context.Context, feed *domain.Feed) error {
|
||||
queryBuilder := r.db.squirrel.
|
||||
Insert("feed").
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue