mirror of
https://github.com/idanoo/autobrr
synced 2025-07-23 00:39:13 +00:00
feat(releases): replay actions (#932)
* feat(releases): replay actions * feat(releases): replay actions component * fix: update filter actions * fix: select filter_id from ras
This commit is contained in:
parent
97333d334f
commit
6898ad8315
16 changed files with 752 additions and 189 deletions
|
@ -19,7 +19,8 @@ import (
|
|||
type Service interface {
|
||||
Store(ctx context.Context, action domain.Action) (*domain.Action, error)
|
||||
List(ctx context.Context) ([]domain.Action, error)
|
||||
Delete(actionID int) error
|
||||
Get(ctx context.Context, req *domain.GetActionRequest) (*domain.Action, error)
|
||||
Delete(ctx context.Context, req *domain.DeleteActionRequest) error
|
||||
DeleteByFilterID(ctx context.Context, filterID int) error
|
||||
ToggleEnabled(actionID int) error
|
||||
|
||||
|
@ -51,18 +52,37 @@ func (s *service) Store(ctx context.Context, action domain.Action) (*domain.Acti
|
|||
return s.repo.Store(ctx, action)
|
||||
}
|
||||
|
||||
func (s *service) Delete(actionID int) error {
|
||||
return s.repo.Delete(actionID)
|
||||
func (s *service) List(ctx context.Context) ([]domain.Action, error) {
|
||||
return s.repo.List(ctx)
|
||||
}
|
||||
|
||||
func (s *service) Get(ctx context.Context, req *domain.GetActionRequest) (*domain.Action, error) {
|
||||
a, err := s.repo.Get(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// optionally attach download client to action
|
||||
if a.ClientID > 0 {
|
||||
client, err := s.clientSvc.FindByID(ctx, a.ClientID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
a.Client = client
|
||||
}
|
||||
|
||||
return a, nil
|
||||
}
|
||||
|
||||
func (s *service) Delete(ctx context.Context, req *domain.DeleteActionRequest) error {
|
||||
return s.repo.Delete(ctx, req)
|
||||
}
|
||||
|
||||
func (s *service) DeleteByFilterID(ctx context.Context, filterID int) error {
|
||||
return s.repo.DeleteByFilterID(ctx, filterID)
|
||||
}
|
||||
|
||||
func (s *service) List(ctx context.Context) ([]domain.Action, error) {
|
||||
return s.repo.List(ctx)
|
||||
}
|
||||
|
||||
func (s *service) ToggleEnabled(actionID int) error {
|
||||
return s.repo.ToggleEnabled(actionID)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue