mirror of
https://github.com/idanoo/autobrr
synced 2025-07-23 00:39:13 +00:00
feat(downloadclient): set downloadClientId for arr clients (#1081)
feat(downloadclient): arrs set downloadClientId
This commit is contained in:
parent
1bfbe38335
commit
0d3e10f094
22 changed files with 154 additions and 66 deletions
|
@ -89,6 +89,7 @@ func (r *ActionRepo) findByFilterID(ctx context.Context, tx *Tx, filterID int) (
|
|||
"webhook_type",
|
||||
"webhook_method",
|
||||
"webhook_data",
|
||||
"external_client_id",
|
||||
"client_id",
|
||||
).
|
||||
From("action").
|
||||
|
@ -114,10 +115,10 @@ func (r *ActionRepo) findByFilterID(ctx context.Context, tx *Tx, filterID int) (
|
|||
var limitUl, limitDl, limitSeedTime sql.NullInt64
|
||||
var limitRatio sql.NullFloat64
|
||||
|
||||
var clientID sql.NullInt32
|
||||
var externalClientID, clientID sql.NullInt32
|
||||
var paused, ignoreRules sql.NullBool
|
||||
|
||||
if err := rows.Scan(&a.ID, &a.Name, &a.Type, &a.Enabled, &execCmd, &execArgs, &watchFolder, &category, &tags, &label, &savePath, &paused, &ignoreRules, &a.SkipHashCheck, &contentLayout, &limitDl, &limitUl, &limitRatio, &limitSeedTime, &a.ReAnnounceSkip, &a.ReAnnounceDelete, &a.ReAnnounceInterval, &a.ReAnnounceMaxAttempts, &webhookHost, &webhookType, &webhookMethod, &webhookData, &clientID); err != nil {
|
||||
if err := rows.Scan(&a.ID, &a.Name, &a.Type, &a.Enabled, &execCmd, &execArgs, &watchFolder, &category, &tags, &label, &savePath, &paused, &ignoreRules, &a.SkipHashCheck, &contentLayout, &limitDl, &limitUl, &limitRatio, &limitSeedTime, &a.ReAnnounceSkip, &a.ReAnnounceDelete, &a.ReAnnounceInterval, &a.ReAnnounceMaxAttempts, &webhookHost, &webhookType, &webhookMethod, &webhookData, &externalClientID, &clientID); err != nil {
|
||||
return nil, errors.Wrap(err, "error scanning row")
|
||||
}
|
||||
|
||||
|
@ -142,6 +143,7 @@ func (r *ActionRepo) findByFilterID(ctx context.Context, tx *Tx, filterID int) (
|
|||
a.WebhookMethod = webhookMethod.String
|
||||
a.WebhookData = webhookData.String
|
||||
|
||||
a.ExternalDownloadClientID = externalClientID.Int32
|
||||
a.ClientID = clientID.Int32
|
||||
|
||||
actions = append(actions, &a)
|
||||
|
@ -233,6 +235,7 @@ func (r *ActionRepo) List(ctx context.Context) ([]domain.Action, error) {
|
|||
"webhook_type",
|
||||
"webhook_method",
|
||||
"webhook_data",
|
||||
"external_client_id",
|
||||
"client_id",
|
||||
).
|
||||
From("action")
|
||||
|
@ -256,10 +259,10 @@ func (r *ActionRepo) List(ctx context.Context) ([]domain.Action, error) {
|
|||
var execCmd, execArgs, watchFolder, category, tags, label, savePath, contentLayout, webhookHost, webhookType, webhookMethod, webhookData sql.NullString
|
||||
var limitUl, limitDl, limitSeedTime sql.NullInt64
|
||||
var limitRatio sql.NullFloat64
|
||||
var clientID sql.NullInt32
|
||||
var externalClientID, clientID sql.NullInt32
|
||||
var paused, ignoreRules sql.NullBool
|
||||
|
||||
if err := rows.Scan(&a.ID, &a.Name, &a.Type, &a.Enabled, &execCmd, &execArgs, &watchFolder, &category, &tags, &label, &savePath, &paused, &ignoreRules, &a.SkipHashCheck, &contentLayout, &limitDl, &limitUl, &limitRatio, &limitSeedTime, &a.ReAnnounceSkip, &a.ReAnnounceDelete, &a.ReAnnounceInterval, &a.ReAnnounceMaxAttempts, &webhookHost, &webhookType, &webhookMethod, &webhookData, &clientID); err != nil {
|
||||
if err := rows.Scan(&a.ID, &a.Name, &a.Type, &a.Enabled, &execCmd, &execArgs, &watchFolder, &category, &tags, &label, &savePath, &paused, &ignoreRules, &a.SkipHashCheck, &contentLayout, &limitDl, &limitUl, &limitRatio, &limitSeedTime, &a.ReAnnounceSkip, &a.ReAnnounceDelete, &a.ReAnnounceInterval, &a.ReAnnounceMaxAttempts, &webhookHost, &webhookType, &webhookMethod, &webhookData, &externalClientID, &clientID); err != nil {
|
||||
return nil, errors.Wrap(err, "error scanning row")
|
||||
}
|
||||
|
||||
|
@ -281,6 +284,7 @@ func (r *ActionRepo) List(ctx context.Context) ([]domain.Action, error) {
|
|||
a.WebhookMethod = webhookMethod.String
|
||||
a.WebhookData = webhookData.String
|
||||
|
||||
a.ExternalDownloadClientID = externalClientID.Int32
|
||||
a.ClientID = clientID.Int32
|
||||
|
||||
actions = append(actions, a)
|
||||
|
@ -323,6 +327,7 @@ func (r *ActionRepo) Get(ctx context.Context, req *domain.GetActionRequest) (*do
|
|||
"webhook_type",
|
||||
"webhook_method",
|
||||
"webhook_data",
|
||||
"external_client_id",
|
||||
"client_id",
|
||||
"filter_id",
|
||||
).
|
||||
|
@ -348,10 +353,10 @@ func (r *ActionRepo) Get(ctx context.Context, req *domain.GetActionRequest) (*do
|
|||
var execCmd, execArgs, watchFolder, category, tags, label, savePath, contentLayout, webhookHost, webhookType, webhookMethod, webhookData sql.NullString
|
||||
var limitUl, limitDl, limitSeedTime sql.NullInt64
|
||||
var limitRatio sql.NullFloat64
|
||||
var clientID, filterID sql.NullInt32
|
||||
var externalClientID, clientID, filterID sql.NullInt32
|
||||
var paused, ignoreRules sql.NullBool
|
||||
|
||||
if err := row.Scan(&a.ID, &a.Name, &a.Type, &a.Enabled, &execCmd, &execArgs, &watchFolder, &category, &tags, &label, &savePath, &paused, &ignoreRules, &a.SkipHashCheck, &contentLayout, &limitDl, &limitUl, &limitRatio, &limitSeedTime, &a.ReAnnounceSkip, &a.ReAnnounceDelete, &a.ReAnnounceInterval, &a.ReAnnounceMaxAttempts, &webhookHost, &webhookType, &webhookMethod, &webhookData, &clientID, &filterID); err != nil {
|
||||
if err := row.Scan(&a.ID, &a.Name, &a.Type, &a.Enabled, &execCmd, &execArgs, &watchFolder, &category, &tags, &label, &savePath, &paused, &ignoreRules, &a.SkipHashCheck, &contentLayout, &limitDl, &limitUl, &limitRatio, &limitSeedTime, &a.ReAnnounceSkip, &a.ReAnnounceDelete, &a.ReAnnounceInterval, &a.ReAnnounceMaxAttempts, &webhookHost, &webhookType, &webhookMethod, &webhookData, &externalClientID, &clientID, &filterID); err != nil {
|
||||
if errors.Is(err, sql.ErrNoRows) {
|
||||
return nil, domain.ErrRecordNotFound
|
||||
}
|
||||
|
@ -380,6 +385,7 @@ func (r *ActionRepo) Get(ctx context.Context, req *domain.GetActionRequest) (*do
|
|||
a.WebhookMethod = webhookMethod.String
|
||||
a.WebhookData = webhookData.String
|
||||
|
||||
a.ExternalDownloadClientID = externalClientID.Int32
|
||||
a.ClientID = clientID.Int32
|
||||
a.FilterID = int(filterID.Int32)
|
||||
|
||||
|
@ -454,6 +460,7 @@ func (r *ActionRepo) Store(ctx context.Context, action domain.Action) (*domain.A
|
|||
"webhook_type",
|
||||
"webhook_method",
|
||||
"webhook_data",
|
||||
"external_client_id",
|
||||
"client_id",
|
||||
"filter_id",
|
||||
).
|
||||
|
@ -484,6 +491,7 @@ func (r *ActionRepo) Store(ctx context.Context, action domain.Action) (*domain.A
|
|||
toNullString(action.WebhookType),
|
||||
toNullString(action.WebhookMethod),
|
||||
toNullString(action.WebhookData),
|
||||
toNullInt32(action.ExternalDownloadClientID),
|
||||
toNullInt32(action.ClientID),
|
||||
toNullInt32(int32(action.FilterID)),
|
||||
).
|
||||
|
@ -532,6 +540,7 @@ func (r *ActionRepo) Update(ctx context.Context, action domain.Action) (*domain.
|
|||
Set("webhook_type", toNullString(action.WebhookType)).
|
||||
Set("webhook_method", toNullString(action.WebhookMethod)).
|
||||
Set("webhook_data", toNullString(action.WebhookData)).
|
||||
Set("external_client_id", toNullInt32(action.ExternalDownloadClientID)).
|
||||
Set("client_id", toNullInt32(action.ClientID)).
|
||||
Set("filter_id", toNullInt32(int32(action.FilterID))).
|
||||
Where(sq.Eq{"id": action.ID})
|
||||
|
@ -590,6 +599,7 @@ func (r *ActionRepo) StoreFilterActions(ctx context.Context, filterID int64, act
|
|||
Set("webhook_type", toNullString(action.WebhookType)).
|
||||
Set("webhook_method", toNullString(action.WebhookMethod)).
|
||||
Set("webhook_data", toNullString(action.WebhookData)).
|
||||
Set("external_client_id", toNullInt32(action.ExternalDownloadClientID)).
|
||||
Set("client_id", toNullInt32(action.ClientID)).
|
||||
Set("filter_id", toNullInt64(filterID)).
|
||||
Where(sq.Eq{"id": action.ID})
|
||||
|
@ -635,6 +645,7 @@ func (r *ActionRepo) StoreFilterActions(ctx context.Context, filterID int64, act
|
|||
"webhook_type",
|
||||
"webhook_method",
|
||||
"webhook_data",
|
||||
"external_client_id",
|
||||
"client_id",
|
||||
"filter_id",
|
||||
).
|
||||
|
@ -665,6 +676,7 @@ func (r *ActionRepo) StoreFilterActions(ctx context.Context, filterID int64, act
|
|||
toNullString(action.WebhookType),
|
||||
toNullString(action.WebhookMethod),
|
||||
toNullString(action.WebhookData),
|
||||
toNullInt32(action.ExternalDownloadClientID),
|
||||
toNullInt32(action.ClientID),
|
||||
toNullInt64(filterID),
|
||||
).
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue