mirror of
https://github.com/idanoo/autobrr
synced 2025-07-23 08:49: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
|
@ -14,10 +14,11 @@ import (
|
|||
type ActionRepo interface {
|
||||
Store(ctx context.Context, action Action) (*Action, error)
|
||||
StoreFilterActions(ctx context.Context, actions []*Action, filterID int64) ([]*Action, error)
|
||||
DeleteByFilterID(ctx context.Context, filterID int) error
|
||||
FindByFilterID(ctx context.Context, filterID int) ([]*Action, error)
|
||||
List(ctx context.Context) ([]Action, error)
|
||||
Delete(actionID int) error
|
||||
Get(ctx context.Context, req *GetActionRequest) (*Action, error)
|
||||
Delete(ctx context.Context, req *DeleteActionRequest) error
|
||||
DeleteByFilterID(ctx context.Context, filterID int) error
|
||||
ToggleEnabled(actionID int) error
|
||||
}
|
||||
|
||||
|
@ -125,3 +126,11 @@ const (
|
|||
ActionContentLayoutSubfolderNone ActionContentLayout = "SUBFOLDER_NONE"
|
||||
ActionContentLayoutSubfolderCreate ActionContentLayout = "SUBFOLDER_CREATE"
|
||||
)
|
||||
|
||||
type GetActionRequest struct {
|
||||
Id int
|
||||
}
|
||||
|
||||
type DeleteActionRequest struct {
|
||||
ActionId int
|
||||
}
|
||||
|
|
|
@ -30,12 +30,14 @@ type ReleaseRepo interface {
|
|||
Store(ctx context.Context, release *Release) (*Release, error)
|
||||
Find(ctx context.Context, params ReleaseQueryParams) (res []*Release, nextCursor int64, count int64, err error)
|
||||
FindRecent(ctx context.Context) ([]*Release, error)
|
||||
Get(ctx context.Context, req *GetReleaseRequest) (*Release, error)
|
||||
GetIndexerOptions(ctx context.Context) ([]string, error)
|
||||
GetActionStatusByReleaseID(ctx context.Context, releaseID int64) ([]ReleaseActionStatus, error)
|
||||
Stats(ctx context.Context) (*ReleaseStats, error)
|
||||
StoreReleaseActionStatus(ctx context.Context, status *ReleaseActionStatus) error
|
||||
Delete(ctx context.Context) error
|
||||
CanDownloadShow(ctx context.Context, title string, season int, episode int) (bool, error)
|
||||
|
||||
GetActionStatus(ctx context.Context, req *GetReleaseActionStatusRequest) (*ReleaseActionStatus, error)
|
||||
StoreReleaseActionStatus(ctx context.Context, status *ReleaseActionStatus) error
|
||||
}
|
||||
|
||||
type Release struct {
|
||||
|
@ -100,13 +102,14 @@ type ReleaseActionStatus struct {
|
|||
ID int64 `json:"id"`
|
||||
Status ReleasePushStatus `json:"status"`
|
||||
Action string `json:"action"`
|
||||
ActionID int64 `json:"action_id"`
|
||||
Type ActionType `json:"type"`
|
||||
Client string `json:"client"`
|
||||
Filter string `json:"filter"`
|
||||
FilterID int64 `json:"-"`
|
||||
FilterID int64 `json:"filter_id"`
|
||||
Rejections []string `json:"rejections"`
|
||||
ReleaseID int64 `json:"release_id"`
|
||||
Timestamp time.Time `json:"timestamp"`
|
||||
ReleaseID int64 `json:"-"`
|
||||
}
|
||||
|
||||
func NewReleaseActionStatus(action *Action, release *Release) *ReleaseActionStatus {
|
||||
|
@ -114,9 +117,10 @@ func NewReleaseActionStatus(action *Action, release *Release) *ReleaseActionStat
|
|||
ID: 0,
|
||||
Status: ReleasePushStatusPending,
|
||||
Action: action.Name,
|
||||
ActionID: int64(action.ID),
|
||||
Type: action.Type,
|
||||
Filter: release.Filter.Name,
|
||||
FilterID: int64(release.Filter.ID),
|
||||
Filter: release.FilterName,
|
||||
FilterID: int64(release.FilterID),
|
||||
Rejections: []string{},
|
||||
Timestamp: time.Now(),
|
||||
ReleaseID: release.ID,
|
||||
|
@ -153,6 +157,8 @@ const (
|
|||
|
||||
func (r ReleasePushStatus) String() string {
|
||||
switch r {
|
||||
case ReleasePushStatusPending:
|
||||
return "Pending"
|
||||
case ReleasePushStatusApproved:
|
||||
return "Approved"
|
||||
case ReleasePushStatusRejected:
|
||||
|
@ -227,6 +233,20 @@ type ReleaseQueryParams struct {
|
|||
Search string
|
||||
}
|
||||
|
||||
type ReleaseActionRetryReq struct {
|
||||
ReleaseId int
|
||||
ActionStatusId int
|
||||
ActionId int
|
||||
}
|
||||
|
||||
type GetReleaseRequest struct {
|
||||
Id int
|
||||
}
|
||||
|
||||
type GetReleaseActionStatusRequest struct {
|
||||
Id int
|
||||
}
|
||||
|
||||
func NewRelease(indexer string) *Release {
|
||||
r := &Release{
|
||||
Indexer: indexer,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue