From fd132087973f9bb170d253fc8e50287563b1fe8b Mon Sep 17 00:00:00 2001 From: Ahmet Date: Fri, 3 Apr 2020 18:04:25 +0300 Subject: [PATCH] auditlog repository updated --- .../Volo/Abp/AuditLogging/IAuditLogRepository.cs | 2 +- .../EntityFrameworkCore/EfCoreAuditLogRepository.cs | 5 ++--- .../Abp/AuditLogging/MongoDB/MongoAuditLogRepository.cs | 7 ++++--- .../Volo/Abp/AuditLogging/AuditLogRepository_Tests.cs | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain/Volo/Abp/AuditLogging/IAuditLogRepository.cs b/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain/Volo/Abp/AuditLogging/IAuditLogRepository.cs index 9efc4ae0f6..0e907b2a8e 100644 --- a/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain/Volo/Abp/AuditLogging/IAuditLogRepository.cs +++ b/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain/Volo/Abp/AuditLogging/IAuditLogRepository.cs @@ -46,7 +46,7 @@ namespace Volo.Abp.AuditLogging DateTime startDate, DateTime endDate); - Task GetEntityChange(Guid auditLogId, Guid entityChangeId, bool includeDetails = true); + Task GetEntityChange(Guid entityChangeId); Task> GetEntityChangeListAsync( string sorting = null, diff --git a/modules/audit-logging/src/Volo.Abp.AuditLogging.EntityFrameworkCore/Volo/Abp/AuditLogging/EntityFrameworkCore/EfCoreAuditLogRepository.cs b/modules/audit-logging/src/Volo.Abp.AuditLogging.EntityFrameworkCore/Volo/Abp/AuditLogging/EntityFrameworkCore/EfCoreAuditLogRepository.cs index b6308c5741..80e381e02b 100644 --- a/modules/audit-logging/src/Volo.Abp.AuditLogging.EntityFrameworkCore/Volo/Abp/AuditLogging/EntityFrameworkCore/EfCoreAuditLogRepository.cs +++ b/modules/audit-logging/src/Volo.Abp.AuditLogging.EntityFrameworkCore/Volo/Abp/AuditLogging/EntityFrameworkCore/EfCoreAuditLogRepository.cs @@ -141,10 +141,9 @@ namespace Volo.Abp.AuditLogging.EntityFrameworkCore return GetQueryable().IncludeDetails(); } - public Task GetEntityChange(Guid auditLogId, Guid entityChangeId, bool includeDetails = true) + public Task GetEntityChange(Guid entityChangeId) { - return DbContext.Set().AsNoTracking().IncludeDetails(includeDetails) - .Where(x => x.Id == entityChangeId && x.AuditLogId == auditLogId).FirstAsync(); + return DbContext.Set().AsNoTracking().IncludeDetails().Where(x => x.Id == entityChangeId).FirstAsync(); } public virtual async Task> GetEntityChangeListAsync( diff --git a/modules/audit-logging/src/Volo.Abp.AuditLogging.MongoDB/Volo/Abp/AuditLogging/MongoDB/MongoAuditLogRepository.cs b/modules/audit-logging/src/Volo.Abp.AuditLogging.MongoDB/Volo/Abp/AuditLogging/MongoDB/MongoAuditLogRepository.cs index 89ed33ee5f..3541dfc88d 100644 --- a/modules/audit-logging/src/Volo.Abp.AuditLogging.MongoDB/Volo/Abp/AuditLogging/MongoDB/MongoAuditLogRepository.cs +++ b/modules/audit-logging/src/Volo.Abp.AuditLogging.MongoDB/Volo/Abp/AuditLogging/MongoDB/MongoAuditLogRepository.cs @@ -140,11 +140,12 @@ namespace Volo.Abp.AuditLogging.MongoDB return result.ToDictionary(element => element.Day.ClearTime(), element => element.avgExecutionTime); } - public virtual async Task GetEntityChange(Guid auditLogId, Guid entityChangeId, bool includeDetails = true) + public virtual async Task GetEntityChange(Guid entityChangeId) { return (await GetMongoQueryable() - .Where(x => x.Id == auditLogId && x.EntityChanges.Any(y => y.Id == entityChangeId)).FirstAsync()) - .EntityChanges.First(x => x.Id == entityChangeId); + .Where(x => x.EntityChanges.Any(y => y.Id == entityChangeId)) + .FirstAsync() + ).EntityChanges.First(x => x.Id == entityChangeId); } public virtual async Task> GetEntityChangeListAsync( diff --git a/modules/audit-logging/test/Volo.Abp.AuditLogging.TestBase/Volo/Abp/AuditLogging/AuditLogRepository_Tests.cs b/modules/audit-logging/test/Volo.Abp.AuditLogging.TestBase/Volo/Abp/AuditLogging/AuditLogRepository_Tests.cs index 78abe1862d..6de00a0f49 100644 --- a/modules/audit-logging/test/Volo.Abp.AuditLogging.TestBase/Volo/Abp/AuditLogging/AuditLogRepository_Tests.cs +++ b/modules/audit-logging/test/Volo.Abp.AuditLogging.TestBase/Volo/Abp/AuditLogging/AuditLogRepository_Tests.cs @@ -538,7 +538,7 @@ namespace Volo.Abp.AuditLogging var entityChanges = await AuditLogRepository.GetEntityChangeListAsync(); var entityChange = - await AuditLogRepository.GetEntityChange(entityChanges.First().AuditLogId, entityChanges.First().Id); + await AuditLogRepository.GetEntityChange(entityChanges.First().Id); entityChange.ChangeTime.ShouldBe(entityChanges.First().ChangeTime); }