Browse Source

auditlog repository updated

pull/3480/head
Ahmet 6 years ago
parent
commit
fd13208797
  1. 2
      modules/audit-logging/src/Volo.Abp.AuditLogging.Domain/Volo/Abp/AuditLogging/IAuditLogRepository.cs
  2. 5
      modules/audit-logging/src/Volo.Abp.AuditLogging.EntityFrameworkCore/Volo/Abp/AuditLogging/EntityFrameworkCore/EfCoreAuditLogRepository.cs
  3. 7
      modules/audit-logging/src/Volo.Abp.AuditLogging.MongoDB/Volo/Abp/AuditLogging/MongoDB/MongoAuditLogRepository.cs
  4. 2
      modules/audit-logging/test/Volo.Abp.AuditLogging.TestBase/Volo/Abp/AuditLogging/AuditLogRepository_Tests.cs

2
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<EntityChange> GetEntityChange(Guid auditLogId, Guid entityChangeId, bool includeDetails = true);
Task<EntityChange> GetEntityChange(Guid entityChangeId);
Task<List<EntityChange>> GetEntityChangeListAsync(
string sorting = null,

5
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<EntityChange> GetEntityChange(Guid auditLogId, Guid entityChangeId, bool includeDetails = true)
public Task<EntityChange> GetEntityChange(Guid entityChangeId)
{
return DbContext.Set<EntityChange>().AsNoTracking().IncludeDetails(includeDetails)
.Where(x => x.Id == entityChangeId && x.AuditLogId == auditLogId).FirstAsync();
return DbContext.Set<EntityChange>().AsNoTracking().IncludeDetails().Where(x => x.Id == entityChangeId).FirstAsync();
}
public virtual async Task<List<EntityChange>> GetEntityChangeListAsync(

7
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<EntityChange> GetEntityChange(Guid auditLogId, Guid entityChangeId, bool includeDetails = true)
public virtual async Task<EntityChange> 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<List<EntityChange>> GetEntityChangeListAsync(

2
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);
}

Loading…
Cancel
Save