Add campaign manager
This commit is contained in:
27
Hcs.WebApp/Data/Hcs/Campaign.cs
Normal file
27
Hcs.WebApp/Data/Hcs/Campaign.cs
Normal file
@ -0,0 +1,27 @@
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Hcs.WebApp.Data.Hcs
|
||||
{
|
||||
public class Campaign
|
||||
{
|
||||
public enum CampaignType
|
||||
{
|
||||
ExportRequiredRegistryElements_15_7_0_1
|
||||
}
|
||||
|
||||
public int Id { get; set; }
|
||||
|
||||
public CampaignType Type { get; set; }
|
||||
|
||||
public string InitiatorId { get; set; }
|
||||
|
||||
public DateTime StartedAt { get; set; }
|
||||
|
||||
public DateTime? EndedAt { get; set; }
|
||||
|
||||
public virtual ICollection<Operation> Operations { get; set; } = [];
|
||||
|
||||
[NotMapped]
|
||||
public bool Completed => EndedAt.HasValue;
|
||||
}
|
||||
}
|
||||
@ -9,10 +9,16 @@ namespace Hcs.WebApp.Data.Hcs
|
||||
|
||||
public DbSet<RegistryElement> Elements { get; set; }
|
||||
|
||||
public DbSet<Campaign> Campaigns { get; set; }
|
||||
|
||||
public DbSet<Operation> Operations { get; set; }
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
modelBuilder.Entity<Campaign>()
|
||||
.Property(x => x.Type)
|
||||
.HasConversion(new EnumToStringConverter<Campaign.CampaignType>());
|
||||
|
||||
modelBuilder.Entity<Operation>()
|
||||
.Property(x => x.Type)
|
||||
.HasConversion(new EnumToStringConverter<Operation.OperationType>());
|
||||
|
||||
@ -6,14 +6,16 @@ namespace Hcs.WebApp.Data.Hcs
|
||||
{
|
||||
public enum OperationType
|
||||
{
|
||||
NsiCommon_15_7_0_1_ExportAllRegistryElements
|
||||
NsiCommon_ExportNsiItem_15_7_0_1
|
||||
}
|
||||
|
||||
public int Id { get; set; }
|
||||
|
||||
public OperationType Type { get; set; }
|
||||
public int CampaignId { get; set; }
|
||||
|
||||
public string InitiatorId { get; set; }
|
||||
public virtual Campaign Campaign { get; set; } = null!;
|
||||
|
||||
public OperationType Type { get; set; }
|
||||
|
||||
public DateTime StartedAt { get; set; }
|
||||
|
||||
@ -21,6 +23,8 @@ namespace Hcs.WebApp.Data.Hcs
|
||||
|
||||
public string? MessageGuid { get; set; }
|
||||
|
||||
public virtual ICollection<Registry> Registries { get; set; } = [];
|
||||
|
||||
[NotMapped]
|
||||
public bool Completed => EndedAt.HasValue;
|
||||
}
|
||||
|
||||
@ -10,7 +10,13 @@
|
||||
|
||||
public bool IsCommon { get; set; }
|
||||
|
||||
public DateTime UpdatedAt { get; set; }
|
||||
public DateTime SyncedAt { get; set; }
|
||||
|
||||
public int LastSyncOperationId { get; set; }
|
||||
|
||||
public virtual Operation LastSyncOperation { get; set; }
|
||||
|
||||
public string LastSyncError { get; set; }
|
||||
|
||||
public virtual ICollection<RegistryElement> Elements { get; set; } = [];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user