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.
33 lines
954 B
33 lines
954 B
using Recyclarr.TrashLib.Config.Services;
|
|
using Recyclarr.TrashLib.Services.CustomFormat.Api;
|
|
|
|
namespace Recyclarr.TrashLib.Services.CustomFormat.Processors.PersistenceSteps;
|
|
|
|
internal class CustomFormatApiPersistenceStep : ICustomFormatApiPersistenceStep
|
|
{
|
|
private readonly ICustomFormatService _api;
|
|
|
|
public CustomFormatApiPersistenceStep(ICustomFormatService api)
|
|
{
|
|
_api = api;
|
|
}
|
|
|
|
public async Task Process(IServiceConfiguration config, CustomFormatTransactionData transactions)
|
|
{
|
|
foreach (var cf in transactions.NewCustomFormats)
|
|
{
|
|
await _api.CreateCustomFormat(config, cf);
|
|
}
|
|
|
|
foreach (var cf in transactions.UpdatedCustomFormats)
|
|
{
|
|
await _api.UpdateCustomFormat(config, cf);
|
|
}
|
|
|
|
foreach (var cfId in transactions.DeletedCustomFormatIds)
|
|
{
|
|
await _api.DeleteCustomFormat(config, cfId.CustomFormatId);
|
|
}
|
|
}
|
|
}
|