mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-20 21:54:25 -04:00
Fixed: Significantly improved api performance.
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NzbDrone.Api.REST;
|
||||
using NzbDrone.Core.RemotePathMappings;
|
||||
|
||||
namespace NzbDrone.Api.RemotePathMappings
|
||||
{
|
||||
@@ -9,4 +12,40 @@ namespace NzbDrone.Api.RemotePathMappings
|
||||
public string RemotePath { get; set; }
|
||||
public string LocalPath { get; set; }
|
||||
}
|
||||
|
||||
public static class RemotePathMappingResourceMapper
|
||||
{
|
||||
public static RemotePathMappingResource ToResource(this RemotePathMapping model)
|
||||
{
|
||||
if (model == null) return null;
|
||||
|
||||
return new RemotePathMappingResource
|
||||
{
|
||||
Id = model.Id,
|
||||
|
||||
Host = model.Host,
|
||||
RemotePath = model.RemotePath,
|
||||
LocalPath = model.LocalPath
|
||||
};
|
||||
}
|
||||
|
||||
public static RemotePathMapping ToModel(this RemotePathMappingResource resource)
|
||||
{
|
||||
if (resource == null) return null;
|
||||
|
||||
return new RemotePathMapping
|
||||
{
|
||||
Id = resource.Id,
|
||||
|
||||
Host = resource.Host,
|
||||
RemotePath = resource.RemotePath,
|
||||
LocalPath = resource.LocalPath
|
||||
};
|
||||
}
|
||||
|
||||
public static List<RemotePathMappingResource> ToResource(this IEnumerable<RemotePathMapping> models)
|
||||
{
|
||||
return models.Select(ToResource).ToList();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user