mirror of https://github.com/abpframework/abp.git
13 changed files with 122 additions and 0 deletions
@ -0,0 +1,9 @@ |
|||
namespace Volo.Abp.AuditLogging; |
|||
|
|||
public static class AuditLogExcelFileConsts |
|||
{ |
|||
/// <summary>
|
|||
/// Default value: 256
|
|||
/// </summary>
|
|||
public static int MaxFileNameLength { get; set; } = 256; |
|||
} |
|||
@ -0,0 +1,27 @@ |
|||
using System; |
|||
using Volo.Abp.Domain.Entities.Auditing; |
|||
using Volo.Abp.MultiTenancy; |
|||
|
|||
namespace Volo.Abp.AuditLogging; |
|||
|
|||
public class AuditLogExcelFile : CreationAuditedEntity<Guid>, IMultiTenant |
|||
{ |
|||
public virtual Guid? TenantId { get; protected set; } |
|||
|
|||
public virtual string FileName { get; protected set; } |
|||
|
|||
protected AuditLogExcelFile() |
|||
{ |
|||
} |
|||
|
|||
public AuditLogExcelFile( |
|||
Guid id, |
|||
string fileName, |
|||
Guid? tenantId = null, |
|||
Guid? creatorId = null) : base(id) |
|||
{ |
|||
FileName = Check.NotNullOrWhiteSpace(fileName, nameof(fileName), AuditLogExcelFileConsts.MaxFileNameLength); |
|||
TenantId = tenantId; |
|||
CreatorId = creatorId; |
|||
} |
|||
} |
|||
@ -0,0 +1,15 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Threading; |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp.Domain.Repositories; |
|||
|
|||
namespace Volo.Abp.AuditLogging; |
|||
|
|||
public interface IAuditLogExcelFileRepository : IRepository<AuditLogExcelFile, Guid> |
|||
{ |
|||
Task<List<AuditLogExcelFile>> GetListCreationTimeBeforeAsync( |
|||
DateTime creationTimeBefore, |
|||
int maxResultCount = 50, |
|||
CancellationToken cancellationToken = default); |
|||
} |
|||
@ -0,0 +1,26 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Threading; |
|||
using System.Threading.Tasks; |
|||
using Microsoft.EntityFrameworkCore; |
|||
using Volo.Abp.Domain.Repositories.EntityFrameworkCore; |
|||
using Volo.Abp.EntityFrameworkCore; |
|||
|
|||
namespace Volo.Abp.AuditLogging.EntityFrameworkCore; |
|||
|
|||
public class EfCoreAuditLogExcelFileRepository : EfCoreRepository<IAuditLoggingDbContext, AuditLogExcelFile, Guid>, IAuditLogExcelFileRepository |
|||
{ |
|||
public EfCoreAuditLogExcelFileRepository(IDbContextProvider<IAuditLoggingDbContext> dbContextProvider) : base(dbContextProvider) |
|||
{ |
|||
} |
|||
|
|||
public async Task<List<AuditLogExcelFile>> GetListCreationTimeBeforeAsync( |
|||
DateTime creationTimeBefore, |
|||
int maxResultCount = 50, |
|||
CancellationToken cancellationToken = default) |
|||
{ |
|||
var queryable = await GetQueryableAsync(); |
|||
return await queryable.Where(x => x.CreationTime < creationTimeBefore).Take(maxResultCount).ToListAsync(cancellationToken); |
|||
} |
|||
} |
|||
@ -0,0 +1,23 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Threading; |
|||
using System.Threading.Tasks; |
|||
using MongoDB.Driver.Linq; |
|||
using Volo.Abp.Domain.Repositories.MongoDB; |
|||
using Volo.Abp.MongoDB; |
|||
|
|||
namespace Volo.Abp.AuditLogging.MongoDB; |
|||
|
|||
public class MongoAuditLogExcelFileRepository : MongoDbRepository<IAuditLoggingMongoDbContext, AuditLogExcelFile, Guid>, IAuditLogExcelFileRepository |
|||
{ |
|||
public MongoAuditLogExcelFileRepository(IMongoDbContextProvider<IAuditLoggingMongoDbContext> dbContextProvider) : base(dbContextProvider) |
|||
{ |
|||
} |
|||
|
|||
public async Task<List<AuditLogExcelFile>> GetListCreationTimeBeforeAsync(DateTime creationTimeBefore, int maxResultCount = 50, CancellationToken cancellationToken = default) |
|||
{ |
|||
var queryable = await GetQueryableAsync(); |
|||
return await queryable.Where(x => x.CreationTime < creationTimeBefore).Take(maxResultCount).ToListAsync(cancellationToken); |
|||
} |
|||
} |
|||
Loading…
Reference in new issue