Implement file upload

This commit is contained in:
2025-11-20 09:55:57 +09:00
parent 7c5c889c53
commit 5b3cb2cabd
9 changed files with 128 additions and 16 deletions

View File

@ -1,4 +1,6 @@
using System.ComponentModel.DataAnnotations;
using Hcs.WebApp.Data.Hcs.CampaignArgs;
using Newtonsoft.Json;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Hcs.WebApp.Data.Hcs
@ -35,9 +37,29 @@ namespace Hcs.WebApp.Data.Hcs
public string? FailureReason { get; set; }
public string? Args { get; set; }
public virtual ICollection<Operation>? Operations { get; set; } = null;
[NotMapped]
public bool Completed => EndedAt.HasValue;
public ICampaignArgs? DeserializeArgs()
{
if (Args == null) return null;
return JsonConvert.DeserializeObject<ICampaignArgs>(Args, new JsonSerializerSettings()
{
TypeNameHandling = TypeNameHandling.Auto
});
}
public void SerializeArgs(ICampaignArgs args)
{
Args = JsonConvert.SerializeObject(args, Formatting.None, new JsonSerializerSettings()
{
TypeNameHandling = TypeNameHandling.Auto
});
}
}
}

View File

@ -0,0 +1,7 @@
namespace Hcs.WebApp.Data.Hcs.CampaignArgs
{
public class CampaignParseArgs : ICampaignArgs
{
public int FileToParseId;
}
}

View File

@ -0,0 +1,5 @@
namespace Hcs.WebApp.Data.Hcs.CampaignArgs
{
// Маркер
public interface ICampaignArgs { }
}

View File

@ -8,9 +8,9 @@
public string FileName { get; set; }
public int UploaderId { get; set; }
public string UploaderId { get; set; }
public DateTime? UploadedAt { get; set; }
public DateTime UploadedAt { get; set; }
public DateTime? ParsedAt { get; set; }