2020-05-14 04:08:27 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using Wabbajack.Lib;
|
|
|
|
|
using Wabbajack.Server.DataLayer;
|
|
|
|
|
|
|
|
|
|
namespace Wabbajack.Server.DTOs
|
|
|
|
|
{
|
|
|
|
|
public class ArchiveDownload
|
|
|
|
|
{
|
|
|
|
|
public Guid Id { get; set; }
|
|
|
|
|
public Archive Archive { get; set; }
|
|
|
|
|
public bool? IsFailed { get; set; }
|
|
|
|
|
public DateTime? DownloadFinished { get; set; }
|
|
|
|
|
public string FailMessage { get; set; }
|
|
|
|
|
|
|
|
|
|
public async Task Fail(SqlService service, string message)
|
|
|
|
|
{
|
|
|
|
|
IsFailed = true;
|
|
|
|
|
DownloadFinished = DateTime.UtcNow;
|
|
|
|
|
FailMessage = message;
|
|
|
|
|
await service.UpdatePendingDownload(this);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public async Task Finish(SqlService service)
|
|
|
|
|
{
|
2020-05-20 21:48:26 +00:00
|
|
|
|
IsFailed = false;
|
2020-05-14 04:08:27 +00:00
|
|
|
|
DownloadFinished = DateTime.UtcNow;
|
|
|
|
|
await service.UpdatePendingDownload(this);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|