mirror of
https://github.com/idanoo/autobrr
synced 2025-07-22 16:29:12 +00:00
fix(releases): update size after actions run (#1809)
This commit is contained in:
parent
f4c2aef38c
commit
59c5858bf0
3 changed files with 31 additions and 5 deletions
|
@ -56,6 +56,26 @@ func (repo *ReleaseRepo) Store(ctx context.Context, r *domain.Release) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func (repo *ReleaseRepo) Update(ctx context.Context, r *domain.Release) error {
|
||||
queryBuilder := repo.db.squirrel.
|
||||
Update("release").
|
||||
Set("size", r.Size).
|
||||
Where(sq.Eq{"id": r.ID})
|
||||
|
||||
query, args, err := queryBuilder.ToSql()
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "error building query")
|
||||
}
|
||||
|
||||
if _, err = repo.db.handler.ExecContext(ctx, query, args...); err != nil {
|
||||
return errors.Wrap(err, "error executing query")
|
||||
}
|
||||
|
||||
repo.log.Debug().Msgf("release.update: %d %s", r.ID, r.TorrentName)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (repo *ReleaseRepo) StoreReleaseActionStatus(ctx context.Context, status *domain.ReleaseActionStatus) error {
|
||||
if status.ID != 0 {
|
||||
queryBuilder := repo.db.squirrel.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue