diff --git a/Expedience.Infrastructure/ExpedienceContext.cs b/Expedience.Infrastructure/ExpedienceContext.cs index 7a1f3d0..2b0f46b 100644 --- a/Expedience.Infrastructure/ExpedienceContext.cs +++ b/Expedience.Infrastructure/ExpedienceContext.cs @@ -24,6 +24,15 @@ namespace Expedience.Infrastructure { cfg.ToTable("dutycompletionresult"); cfg.HasKey(e => e.Id); + + cfg.HasOne(e => e.Territory) + .WithMany(e => e.DutyCompletionResults) + .HasForeignKey(e => e.TerritoryId); + + cfg.HasOne(e => e.User) + .WithMany(e => e.DutyCompletionResults) + .HasForeignKey(e => e.UserId); + }); modelBuilder.Entity(cfg => diff --git a/Expedience.Infrastructure/Models/DutyCompletionResult.cs b/Expedience.Infrastructure/Models/DutyCompletionResult.cs index 4752fb0..1e1a6d4 100644 --- a/Expedience.Infrastructure/Models/DutyCompletionResult.cs +++ b/Expedience.Infrastructure/Models/DutyCompletionResult.cs @@ -1,4 +1,6 @@ -namespace Expedience.Infrastructure.Models +using Expedience.Models; + +namespace Expedience.Infrastructure.Models { public class DutyCompletionResult { @@ -21,6 +23,8 @@ public List DutyMembers { get; set; } public string DataCenter { get; set; } public DateTime UploadedAt { get; set; } + public Territory Territory { get; set; } + public User User { get; set; } } } diff --git a/Expedience.Infrastructure/Models/Territory.cs b/Expedience.Infrastructure/Models/Territory.cs index 9df98d6..bc504a0 100644 --- a/Expedience.Infrastructure/Models/Territory.cs +++ b/Expedience.Infrastructure/Models/Territory.cs @@ -1,4 +1,5 @@ -using System; +using Expedience.Infrastructure.Models; +using System; namespace Expedience.Models { @@ -11,5 +12,6 @@ namespace Expedience.Models public string? ContentType { get; set; } public int Level { get; set; } public string? Expac { get; set; } + public List? DutyCompletionResults { get; set; } } } diff --git a/Expedience.Infrastructure/Models/User.cs b/Expedience.Infrastructure/Models/User.cs index b0a9e2e..6a7ff7f 100644 --- a/Expedience.Infrastructure/Models/User.cs +++ b/Expedience.Infrastructure/Models/User.cs @@ -7,5 +7,6 @@ public string UserHash { get; set; } public string UserName { get; set; } public DateTime CreatedAt { get; set; } + public List? DutyCompletionResults { get; set; } } }