mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-10-02 16:52:04 +02:00

Display the link to application only if it's enabled Thanks to higa on discord for pointing this to us.
44 lines
1.2 KiB
C#
44 lines
1.2 KiB
C#
using NzbDrone.Core.Applications;
|
|
|
|
namespace Prowlarr.Api.V1.Applications
|
|
{
|
|
public class ApplicationResource : ProviderResource<ApplicationResource>
|
|
{
|
|
public ApplicationSyncLevel SyncLevel { get; set; }
|
|
public bool Enable { get; set; }
|
|
public string TestCommand { get; set; }
|
|
}
|
|
|
|
public class ApplicationResourceMapper : ProviderResourceMapper<ApplicationResource, ApplicationDefinition>
|
|
{
|
|
public override ApplicationResource ToResource(ApplicationDefinition definition)
|
|
{
|
|
if (definition == null)
|
|
{
|
|
return default;
|
|
}
|
|
|
|
var resource = base.ToResource(definition);
|
|
|
|
resource.SyncLevel = definition.SyncLevel;
|
|
resource.Enable = definition.Enable;
|
|
|
|
return resource;
|
|
}
|
|
|
|
public override ApplicationDefinition ToModel(ApplicationResource resource, ApplicationDefinition existingDefinition)
|
|
{
|
|
if (resource == null)
|
|
{
|
|
return default;
|
|
}
|
|
|
|
var definition = base.ToModel(resource, existingDefinition);
|
|
|
|
definition.SyncLevel = resource.SyncLevel;
|
|
|
|
return definition;
|
|
}
|
|
}
|
|
}
|