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 return backups.Select(b => new BackupResource
{ {
Id = b.Path.GetHashCode(), Id = b.Name.GetHashCode(),
Name = Path.GetFileName(b.Path), Name = b.Name,
Path = b.Path, Path = $"/backup/{b.Type.ToString().ToLower()}/{b.Name}",
Type = b.Type, Type = b.Type,
Time = b.Time Time = b.Time
}).ToList(); }).ToList();

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

@ -4,7 +4,18 @@ namespace NzbDrone.Core.Backup
{ {
public class BackupCommand : Command 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; public override bool SendUpdatesToClient => true;

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

Loading…
Cancel
Save