2020-08-04 03:05:19 +00:00
|
|
|
|
using System;
|
2020-08-05 00:34:09 +00:00
|
|
|
|
using System.Threading.Tasks;
|
2020-08-04 03:05:19 +00:00
|
|
|
|
using Wabbajack.Common;
|
2020-08-05 00:34:09 +00:00
|
|
|
|
using Wabbajack.Server.DataLayer;
|
2020-08-04 03:05:19 +00:00
|
|
|
|
|
|
|
|
|
namespace Wabbajack.Server.DTOs
|
|
|
|
|
{
|
|
|
|
|
public class MirroredFile
|
|
|
|
|
{
|
|
|
|
|
public Hash Hash { get; set; }
|
|
|
|
|
public DateTime Created { get; set; }
|
|
|
|
|
public DateTime? Uploaded { get; set; }
|
|
|
|
|
public string Rationale { get; set; }
|
2020-08-05 00:34:09 +00:00
|
|
|
|
|
|
|
|
|
public string FailMessage { get; set; }
|
|
|
|
|
|
|
|
|
|
public async Task Finish(SqlService sql)
|
|
|
|
|
{
|
|
|
|
|
Uploaded = DateTime.UtcNow;
|
|
|
|
|
await sql.UpsertMirroredFile(this);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public async Task Fail(SqlService sql, string message)
|
|
|
|
|
{
|
|
|
|
|
Uploaded = DateTime.UtcNow;
|
|
|
|
|
FailMessage = message;
|
|
|
|
|
await sql.UpsertMirroredFile(this);
|
|
|
|
|
}
|
2020-08-04 03:05:19 +00:00
|
|
|
|
}
|
|
|
|
|
}
|