se implemento el patron IoC y se creo documentacion en los metodos

This commit is contained in:
jrojas
2024-11-27 12:39:26 +01:00
parent 7c08e6e218
commit 28ce635da3
44 changed files with 186 additions and 145 deletions
@@ -0,0 +1,33 @@
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using audit_logs.Models.AppSettings;
using audit_logs.Repositories;
using audit.Repositories;
using audit_logs.Repositories.Interfaces;
using audit_logs.Services;
using audit_logs.Services.Interfaces;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Options;
using MongoDB.Driver;
namespace audit_logs.Extensions;
public static class ServiceCollectionExtensions
{
public static IServiceCollection AddAuditServices(this IServiceCollection services, IConfiguration configuration)
{
// Configurar MongoDbSettingsAudit a partir del archivo de configuración appsettings.json
services.Configure<MongoDbSettingsAudit>(configuration.GetSection("DatabaseConfigurationAudit"));
// Registrar AuditService utilizando la configuración de MongoDbSettingsAudit
services.AddScoped<IAuditService, AuditService>(sp =>
{
var options = sp.GetRequiredService<IOptions<MongoDbSettingsAudit>>();
return new AuditService(options);
});
return services;
}
}
@@ -1,34 +0,0 @@
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using audit_logs.Models.AppSettings;
using audit.Repositories;
using audit_logs.Repositories.Interfaces;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Options;
using MongoDB.Driver;
namespace audit_logs.Infraestructure;
public static class ServiceCollectionExtensions
{
public static IServiceCollection AddMongoDb(this IServiceCollection services, IConfiguration configuration)
{
// Leer configuración desde el archivo appsettings.json
services.Configure<MongoDbSettings>(configuration.GetSection("MongoDbSettings"));
// Registrar MongoDbSettings como Singleton para ser usado en MongoRepository
services.AddSingleton(sp =>
{
var options = sp.GetRequiredService<IOptions<MongoDbSettings>>().Value;
var client = new MongoClient(options.ConnectionString);
return client.GetDatabase(options.DatabaseName);
});
// Registrar MongoRepository como servicio genérico
services.AddScoped(typeof(IMongoRepository<>), typeof(MongoRepository<>));
return services;
}
}
@@ -1,6 +1,6 @@
namespace audit_logs.Models.AppSettings namespace audit_logs.Models.AppSettings
{ {
public class MongoDbSettings public class MongoDbSettingsAudit
{ {
public string? ConnectionString { get; set; } public string? ConnectionString { get; set; }
public string? DatabaseName { get; set; } public string? DatabaseName { get; set; }
+1 -1
View File
@@ -31,7 +31,7 @@ public class AuditRecord
public string Reason { get; set; } public string Reason { get; set; }
[BsonElement("user_ip_address")] [BsonElement("user_ip_address")]
public string UserIpAddress { get; set; } public string? UserIpAddress { get; set; }
public class Change public class Change
{ {
@@ -19,7 +19,7 @@ public class AuditRecordRepository : MongoRepository<AuditRecord>, IAuditRecordR
{ {
} }
public AuditRecordRepository(IOptions<MongoDbSettings> dbSettings) : base(dbSettings) public AuditRecordRepository(IOptions<MongoDbSettingsAudit> dbSettings) : base(dbSettings)
{ {
} }
@@ -12,7 +12,7 @@ public abstract class MongoRepository<T> : IMongoRepository<T>
{ {
protected readonly IMongoDatabase _db; protected readonly IMongoDatabase _db;
protected MongoRepository(IOptions<MongoDbSettings> dbSettings) protected MongoRepository(IOptions<MongoDbSettingsAudit> dbSettings)
{ {
_db = MongoDbHostBuilderExtension.GetMongoDB(dbSettings); _db = MongoDbHostBuilderExtension.GetMongoDB(dbSettings);
} }
+112 -70
View File
@@ -1,3 +1,5 @@
namespace audit_logs.Services;
using System.Security.Claims; using System.Security.Claims;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using audit_logs.Models; using audit_logs.Models;
@@ -6,9 +8,6 @@ using audit_logs.Models.DTO;
using audit_logs.Services.Interfaces; using audit_logs.Services.Interfaces;
using Microsoft.Extensions.Options; using Microsoft.Extensions.Options;
using MongoDB.Bson; using MongoDB.Bson;
namespace audit_logs.Services;
using audit_logs.Repositories; using audit_logs.Repositories;
using MongoDB.Driver; using MongoDB.Driver;
using audit_logs.Utils; using audit_logs.Utils;
@@ -32,82 +31,122 @@ public class AuditService : IAuditService
{ {
_auditLogRepository = new AuditRecordRepository(database); _auditLogRepository = new AuditRecordRepository(database);
} }
public AuditService(IOptions<MongoDbSettings> dbSettings)
public AuditService(IOptions<MongoDbSettingsAudit> dbSettings)
{ {
_auditLogRepository = new AuditRecordRepository(dbSettings); _auditLogRepository = new AuditRecordRepository(dbSettings);
} }
public IAuditRecordRepository AuditLogRepository => _auditLogRepository; public IAuditRecordRepository AuditLogRepository => _auditLogRepository;
/// <summary> /// <summary>
/// Records a detailed audit log entry. /// Records a detailed audit log entry.
/// </summary> /// </summary>
/// <param name="auditLogData">The data required to create an audit record.</param> /// <param name="auditRecord">The data required to create an audit record.</param>
public async Task RecordAuditAsync(AuditRecord auditLogData) public async Task RecordAuditAsync(AuditRecord auditRecord)
{ {
if (auditLogData == null) throw new ArgumentNullException(nameof(auditLogData)); if (auditRecord == null) throw new ArgumentNullException(nameof(auditRecord));
if (string.IsNullOrWhiteSpace(auditLogData.EntityType)) if (string.IsNullOrWhiteSpace(auditRecord.EntityType))
throw new ArgumentNullException(nameof(auditLogData.EntityType)); throw new ArgumentNullException(nameof(auditRecord.EntityType));
if (string.IsNullOrWhiteSpace(auditLogData.RecordId)) if (string.IsNullOrWhiteSpace(auditRecord.RecordId))
throw new ArgumentNullException(nameof(auditLogData.RecordId)); throw new ArgumentNullException(nameof(auditRecord.RecordId));
if (string.IsNullOrWhiteSpace(auditLogData.UserId)) if (string.IsNullOrWhiteSpace(auditRecord.UserId))
throw new ArgumentNullException(nameof(auditLogData.UserId)); throw new ArgumentNullException(nameof(auditRecord.UserId));
if (string.IsNullOrWhiteSpace(auditLogData.ActionType)) if (string.IsNullOrWhiteSpace(auditRecord.ActionType))
throw new ArgumentNullException(nameof(auditLogData.ActionType)); throw new ArgumentNullException(nameof(auditRecord.ActionType));
if (auditLogData.Changes == null) throw new ArgumentNullException(nameof(auditLogData.Changes)); if (auditRecord.Changes == null) throw new ArgumentNullException(nameof(auditRecord.Changes));
if (string.IsNullOrWhiteSpace(auditLogData.UserIpAddress)) if (string.IsNullOrWhiteSpace(auditRecord.UserIpAddress))
throw new ArgumentNullException(nameof(auditLogData.UserIpAddress)); throw new ArgumentNullException(nameof(auditRecord.UserIpAddress));
var auditRecord = new AuditRecord
{
EntityType = auditLogData.EntityType,
RecordId = auditLogData.RecordId,
UserId = auditLogData.UserId,
ActionType = auditLogData.ActionType,
ActionTime = auditLogData.ActionTime,
Changes = auditLogData.Changes,
Reason = auditLogData.Reason,
UserIpAddress = auditLogData.UserIpAddress,
};
await _auditLogRepository.InsertOneAsync(auditRecord); await _auditLogRepository.InsertOneAsync(auditRecord);
} }
#region Documentacioòn para el metodo CreateAuditLogAsync
/// <summary> /// <summary>
/// Creates an audit log record based on the provided original and modified data. /// Creates an audit log record based on the provided original and modified data.
/// This method generates an <see cref="AuditRecord"/> object to encapsulate all necessary details for the audit log entry. /// This method generates an <see cref="AuditRecord"/> object to encapsulate all necessary details for the audit log entry.
/// The <see cref="AuditRecord"/> includes the following fields:
/// - <c>EntityType</c>: The type of entity being modified.
/// - <c>RecordId</c>: The unique identifier of the record being modified within the EntityType.
/// - <c>UserId</c>: The ID of the user performing the action.
/// - <c>ActionType</c>: The type of action performed ("create", "update", or "delete").
/// - <c>Reason</c>: (Optional) The reason for the action.
/// - <c>ActionTime</c>: The timestamp of the action.
/// - <c>Changes</c>: A list of differences between the original and modified data.
/// - <c>UserIpAddress</c>: The IP address of the user.
/// </summary> /// </summary>
/// <param name="user">The <see cref="ClaimsPrincipal"/> representing the user performing the action. This parameter is required.</param> /// <param name="user">
/// <param name="dataOriginal">The original object before the change, or null for new records.</param> /// The <see cref="ClaimsPrincipal"/> representing the user performing the action.
/// <param name="dataModified">The modified object after the change, or null for deleted records.</param> /// This parameter is required and is used to populate the <c>UserId</c> and optionally other user-related fields.
/// </param>
/// <param name="dataOriginal">
/// The original object before the change. This parameter can be null for new records (when <c>ActionType</c> is "create").
/// </param>
/// <param name="dataModified">
/// The modified object after the change. This parameter can be null for deleted records (when <c>ActionType</c> is "delete").
/// </param>
/// <param name="reason"> /// <param name="reason">
/// The reason for the change. If null or empty, defaults to "Not specified". /// The reason for the change. This parameter is optional; if null or empty, it defaults to "Not specified".
/// </param> /// </param>
/// <exception cref="ArgumentNullException"> /// <exception cref="ArgumentNullException">
/// Thrown if <paramref name="user"/> is null. /// Thrown if <paramref name="user"/> is null.
/// </exception> /// </exception>
/// <remarks> /// <remarks>
/// This method constructs and populates an <see cref="AuditRecord"/> object to store all details related to the audit event. /// This method constructs and populates an <see cref="AuditRecord"/> object that contains the following fields:
/// It then asynchronously saves the record using <c>RecordAuditAsync</c>. /// <list type="bullet">
/// <item>
/// <description><c>EntityType</c>: The type of entity being audited (e.g., "Patient").</description>
/// </item>
/// <item>
/// <description><c>RecordId</c>: The unique identifier of the record being modified within the entity (e.g. patient.id, nhc,etc) <c>EntityType</c>.</description>
/// </item>
/// <item>
/// <description><c>UserId</c>: The ID of the user who performed the action that triggered the audit entry.</description>
/// </item>
/// <item>
/// <description><c>ActionType</c>: The type of action performed, which can be one of the following:
/// <list type="bullet">
/// <item><description><c>"create"</c>: Indicates a new record was created.</description></item>
/// <item><description><c>"update"</c>: Indicates an existing record was updated.</description></item>
/// <item><description><c>"delete"</c>: Indicates a record was removed.</description></item>
/// </list>
/// </description>
/// </item>
/// <item>
/// <description><c>Reason</c>: (Optional) A description or justification for the action being logged.</description>
/// </item>
/// <item>
/// <description><c>ActionTime</c>: The timestamp of when the action occurred, represented in UTC.</description>
/// </item>
/// <item>
/// <description><c>Changes</c>: A list detailing the differences between the original and modified data. Each change includes:
/// <list type="bullet">
/// <item><description><c>Field</c>: The name of the field that was changed.</description></item>
/// <item><description><c>OldValue</c>: The value of the field before the change.</description></item>
/// <item><description><c>NewValue</c>: The value of the field after the change.</description></item>
/// <item><description><c>ValueType</c>: The data type of the field (e.g., "string", "int", "bool").</description></item>
/// </list>
/// </description>
/// </item>
/// <item>
/// <description><c>UserIpAddress</c>: (Optional) The IP address of the user performing the action. Useful for tracking location-based information.</description>
/// </item>
/// </list>
/// Once the <see cref="AuditRecord"/> is constructed, it is asynchronously saved using <c>RecordAuditAsync</c>.
/// </remarks> /// </remarks>
/// <returns> /// <returns>
/// A task representing the asynchronous operation of recording the audit log. /// A task representing the asynchronous operation of recording the audit log. The task completes when the audit record is successfully stored.
/// </returns> /// </returns>
/// <example>
/// Here is an example of how to use this method:
/// <code>
/// await CreateAuditLogAsync(
/// user: HttpContext.User,
/// dataOriginal: oldData,
/// dataModified: newData,
/// reason: "Updated user details"
/// );
/// </code>
/// </example>
#endregion
public async Task CreateAuditLogAsync(ClaimsPrincipal user, Object? dataOriginal, Object? dataModified, public async Task CreateAuditLogAsync(ClaimsPrincipal user, Object? dataOriginal, Object? dataModified,
string? reason) string? reason)
{ {
//auditLogData.ActionType falta este atributo
if (user == null) throw new ArgumentNullException(nameof(user)); if (user == null) throw new ArgumentNullException(nameof(user));
AuditRecord auditLogData = new AuditRecord(); AuditRecord auditLogData = new AuditRecord();
JsonComparer jsonComparer = new(); JsonComparer jsonComparer = new();
if (dataOriginal != null) if (dataOriginal != null)
@@ -139,10 +178,10 @@ public class AuditService : IAuditService
auditLogData.Reason = string.IsNullOrEmpty(reason) ? "Not specified" : reason; auditLogData.Reason = string.IsNullOrEmpty(reason) ? "Not specified" : reason;
auditLogData.UserIpAddress = string.IsNullOrEmpty(user.FindFirst("IpAddress")?.Value) auditLogData.UserIpAddress = string.IsNullOrEmpty(user.FindFirst("IpAddress")?.Value)
? "Not specified" ? "Not specified"
: user.FindFirst("IpAddress")?.Value; : user.FindFirst("IpAddress")?.Value ?? "Not specified";
auditLogData.UserId = user.FindFirst(ClaimTypes.Name)?.Value; auditLogData.UserId = user.FindFirst(ClaimTypes.Name)?.Value ?? "Not specified";
// Asignar ActionType según las condiciones // Asignar ActionType segun las condiciones
if (dataOriginal == null || string.IsNullOrEmpty(dataOriginal.ToString())) if (dataOriginal == null || string.IsNullOrEmpty(dataOriginal.ToString()))
{ {
auditLogData.ActionType = "create"; auditLogData.ActionType = "create";
@@ -209,17 +248,20 @@ public class AuditService : IAuditService
public async Task<PaginatedLogsResultDto<AuditRecordDto>> GetAuditLogsBySpecificFilterAsync( public async Task<PaginatedLogsResultDto<AuditRecordDto>> GetAuditLogsBySpecificFilterAsync(
SpecificAuditLogFilterDto filterDto) SpecificAuditLogFilterDto filterDto)
{ {
if (filterDto.pageNumber <= 0) throw new ArgumentException("Page number must be greater than 0.", nameof(filterDto.pageNumber)); if (filterDto.pageNumber <= 0)
if (filterDto.pageSize <= 0) throw new ArgumentException("Page size must be greater than 0.", nameof(filterDto.pageSize)); throw new ArgumentException("Page number must be greater than 0.", nameof(filterDto.pageNumber));
if (filterDto.pageSize <= 0)
throw new ArgumentException("Page size must be greater than 0.", nameof(filterDto.pageSize));
// Construir filtro dinámico // Construir filtro dinámico
var filter = BuildAuditLogFilter(filterDto.userId, filterDto.recordId, filterDto.entityType, filterDto.startDate, filterDto.endDate); var filter = BuildAuditLogFilter(filterDto.userId, filterDto.recordId, filterDto.entityType,
filterDto.startDate, filterDto.endDate);
var totalRecords = await _auditLogRepository.CountDocumentsAsync(filter); var totalRecords = await _auditLogRepository.CountDocumentsAsync(filter);
var totalPages = (int)Math.Ceiling((double)totalRecords / filterDto.pageSize); var totalPages = (int)Math.Ceiling((double)totalRecords / filterDto.pageSize);
var records = await _auditLogRepository.GetPaginatedAsync(filterDto.pageNumber, filterDto.pageSize, filter); var records = await _auditLogRepository.GetPaginatedAsync(filterDto.pageNumber, filterDto.pageSize, filter);
var recordsDto = records.Select(record => AuditRecordMapper.ToDto(record)).ToList(); var recordsDto = records.Select(record => AuditRecordMapper.ToDto(record)).ToList();
return new PaginatedLogsResultDto<AuditRecordDto> return new PaginatedLogsResultDto<AuditRecordDto>
{ {
@@ -230,7 +272,7 @@ public class AuditService : IAuditService
Records = recordsDto Records = recordsDto
}; };
} }
/// <summary> /// <summary>
/// Retrieves paginated audit logs with optional full-text search across multiple fields. /// Retrieves paginated audit logs with optional full-text search across multiple fields.
/// </summary> /// </summary>
@@ -241,16 +283,20 @@ public class AuditService : IAuditService
/// <param name="filtertTextOrDateDto.endDate">filter by the date the modification was made.</param> /// <param name="filtertTextOrDateDto.endDate">filter by the date the modification was made.</param>
/// <returns>A paginated list of audit records.</returns> /// <returns>A paginated list of audit records.</returns>
public async Task<PaginatedLogsResultDto<AuditRecordDto>> GetAuditLogsMatchingTextOrDateAsync( public async Task<PaginatedLogsResultDto<AuditRecordDto>> GetAuditLogsMatchingTextOrDateAsync(
AuditLogTextOrDateSearchDTO filtertTextOrDateDto) AuditLogTextOrDateSearchDTO filtertTextOrDateDto)
{ {
if (filtertTextOrDateDto.pageNumber <= 0) throw new ArgumentException("Page number must be greater than 0.", nameof(filtertTextOrDateDto.pageNumber)); if (filtertTextOrDateDto.pageNumber <= 0)
if (filtertTextOrDateDto.pageSize <= 0) throw new ArgumentException("Page size must be greater than 0.", nameof(filtertTextOrDateDto.pageSize)); throw new ArgumentException("Page number must be greater than 0.", nameof(filtertTextOrDateDto.pageNumber));
if (filtertTextOrDateDto.pageSize <= 0)
throw new ArgumentException("Page size must be greater than 0.", nameof(filtertTextOrDateDto.pageSize));
// Construct the text search filter if text_to_search is provided // Construct the text search filter if text_to_search is provided
FilterDefinition<AuditRecord> filter; FilterDefinition<AuditRecord> filter;
if (!string.IsNullOrWhiteSpace(filtertTextOrDateDto.searchText) || filtertTextOrDateDto.startDate.HasValue || filtertTextOrDateDto.endDate.HasValue) if (!string.IsNullOrWhiteSpace(filtertTextOrDateDto.searchText) || filtertTextOrDateDto.startDate.HasValue ||
filtertTextOrDateDto.endDate.HasValue)
{ {
filter = BuildAuditLogFilterByText(filtertTextOrDateDto.searchText,filtertTextOrDateDto.startDate, filtertTextOrDateDto.endDate); filter = BuildAuditLogFilterByText(filtertTextOrDateDto.searchText, filtertTextOrDateDto.startDate,
filtertTextOrDateDto.endDate);
} }
else else
{ {
@@ -259,8 +305,9 @@ public class AuditService : IAuditService
var totalRecords = await _auditLogRepository.CountDocumentsAsync(filter); var totalRecords = await _auditLogRepository.CountDocumentsAsync(filter);
var totalPages = (int)Math.Ceiling((double)totalRecords / filtertTextOrDateDto.pageSize); var totalPages = (int)Math.Ceiling((double)totalRecords / filtertTextOrDateDto.pageSize);
var records = await _auditLogRepository.GetPaginatedAsync(filtertTextOrDateDto.pageNumber, filtertTextOrDateDto.pageSize, filter); var records = await _auditLogRepository.GetPaginatedAsync(filtertTextOrDateDto.pageNumber,
var recordsDto = records.Select(record => AuditRecordMapper.ToDto(record)).ToList(); filtertTextOrDateDto.pageSize, filter);
var recordsDto = records.Select(record => AuditRecordMapper.ToDto(record)).ToList();
return new PaginatedLogsResultDto<AuditRecordDto> return new PaginatedLogsResultDto<AuditRecordDto>
{ {
@@ -310,9 +357,8 @@ public class AuditService : IAuditService
return filters.Count > 0 ? builder.And(filters) : builder.Empty; return filters.Count > 0 ? builder.And(filters) : builder.Empty;
} }
private static FilterDefinition<AuditRecord> BuildAuditLogFilterByText( private static FilterDefinition<AuditRecord> BuildAuditLogFilterByText(
string? searchText, string? searchText,
DateTime? startDate = null, DateTime? startDate = null,
@@ -358,8 +404,4 @@ public class AuditService : IAuditService
return builder.Empty; // Sin filtros, devuelve todos los documentos return builder.Empty; // Sin filtros, devuelve todos los documentos
} }
} }
@@ -8,7 +8,7 @@ using audit_logs.Models;
using MongoDB.Bson; using MongoDB.Bson;
public interface IAuditService public interface IAuditService
{ {
Task RecordAuditAsync(AuditRecord auditLogData); Task RecordAuditAsync(AuditRecord auditRecord);
Task CreateAuditLogAsync(ClaimsPrincipal user, object dataOriginal, object dataModified, string reason = null); Task CreateAuditLogAsync(ClaimsPrincipal user, object dataOriginal, object dataModified, string reason = null);
Task CreateAuditLogAsync(AuditLogData auditLogData); Task CreateAuditLogAsync(AuditLogData auditLogData);
Task<PaginatedLogsResultDto<AuditRecordDto>> GetAuditLogsBySpecificFilterAsync( Task<PaginatedLogsResultDto<AuditRecordDto>> GetAuditLogsBySpecificFilterAsync(
@@ -26,12 +26,12 @@ public static class MongoDbHostBuilderExtension
return hostBuilder; return hostBuilder;
} }
public static IMongoDatabase GetMongoDB(IOptions<MongoDbSettings> dbSettings) public static IMongoDatabase GetMongoDB(IOptions<MongoDbSettingsAudit> dbSettings)
{ {
_mongoDb ??= ConfigureMongoDbConnection(dbSettings); _mongoDb ??= ConfigureMongoDbConnection(dbSettings);
return _mongoDb; return _mongoDb;
} }
private static IMongoDatabase ConfigureMongoDbConnection(IOptions<MongoDbSettings> dbSettings) private static IMongoDatabase ConfigureMongoDbConnection(IOptions<MongoDbSettingsAudit> dbSettings)
{ {
var connectionString = dbSettings.Value.ConnectionString; var connectionString = dbSettings.Value.ConnectionString;
+1 -1
View File
@@ -8,7 +8,7 @@
<!-- Informacion para NuGet --> <!-- Informacion para NuGet -->
<PackageId>AuditLogs</PackageId> <PackageId>AuditLogs</PackageId>
<Version>1.0.17</Version> <Version>1.0.19</Version>
<Authors>Epigram</Authors> <Authors>Epigram</Authors>
<Company>Epigram</Company> <Company>Epigram</Company>
<Description>Library for recording audit logs using MongoDB.</Description> <Description>Library for recording audit logs using MongoDB.</Description>
@@ -6,7 +6,7 @@
"compilationOptions": {}, "compilationOptions": {},
"targets": { "targets": {
".NETCoreApp,Version=v8.0": { ".NETCoreApp,Version=v8.0": {
"audit-logs/1.0.17": { "audit-logs/1.0.19": {
"dependencies": { "dependencies": {
"Microsoft.Extensions.Hosting": "8.0.0", "Microsoft.Extensions.Hosting": "8.0.0",
"MongoDB.Driver": "2.23.1", "MongoDB.Driver": "2.23.1",
@@ -569,7 +569,7 @@
} }
}, },
"libraries": { "libraries": {
"audit-logs/1.0.17": { "audit-logs/1.0.19": {
"type": "project", "type": "project",
"serviceable": false, "serviceable": false,
"sha512": "" "sha512": ""
Binary file not shown.
@@ -13,11 +13,11 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("Epigram")] [assembly: System.Reflection.AssemblyCompanyAttribute("Epigram")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyDescriptionAttribute("Library for recording audit logs using MongoDB.")] [assembly: System.Reflection.AssemblyDescriptionAttribute("Library for recording audit logs using MongoDB.")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.17.0")] [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.19.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.17+8c3be106f93e44ea3daffe2267723e4026a0569d")] [assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.19+7c08e6e218b786bd1ac8663615a55b7a1bbd429a")]
[assembly: System.Reflection.AssemblyProductAttribute("audit-logs")] [assembly: System.Reflection.AssemblyProductAttribute("audit-logs")]
[assembly: System.Reflection.AssemblyTitleAttribute("audit-logs")] [assembly: System.Reflection.AssemblyTitleAttribute("audit-logs")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.17.0")] [assembly: System.Reflection.AssemblyVersionAttribute("1.0.19.0")]
[assembly: System.Reflection.AssemblyMetadataAttribute("RepositoryUrl", "https://git.teralevel.io/jrojas/audit/src/branch/master/audit-logs")] [assembly: System.Reflection.AssemblyMetadataAttribute("RepositoryUrl", "https://git.teralevel.io/jrojas/audit/src/branch/master/audit-logs")]
// Generado por la clase WriteCodeFragment de MSBuild. // Generado por la clase WriteCodeFragment de MSBuild.
@@ -1 +1 @@
320b6d684f74b89619de8f730502db744f8cdec76db8b9368a26a05e0f551580 88955e77972330336b26e79f5f072c1699f7c7a6c645f80e4ccc5579a9275d67
@@ -1 +1 @@
fee74b0a3f2ed58887d58c89fb59bc5939f2abe98f34889b8fcfd273ddc62914 f5c69936e6460786b672de95895cf942c7281cfa292c2cd886ce7c819e5725c4
@@ -5,7 +5,7 @@
}, },
"projects": { "projects": {
"/home/julian/Documentos/repos/audit/audit-logs/audit-logs/audit-logs.csproj": { "/home/julian/Documentos/repos/audit/audit-logs/audit-logs/audit-logs.csproj": {
"version": "1.0.16", "version": "1.0.17",
"restore": { "restore": {
"projectUniqueName": "/home/julian/Documentos/repos/audit/audit-logs/audit-logs/audit-logs.csproj", "projectUniqueName": "/home/julian/Documentos/repos/audit/audit-logs/audit-logs/audit-logs.csproj",
"projectName": "AuditLogs", "projectName": "AuditLogs",
@@ -2567,7 +2567,7 @@
"/home/julian/.nuget/packages/": {} "/home/julian/.nuget/packages/": {}
}, },
"project": { "project": {
"version": "1.0.16", "version": "1.0.17",
"restore": { "restore": {
"projectUniqueName": "/home/julian/Documentos/repos/audit/audit-logs/audit-logs/audit-logs.csproj", "projectUniqueName": "/home/julian/Documentos/repos/audit/audit-logs/audit-logs/audit-logs.csproj",
"projectName": "AuditLogs", "projectName": "AuditLogs",
@@ -1,6 +1,6 @@
{ {
"version": 2, "version": 2,
"dgSpecHash": "Et3G5FTIc/k=", "dgSpecHash": "dTEHYGtSsoE=",
"success": true, "success": true,
"projectFilePath": "/home/julian/Documentos/repos/audit/audit-logs/audit-logs/audit-logs.csproj", "projectFilePath": "/home/julian/Documentos/repos/audit/audit-logs/audit-logs/audit-logs.csproj",
"expectedPackageFiles": [ "expectedPackageFiles": [
@@ -1 +1 @@
17322799320339764 17326086729278728
@@ -1 +1 @@
17326086729278728 17326358893202983
@@ -28,7 +28,7 @@ public class AuditServiceFilterbyTextAndDateTests
var allRecords = await _service.AuditLogRepository.GetAllAuditRecordsAsync(); var allRecords = await _service.AuditLogRepository.GetAllAuditRecordsAsync();
// Assert // Assert
Assert.That(allRecords.Count(), Is.EqualTo(5), "All records from the JSON file should be loaded."); Assert.That(allRecords.Count(), Is.EqualTo(7), "All records from the JSON file should be loaded.");
} }
[Test] [Test]
@@ -8,7 +8,7 @@
".NETCoreApp,Version=v8.0": { ".NETCoreApp,Version=v8.0": {
"audit-test/1.0.0": { "audit-test/1.0.0": {
"dependencies": { "dependencies": {
"AuditLogs": "1.0.16", "AuditLogs": "1.0.17",
"Microsoft.Extensions.Hosting": "8.0.0", "Microsoft.Extensions.Hosting": "8.0.0",
"Microsoft.NET.Test.Sdk": "17.8.0", "Microsoft.NET.Test.Sdk": "17.8.0",
"Mongo2Go": "2.2.16", "Mongo2Go": "2.2.16",
@@ -18,7 +18,7 @@
"NUnit3TestAdapter": "4.5.0", "NUnit3TestAdapter": "4.5.0",
"coverlet.collector": "6.0.0", "coverlet.collector": "6.0.0",
"xunit": "2.9.2", "xunit": "2.9.2",
"audit-logs": "1.0.16.0" "audit-logs": "1.0.18.0"
}, },
"runtime": { "runtime": {
"audit-test.dll": {} "audit-test.dll": {}
@@ -944,7 +944,7 @@
} }
} }
}, },
"AuditLogs/1.0.16": { "AuditLogs/1.0.17": {
"dependencies": { "dependencies": {
"Microsoft.Extensions.Hosting": "8.0.0", "Microsoft.Extensions.Hosting": "8.0.0",
"MongoDB.Driver": "2.23.1", "MongoDB.Driver": "2.23.1",
@@ -953,16 +953,16 @@
}, },
"runtime": { "runtime": {
"audit-logs.dll": { "audit-logs.dll": {
"assemblyVersion": "1.0.16", "assemblyVersion": "1.0.17",
"fileVersion": "1.0.16.0" "fileVersion": "1.0.18.0"
} }
} }
}, },
"audit-logs/1.0.16.0": { "audit-logs/1.0.18.0": {
"runtime": { "runtime": {
"audit-logs.dll": { "audit-logs.dll": {
"assemblyVersion": "1.0.16.0", "assemblyVersion": "1.0.18.0",
"fileVersion": "1.0.16.0" "fileVersion": "1.0.18.0"
} }
} }
} }
@@ -1471,12 +1471,12 @@
"path": "zstdsharp.port/0.7.3", "path": "zstdsharp.port/0.7.3",
"hashPath": "zstdsharp.port.0.7.3.nupkg.sha512" "hashPath": "zstdsharp.port.0.7.3.nupkg.sha512"
}, },
"AuditLogs/1.0.16": { "AuditLogs/1.0.17": {
"type": "project", "type": "project",
"serviceable": false, "serviceable": false,
"sha512": "" "sha512": ""
}, },
"audit-logs/1.0.16.0": { "audit-logs/1.0.18.0": {
"type": "reference", "type": "reference",
"serviceable": false, "serviceable": false,
"sha512": "" "sha512": ""
@@ -13,7 +13,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("audit-test")] [assembly: System.Reflection.AssemblyCompanyAttribute("audit-test")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+8c3be106f93e44ea3daffe2267723e4026a0569d")] [assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+7c08e6e218b786bd1ac8663615a55b7a1bbd429a")]
[assembly: System.Reflection.AssemblyProductAttribute("audit-test")] [assembly: System.Reflection.AssemblyProductAttribute("audit-test")]
[assembly: System.Reflection.AssemblyTitleAttribute("audit-test")] [assembly: System.Reflection.AssemblyTitleAttribute("audit-test")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
@@ -1 +1 @@
142b1c1378f32e83f6fc5414661e98a2b515d2f45db3470d3ed86426c2d17e64 beadb3471c102aa4f942699573b0c6b6cc2905637a4cf47b218f532af9de08f7
@@ -5,7 +5,7 @@
}, },
"projects": { "projects": {
"/home/julian/Documentos/repos/audit/audit-logs/audit-logs/audit-logs.csproj": { "/home/julian/Documentos/repos/audit/audit-logs/audit-logs/audit-logs.csproj": {
"version": "1.0.16", "version": "1.0.17",
"restore": { "restore": {
"projectUniqueName": "/home/julian/Documentos/repos/audit/audit-logs/audit-logs/audit-logs.csproj", "projectUniqueName": "/home/julian/Documentos/repos/audit/audit-logs/audit-logs/audit-logs.csproj",
"projectName": "AuditLogs", "projectName": "AuditLogs",
@@ -1448,7 +1448,7 @@
"lib/net7.0/ZstdSharp.dll": {} "lib/net7.0/ZstdSharp.dll": {}
} }
}, },
"AuditLogs/1.0.16": { "AuditLogs/1.0.17": {
"type": "project", "type": "project",
"framework": ".NETCoreApp,Version=v8.0", "framework": ".NETCoreApp,Version=v8.0",
"dependencies": { "dependencies": {
@@ -3799,7 +3799,7 @@
"zstdsharp.port.nuspec" "zstdsharp.port.nuspec"
] ]
}, },
"AuditLogs/1.0.16": { "AuditLogs/1.0.17": {
"type": "project", "type": "project",
"path": "../audit-logs/audit-logs.csproj", "path": "../audit-logs/audit-logs.csproj",
"msbuildProject": "../audit-logs/audit-logs.csproj" "msbuildProject": "../audit-logs/audit-logs.csproj"
@@ -3807,7 +3807,7 @@
}, },
"projectFileDependencyGroups": { "projectFileDependencyGroups": {
"net8.0": [ "net8.0": [
"AuditLogs >= 1.0.16", "AuditLogs >= 1.0.17",
"Microsoft.Extensions.Hosting >= 8.0.0", "Microsoft.Extensions.Hosting >= 8.0.0",
"Microsoft.NET.Test.Sdk >= 17.8.0", "Microsoft.NET.Test.Sdk >= 17.8.0",
"Mongo2Go >= 2.2.16", "Mongo2Go >= 2.2.16",
@@ -1,6 +1,6 @@
{ {
"version": 2, "version": 2,
"dgSpecHash": "7Jhsnyq0q5Y=", "dgSpecHash": "f3yoSH3jMzc=",
"success": true, "success": true,
"projectFilePath": "/home/julian/Documentos/repos/audit/audit-logs/audit-test/audit-test.csproj", "projectFilePath": "/home/julian/Documentos/repos/audit/audit-logs/audit-test/audit-test.csproj",
"expectedPackageFiles": [ "expectedPackageFiles": [
@@ -75,7 +75,7 @@
"/home/julian/.nuget/packages/xunit.extensibility.core/2.9.2/xunit.extensibility.core.2.9.2.nupkg.sha512", "/home/julian/.nuget/packages/xunit.extensibility.core/2.9.2/xunit.extensibility.core.2.9.2.nupkg.sha512",
"/home/julian/.nuget/packages/xunit.extensibility.execution/2.9.2/xunit.extensibility.execution.2.9.2.nupkg.sha512", "/home/julian/.nuget/packages/xunit.extensibility.execution/2.9.2/xunit.extensibility.execution.2.9.2.nupkg.sha512",
"/home/julian/.nuget/packages/zstdsharp.port/0.7.3/zstdsharp.port.0.7.3.nupkg.sha512", "/home/julian/.nuget/packages/zstdsharp.port/0.7.3/zstdsharp.port.0.7.3.nupkg.sha512",
"/home/julian/.nuget/packages/auditlogs/1.0.16/auditlogs.1.0.16.nupkg.sha512" "/home/julian/.nuget/packages/auditlogs/1.0.17/auditlogs.1.0.17.nupkg.sha512"
], ],
"logs": [] "logs": []
} }
@@ -1 +1 @@
17322799320379764 17326086729278728
@@ -1 +1 @@
17326086729278728 17326358893202983