diff --git a/AsbCloudApp/Data/ChangeLogAbstract.cs b/AsbCloudApp/Data/ChangeLogAbstract.cs
index 462aee9a..9e34c948 100644
--- a/AsbCloudApp/Data/ChangeLogAbstract.cs
+++ b/AsbCloudApp/Data/ChangeLogAbstract.cs
@@ -1,4 +1,5 @@
-using System;
+using AsbCloudApp.Data.User;
+using System;
namespace AsbCloudApp.Data;
@@ -13,14 +14,14 @@ public abstract class ChangeLogAbstract
public int Id { get; set; }
///
- /// Автор изменения
+ /// Автор
///
- public int IdAuthor { get; set; }
+ public UserDto? Author { get; set; }
///
- /// Редактор
+ /// Автор
///
- public int? IdEditor { get; set; }
+ public UserDto? Editor { get; set; }
///
/// Дата создания записи
diff --git a/AsbCloudInfrastructure/Repository/ProcessMapPlanBaseRepository.cs b/AsbCloudInfrastructure/Repository/ProcessMapPlanBaseRepository.cs
index 916a43b9..11b4d0fd 100644
--- a/AsbCloudInfrastructure/Repository/ProcessMapPlanBaseRepository.cs
+++ b/AsbCloudInfrastructure/Repository/ProcessMapPlanBaseRepository.cs
@@ -105,6 +105,8 @@ public class ProcessMapPlanBaseRepository : IProcessMapPlanBaseRe
var query = context
.Set()
+ .Include(e => e.Author)
+ .Include(e => e.Editor)
.Where(e => e.IdWell == idWell);
if(request.IdWellSectionType.HasValue)
@@ -133,6 +135,8 @@ public class ProcessMapPlanBaseRepository : IProcessMapPlanBaseRe
{
var query = context
.Set()
+ .Include(e => e.Author)
+ .Include(e => e.Editor)
.Where(e => e.IdWell == idWell);
var timezone = wellService.GetTimezone(idWell);
diff --git a/AsbCloudWebApi.IntegrationTests/Controllers/ProcessMapPlanDrillingControllerTest.cs b/AsbCloudWebApi.IntegrationTests/Controllers/ProcessMapPlanDrillingControllerTest.cs
index 822b582a..7bdf3135 100644
--- a/AsbCloudWebApi.IntegrationTests/Controllers/ProcessMapPlanDrillingControllerTest.cs
+++ b/AsbCloudWebApi.IntegrationTests/Controllers/ProcessMapPlanDrillingControllerTest.cs
@@ -15,8 +15,6 @@ public class ProcessMapPlanDrillingControllerTest: BaseIntegrationTest
private IProcessMapPlanDrillingClient client;
private readonly ProcessMapPlanDrillingDto dto = new (){
Id = 0,
- IdAuthor = 0,
- IdEditor = null,
Creation = new(),
Obsolete = null,
IdState = 0,
@@ -109,7 +107,7 @@ public class ProcessMapPlanDrillingControllerTest: BaseIntegrationTest
var excludeProps = new[] {
nameof(ProcessMapPlanDrillingDto.Id),
nameof(ProcessMapPlanDrillingDto.IdState),
- nameof(ProcessMapPlanDrillingDto.IdAuthor),
+ nameof(ProcessMapPlanDrillingDto.Author),
nameof(ProcessMapPlanDrillingDto.Creation),
};
MatchHelper.Match(expected, actual, excludeProps);
@@ -251,9 +249,11 @@ public class ProcessMapPlanDrillingControllerTest: BaseIntegrationTest
var expected = dtoCopy.Adapt();
var excludeProps = new[] {
- nameof(ProcessMapPlanDrillingDto.Id),
- nameof(ProcessMapPlanDrillingDto.IdAuthor),
- nameof(ProcessMapPlanDrillingDto.Creation),
+ nameof(ProcessMapPlanDrilling.Id),
+ nameof(ProcessMapPlanDrilling.Author),
+ nameof(ProcessMapPlanDrilling.IdAuthor),
+ nameof(ProcessMapPlanDrilling.Editor),
+ nameof(ProcessMapPlanDrilling.Creation),
};
MatchHelper.Match(expected, newEntity!, excludeProps);
}
@@ -377,7 +377,7 @@ public class ProcessMapPlanDrillingControllerTest: BaseIntegrationTest
var expected = entity.Adapt()!;
var excludeProps = new[] {
nameof(ProcessMapPlanDrillingDto.Id),
- nameof(ProcessMapPlanDrillingDto.IdAuthor),
+ nameof(ProcessMapPlanDrillingDto.Author),
nameof(ProcessMapPlanDrillingDto.Creation),
};
MatchHelper.Match(expected, actual, excludeProps);
@@ -453,7 +453,7 @@ public class ProcessMapPlanDrillingControllerTest: BaseIntegrationTest
var expected = entity2.Adapt()!;
var excludeProps = new[] {
nameof(ProcessMapPlanDrillingDto.Id),
- nameof(ProcessMapPlanDrillingDto.IdAuthor),
+ nameof(ProcessMapPlanDrillingDto.Author),
nameof(ProcessMapPlanDrillingDto.Creation),
};
MatchHelper.Match(expected, actual, excludeProps);
@@ -501,7 +501,7 @@ public class ProcessMapPlanDrillingControllerTest: BaseIntegrationTest
var expected = entity2.Adapt();
var excludeProps = new[] {
nameof(ProcessMapPlanDrillingDto.Id),
- nameof(ProcessMapPlanDrillingDto.IdAuthor),
+ nameof(ProcessMapPlanDrillingDto.Author),
nameof(ProcessMapPlanDrillingDto.Creation),
};
MatchHelper.Match(expected, actual, excludeProps);
diff --git a/AsbCloudWebApi.IntegrationTests/MatchHelper.cs b/AsbCloudWebApi.IntegrationTests/MatchHelper.cs
index 9bd8dfa9..32a51b61 100644
--- a/AsbCloudWebApi.IntegrationTests/MatchHelper.cs
+++ b/AsbCloudWebApi.IntegrationTests/MatchHelper.cs
@@ -8,12 +8,13 @@ public static class MatchHelper
public static void Match(T expected, T actual, IEnumerable? excludeProps = null)
{
if (ReferenceEquals(expected, actual))
- throw EqualException.ForMismatchedValues(expected, actual);
+ throw EqualException.ForMismatchedValues(expected, actual, "Reference are equals");
if (expected is null || actual is null)
throw EqualException.ForMismatchedValues(expected, actual);
- var props = typeof(T).GetProperties(
+ var type = typeof(T);
+ var props = type.GetProperties(
BindingFlags.Public
| BindingFlags.Instance).Where(prop => prop.CanWrite);
@@ -24,8 +25,11 @@ public static class MatchHelper
{
var objValue = prop.GetValue(expected);
var anotherValue = prop.GetValue(actual);
- if (objValue != null && !objValue.Equals(anotherValue))
- throw EqualException.ForMismatchedValues(expected, actual);
+ if (objValue != null && !objValue.Equals(anotherValue))
+ {
+ var banner = $" of {type.Name} props {prop.Name} ";
+ throw EqualException.ForMismatchedValues(expected, actual, banner);
+ }
}
}
}
\ No newline at end of file