Backup API improvements

pull/2119/merge
Mark McDowall 7 years ago
parent fa34af8f15
commit f3bf50e8d7
No known key found for this signature in database
GPG Key ID: D4CEFA9A718052E0

@ -21,9 +21,9 @@ namespace NzbDrone.Api.System.Backup
return backups.Select(b => new BackupResource
{
Id = b.Path.GetHashCode(),
Name = Path.GetFileName(b.Path),
Path = b.Path,
Id = b.Name.GetHashCode(),
Name = b.Name,
Path = $"/backup/{b.Type.ToString().ToLower()}/{b.Name}",
Type = b.Type,
Time = b.Time
}).ToList();

@ -4,7 +4,7 @@ namespace NzbDrone.Core.Backup
{
public class Backup
{
public string Path { get; set; }
public string Name { get; set; }
public BackupType Type { get; set; }
public DateTime Time { get; set; }
}

@ -4,7 +4,18 @@ namespace NzbDrone.Core.Backup
{
public class BackupCommand : Command
{
public BackupType Type { get; set; }
public BackupType Type
{
get
{
if (Trigger == CommandTrigger.Scheduled)
{
return BackupType.Scheduled;
}
return BackupType.Manual;
}
}
public override bool SendUpdatesToClient => true;

@ -93,7 +93,7 @@ namespace NzbDrone.Core.Backup
{
backups.AddRange(GetBackupFiles(folder).Select(b => new Backup
{
Path = Path.GetFileName(b),
Name = Path.GetFileName(b),
Type = backupType,
Time = _diskProvider.FileGetLastWrite(b)
}));

Loading…
Cancel
Save