You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
928 B
30 lines
928 B
using Recyclarr.Cli.Pipelines.Generic;
|
|
using Recyclarr.Config.Models;
|
|
using Recyclarr.ServarrApi.ReleaseProfile;
|
|
|
|
namespace Recyclarr.Cli.Pipelines.ReleaseProfile.PipelinePhases;
|
|
|
|
public class ReleaseProfileApiPersistencePhase(IReleaseProfileApiService api)
|
|
: IApiPersistencePipelinePhase<ReleaseProfilePipelineContext>
|
|
{
|
|
public async Task Execute(ReleaseProfilePipelineContext context, IServiceConfiguration config)
|
|
{
|
|
var transactions = context.TransactionOutput;
|
|
|
|
foreach (var profile in transactions.UpdatedProfiles)
|
|
{
|
|
await api.UpdateReleaseProfile(config, profile);
|
|
}
|
|
|
|
foreach (var profile in transactions.CreatedProfiles)
|
|
{
|
|
await api.CreateReleaseProfile(config, profile);
|
|
}
|
|
|
|
foreach (var profile in transactions.DeletedProfiles)
|
|
{
|
|
await api.DeleteReleaseProfile(config, profile.Id);
|
|
}
|
|
}
|
|
}
|