Se hicieron cambios en los filtros, se limpian los json para evtiar subir nulos y se arreglo el error que tenia con admision
This commit is contained in:
@@ -1,19 +1,41 @@
|
|||||||
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
|
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
|
||||||
|
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AAssert_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2024_002E2_003Fresharper_002Dhost_003FSourcesCache_003F46a322d26154b982566e1817203e5452c91223f93b0e392d9c5b4806696fdc1_003FAssert_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AAsyncToSyncAdapter_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2024_002E2_003Fresharper_002Dhost_003FSourcesCache_003F9133a9652c40f25fd0942c8d926d35b748f04837845f3839b4e5803b5ec0_003FAsyncToSyncAdapter_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AAsyncToSyncAdapter_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2024_002E2_003Fresharper_002Dhost_003FSourcesCache_003F9133a9652c40f25fd0942c8d926d35b748f04837845f3839b4e5803b5ec0_003FAsyncToSyncAdapter_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AExecutionTimer_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2024_002E2_003Fresharper_002Dhost_003FSourcesCache_003F3b92f859131bde25d0f7a63de08963e995d1e1426e584dfd4b8e833d2d3dba_003FExecutionTimer_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AExecutionTimer_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2024_002E2_003Fresharper_002Dhost_003FSourcesCache_003F3b92f859131bde25d0f7a63de08963e995d1e1426e584dfd4b8e833d2d3dba_003FExecutionTimer_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||||
|
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AFilterDefinition_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2024_002E2_003Fresharper_002Dhost_003FSourcesCache_003F28494ac8cc660c0c581b2ec27539e12f5171a0ae339cc1cfe9a5901cf98349_003FFilterDefinition_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||||
|
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AIEnumerable_00601_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2024_002E2_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F9191eac31f284a10b284fabb9f96c4bcc2d600_003F49_003F999df15e_003FIEnumerable_00601_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AMessagePumpStrategy_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2024_002E2_003Fresharper_002Dhost_003FSourcesCache_003Fcf8ca8027fe683a234592509257dd2437ee65ccb37e6eeb99e7bbdc391d47_003FMessagePumpStrategy_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AMessagePumpStrategy_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2024_002E2_003Fresharper_002Dhost_003FSourcesCache_003Fcf8ca8027fe683a234592509257dd2437ee65ccb37e6eeb99e7bbdc391d47_003FMessagePumpStrategy_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AMethodBaseInvoker_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2024_002E2_003Fresharper_002Dhost_003FSourcesCache_003F3ad82f9910d5c82d76b445db10584a60305639dcad2533e08e6c47f85e3b6d83_003FMethodBaseInvoker_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AMethodBaseInvoker_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2024_002E2_003Fresharper_002Dhost_003FSourcesCache_003F3ad82f9910d5c82d76b445db10584a60305639dcad2533e08e6c47f85e3b6d83_003FMethodBaseInvoker_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||||
|
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AMethodBaseInvoker_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2024_002E2_003Fresharper_002Dhost_003FSourcesCache_003F3ad82f9910d5c82d76b445db10584a60305639dcad2533e08e6c47f85e3b6d83_003FMethodBaseInvoker_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||||
|
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AMethodWrapper_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2024_002E2_003Fresharper_002Dhost_003FSourcesCache_003F2c98ac4189b6d4c45630c6165b8e43b4feb4a6bbb658a343f5660cfbcd0e556_003FMethodWrapper_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||||
|
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AReflect_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2024_002E2_003Fresharper_002Dhost_003FSourcesCache_003F538e3b0f6405dc6d87f23e7f33756211ea334b874b2da9ad4acb273a48113_003FReflect_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ATaskAwaitAdapter_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2024_002E2_003Fresharper_002Dhost_003FSourcesCache_003F3fad8e3b42a0f7ae367986c4177c844d48c22c6e8a9ebc5ec7c60ad5e677267_003FTaskAwaitAdapter_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ATaskAwaitAdapter_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2024_002E2_003Fresharper_002Dhost_003FSourcesCache_003F3fad8e3b42a0f7ae367986c4177c844d48c22c6e8a9ebc5ec7c60ad5e677267_003FTaskAwaitAdapter_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||||
|
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ATaskAwaitAdapter_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2024_002E2_003Fresharper_002Dhost_003FSourcesCache_003F3fad8e3b42a0f7ae367986c4177c844d48c22c6e8a9ebc5ec7c60ad5e677267_003FTaskAwaitAdapter_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ATestInvoker_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2024_002E2_003Fresharper_002Dhost_003FSourcesCache_003F5e14a4e27990972fa4ae94975603bd298aaf328ee083c03b10569ee4724d57_003FTestInvoker_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ATestInvoker_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2024_002E2_003Fresharper_002Dhost_003FSourcesCache_003F5e14a4e27990972fa4ae94975603bd298aaf328ee083c03b10569ee4724d57_003FTestInvoker_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||||
<s:String x:Key="/Default/Environment/UnitTesting/UnitTestSessionStore/Sessions/=5c25c1e3_002D715f_002D443f_002D85ea_002Deb33bc1449eb/@EntryIndexedValue"><SessionState ContinuousTestingMode="0" IsActive="True" Name="AuditRecordRepositoryTests" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session">
|
<s:String x:Key="/Default/Environment/UnitTesting/UnitTestSessionStore/Sessions/=5c25c1e3_002D715f_002D443f_002D85ea_002Deb33bc1449eb/@EntryIndexedValue"><SessionState ContinuousTestingMode="0" Name="AuditRecordRepositoryTests" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session">
|
||||||
|
<Project Location="/home/julian/Documentos/repos/audit/audit-logs/audit-test" Presentation="&lt;audit-test&gt;" />
|
||||||
|
</SessionState></s:String>
|
||||||
|
<s:String x:Key="/Default/Environment/UnitTesting/UnitTestSessionStore/Sessions/=71375b51_002D357b_002D4f69_002Da9dc_002D71fc12f6a8a3/@EntryIndexedValue"><SessionState ContinuousTestingMode="0" Name="GetAuditLogsAsync_FilterByDateRange_ReturnsCorrectRecords #2" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session">
|
||||||
<TestAncestor>
|
<TestAncestor>
|
||||||
<TestId>NUnit3x::053B6D24-445B-439A-AD42-80D31DC53059::net8.0::audit_test.Repository.AuditRecordRepositoryTests</TestId>
|
<TestId>NUnit3x::053B6D24-445B-439A-AD42-80D31DC53059::net8.0::audit_test.Repository.AuditServiceFilterbyTextAndDateTests.GetAuditLogsAsync_FilterByDateRange_ReturnsCorrectRecords</TestId>
|
||||||
<TestId>NUnit3x::053B6D24-445B-439A-AD42-80D31DC53059::net8.0::audit_test.AuditServiceIntegrationTests</TestId>
|
<TestId>NUnit3x::053B6D24-445B-439A-AD42-80D31DC53059::net8.0::audit_test.Repository.AuditServiceFilterTests.GetAuditLogsAsync_FilterByDateRange_ReturnsCorrectRecords</TestId>
|
||||||
<TestId>NUnit3x::053B6D24-445B-439A-AD42-80D31DC53059::net8.0::audit_test.Service.AuditServiceIntegrationTests</TestId>
|
|
||||||
<TestId>xUnit::053B6D24-445B-439A-AD42-80D31DC53059::net8.0::audit_test.Service.AuditServiceTests</TestId>
|
|
||||||
<TestId>NUnit3x::053B6D24-445B-439A-AD42-80D31DC53059::net8.0::audit_test.Repository.AuditServiceIntegrationTests</TestId>
|
|
||||||
</TestAncestor>
|
</TestAncestor>
|
||||||
</SessionState></s:String>
|
</SessionState></s:String>
|
||||||
<s:String x:Key="/Default/Environment/UnitTesting/UnitTestSessionStore/Sessions/=e7280f2a_002D5b45_002D4bb8_002Db12f_002D674403112dab/@EntryIndexedValue"><SessionState ContinuousTestingMode="0" Name="RecordAuditAsync_ValidRecord_InsertsRecord" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session">
|
<s:String x:Key="/Default/Environment/UnitTesting/UnitTestSessionStore/Sessions/=76097418_002Db1d6_002D43a3_002D9e2a_002D9715294cfd8b/@EntryIndexedValue"><SessionState ContinuousTestingMode="0" Name="GetAuditLogsAsync_FilterByDateRange_ReturnsCorrectRecords #3" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session">
|
||||||
|
<TestAncestor>
|
||||||
|
<TestId>NUnit3x::053B6D24-445B-439A-AD42-80D31DC53059::net8.0::audit_test.Repository.AuditServiceFilterbyTextAndDateTests.GetAuditLogsAsync_FilterByDateRange_ReturnsCorrectRecords</TestId>
|
||||||
|
</TestAncestor>
|
||||||
|
</SessionState></s:String>
|
||||||
|
<s:String x:Key="/Default/Environment/UnitTesting/UnitTestSessionStore/Sessions/=b6b33046_002De69c_002D486b_002Da14b_002D422c721c36e0/@EntryIndexedValue"><SessionState ContinuousTestingMode="0" Name="VerifyAllRecordsLoaded_ReturnsCorrectCount" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session">
|
||||||
|
<TestAncestor>
|
||||||
|
<TestId>NUnit3x::053B6D24-445B-439A-AD42-80D31DC53059::net8.0::audit_test.Repository.AuditServiceFilterbyTextAndDateTests</TestId>
|
||||||
|
</TestAncestor>
|
||||||
|
</SessionState></s:String>
|
||||||
|
<s:String x:Key="/Default/Environment/UnitTesting/UnitTestSessionStore/Sessions/=dc0c1757_002D86d4_002D46f7_002D9951_002D514ccda9e8cc/@EntryIndexedValue"><SessionState ContinuousTestingMode="0" Name="GetAuditLogsAsync_FilterByDateRange_ReturnsCorrectRecords" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session">
|
||||||
|
<TestAncestor>
|
||||||
|
<TestId>NUnit3x::053B6D24-445B-439A-AD42-80D31DC53059::net8.0::audit_test.Repository.AuditServiceFilterTests.GetAuditLogsAsync_FilterByDateRange_ReturnsCorrectRecords</TestId>
|
||||||
|
</TestAncestor>
|
||||||
|
</SessionState></s:String>
|
||||||
|
<s:String x:Key="/Default/Environment/UnitTesting/UnitTestSessionStore/Sessions/=e7280f2a_002D5b45_002D4bb8_002Db12f_002D674403112dab/@EntryIndexedValue"><SessionState ContinuousTestingMode="0" IsActive="True" Name="RecordAuditAsync_ValidRecord_InsertsRecord" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session">
|
||||||
<Project Location="/home/julian/Documentos/repos/audit/audit-logs/audit-test" Presentation="&lt;audit-test&gt;" />
|
<Project Location="/home/julian/Documentos/repos/audit/audit-logs/audit-test" Presentation="&lt;audit-test&gt;" />
|
||||||
</SessionState></s:String></wpf:ResourceDictionary>
|
</SessionState></s:String></wpf:ResourceDictionary>
|
||||||
@@ -2,8 +2,6 @@
|
|||||||
{
|
{
|
||||||
public class MongoDbSettings
|
public class MongoDbSettings
|
||||||
{
|
{
|
||||||
public const string Database = "DatabaseSettings";
|
|
||||||
|
|
||||||
public string? ConnectionString { get; set; }
|
public string? ConnectionString { get; set; }
|
||||||
public string? DatabaseName { get; set; }
|
public string? DatabaseName { get; set; }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ public class AuditLogData
|
|||||||
public string ActionType { get; set; }
|
public string ActionType { get; set; }
|
||||||
public string Reason { get; set; }
|
public string Reason { get; set; }
|
||||||
public DateTime ActionTime { get; set; }
|
public DateTime ActionTime { get; set; }
|
||||||
public string OriginalJson { get; set; }
|
public Object OriginalJson { get; set; }
|
||||||
public string ModifiedJson { get; set; }
|
public string ModifiedJson { get; set; }
|
||||||
public string UserIpAddress { get; set; }
|
public string UserIpAddress { get; set; }
|
||||||
}
|
}
|
||||||
@@ -3,6 +3,7 @@ using MongoDB.Bson;
|
|||||||
using MongoDB.Bson.Serialization.Attributes;
|
using MongoDB.Bson.Serialization.Attributes;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
public class AuditRecord
|
public class AuditRecord
|
||||||
{
|
{
|
||||||
[BsonId]
|
[BsonId]
|
||||||
@@ -45,5 +46,55 @@ public class AuditRecord
|
|||||||
|
|
||||||
[BsonElement("value_type")]
|
[BsonElement("value_type")]
|
||||||
public string ValueType { get; set; }
|
public string ValueType { get; set; }
|
||||||
|
|
||||||
|
public static object ConvertBsonValue(BsonValue bsonValue)
|
||||||
|
{
|
||||||
|
if (bsonValue == null || bsonValue.IsBsonNull)
|
||||||
|
{
|
||||||
|
return null; // Devuelve nulo si el valor BSON es nulo o no existe
|
||||||
|
}
|
||||||
|
switch (bsonValue.BsonType)
|
||||||
|
{
|
||||||
|
case BsonType.String:
|
||||||
|
return bsonValue.AsString;
|
||||||
|
case BsonType.Int32:
|
||||||
|
return bsonValue.AsInt32;
|
||||||
|
case BsonType.Int64:
|
||||||
|
return bsonValue.AsInt64;
|
||||||
|
case BsonType.Boolean:
|
||||||
|
return bsonValue.AsBoolean;
|
||||||
|
case BsonType.DateTime:
|
||||||
|
return bsonValue.ToUniversalTime();
|
||||||
|
case BsonType.Double:
|
||||||
|
return bsonValue.AsDouble;
|
||||||
|
case BsonType.ObjectId:
|
||||||
|
return bsonValue.AsObjectId.ToString();
|
||||||
|
/*case BsonType.Document:
|
||||||
|
return bsonValue.ToJson(); */
|
||||||
|
case BsonType.Array:
|
||||||
|
var array = bsonValue.AsBsonArray;
|
||||||
|
var resultList = new List<object>();
|
||||||
|
foreach (var item in array)
|
||||||
|
{
|
||||||
|
resultList.Add(ConvertBsonValue(item));
|
||||||
|
}
|
||||||
|
return resultList;
|
||||||
|
case BsonType.Document:
|
||||||
|
// Convert BSON Document to Dictionary
|
||||||
|
var document = bsonValue.AsBsonDocument;
|
||||||
|
var dictionary = new Dictionary<string, object>();
|
||||||
|
foreach (var element in document)
|
||||||
|
{
|
||||||
|
dictionary[element.Name] = ConvertBsonValue(element.Value);
|
||||||
|
}
|
||||||
|
return dictionary;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return bsonValue.ToJson(); // Convert to string if type is not directly supported
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
namespace audit_logs.Models.DTO;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// DTO que encapsula los parámetros de búsqueda por texto para los registros de auditoría, incluyendo detalles de paginación.
|
||||||
|
/// </summary>
|
||||||
|
public class AuditLogTextOrDateSearchDTO
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the page number for pagination.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>
|
||||||
|
/// The number of the page to retrieve. Defaults to 1.
|
||||||
|
/// </value>
|
||||||
|
public int pageNumber { get; set; } = 1;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the size of the page for pagination.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>
|
||||||
|
/// The number of records per page. Defaults to 10.
|
||||||
|
/// </value>
|
||||||
|
public int pageSize { get; set; } = 10;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Optional text to search for in any text field in the audit logs.
|
||||||
|
/// </summary>
|
||||||
|
public string? searchText { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the date and time at which the audit action is performed..
|
||||||
|
/// </summary>
|
||||||
|
/// <value>
|
||||||
|
/// The specific timestamp of the audit action. Optional.
|
||||||
|
/// </value>
|
||||||
|
public DateTime? actionTime { get; set; } = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the start date for filtering audit logs by date range.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>
|
||||||
|
/// The earliest date to include in the results. Optional.
|
||||||
|
/// </value>
|
||||||
|
public DateTime? startDate { get; set; } = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the end date for filtering audit logs by date range.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>
|
||||||
|
/// The latest date to include in the results. Optional.
|
||||||
|
/// </value>
|
||||||
|
public DateTime? endDate { get; set; } = null;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
namespace audit_logs.Models;
|
||||||
|
|
||||||
|
|
||||||
|
public class AuditRecordDto
|
||||||
|
{
|
||||||
|
public string Id { get; set; }
|
||||||
|
public string EntityType { get; set; }
|
||||||
|
public string RecordId { get; set; }
|
||||||
|
public string UserId { get; set; }
|
||||||
|
public string ActionType { get; set; }
|
||||||
|
public DateTime ActionTime { get; set; }
|
||||||
|
public List<ChangeDto> Changes { get; set; }
|
||||||
|
public string Reason { get; set; }
|
||||||
|
public string UserIpAddress { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ChangeDto
|
||||||
|
{
|
||||||
|
public string Field { get; set; }
|
||||||
|
public object OldValue { get; set; }
|
||||||
|
public object NewValue { get; set; }
|
||||||
|
public string ValueType { get; set; }
|
||||||
|
}
|
||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
namespace audit_logs.Models;
|
namespace audit_logs.Models;
|
||||||
|
|
||||||
public class PaginatedLogsResult<T>
|
public class PaginatedLogsResultDto<T>
|
||||||
{
|
{
|
||||||
public int CurrentPage { get; set; }
|
public int CurrentPage { get; set; }
|
||||||
public int PageSize { get; set; }
|
public int PageSize { get; set; }
|
||||||
@@ -0,0 +1,72 @@
|
|||||||
|
namespace audit_logs.Models.DTO
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Data Transfer Object (DTO) for filtering and paginating audit log records.
|
||||||
|
/// </summary>
|
||||||
|
public class SpecificAuditLogFilterDto
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the page number for pagination.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>
|
||||||
|
/// The number of the page to retrieve. Defaults to 1.
|
||||||
|
/// </value>
|
||||||
|
public int pageNumber { get; set; } = 1;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the size of the page for pagination.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>
|
||||||
|
/// The number of records per page. Defaults to 10.
|
||||||
|
/// </value>
|
||||||
|
public int pageSize { get; set; } = 10;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the user ID associated with the author of updates to audit records
|
||||||
|
/// </summary>
|
||||||
|
/// <value>
|
||||||
|
/// The ID of the user who performed the action. Optional.
|
||||||
|
/// </value>
|
||||||
|
public string? userId { get; set; } = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the record ID within the EntityType collection to search for audit records.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>
|
||||||
|
/// The ID of the record affected by the audit action, for example, patien_id Optional.
|
||||||
|
/// </value>
|
||||||
|
public string? recordId { get; set; } = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the type of entity (collection) associated with the audit records.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>
|
||||||
|
/// The type of the audited entity (collection) (e.g., "Patient", "Order"). Optional.
|
||||||
|
/// </value>
|
||||||
|
public string? entityType { get; set; } = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the date and time at which the audit action is performed..
|
||||||
|
/// </summary>
|
||||||
|
/// <value>
|
||||||
|
/// The specific timestamp of the audit action. Optional.
|
||||||
|
/// </value>
|
||||||
|
public DateTime? actionTime { get; set; } = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the start date for filtering audit logs by date range.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>
|
||||||
|
/// The earliest date to include in the results. Optional.
|
||||||
|
/// </value>
|
||||||
|
public DateTime? startDate { get; set; } = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the end date for filtering audit logs by date range.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>
|
||||||
|
/// The latest date to include in the results. Optional.
|
||||||
|
/// </value>
|
||||||
|
public DateTime? endDate { get; set; } = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -67,8 +67,13 @@ public class AuditRecordRepository : MongoRepository<AuditRecord>, IAuditRecordR
|
|||||||
return await Collection.Find(new BsonDocument()).ToListAsync();
|
return await Collection.Find(new BsonDocument()).ToListAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Task<IEnumerable<AuditRecord>> GetPaginatedAsync(int pageNumber, int pageSize)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Task<long> CountDocumentsAsync()
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -9,7 +9,8 @@ public interface IMongoRepository<T>
|
|||||||
Task InsertOneAsync(T obj);
|
Task InsertOneAsync(T obj);
|
||||||
Task<T?> DeleteAsync(ObjectId id);
|
Task<T?> DeleteAsync(ObjectId id);
|
||||||
Task UpdateOneAsync(ObjectId id, T obj);
|
Task UpdateOneAsync(ObjectId id, T obj);
|
||||||
Task<IEnumerable<T>> GetPaginatedAsync(int pageNumber, int pageSize); // Nuevo método para paginación genérica
|
Task<IEnumerable<T>> GetPaginatedAsync(int pageNumber, int pageSize,FilterDefinition<T>? filter = null);
|
||||||
Task<long> CountDocumentsAsync(); // Nuevo método para contar documentos genéricamente
|
|
||||||
|
Task<long> CountDocumentsAsync(FilterDefinition<T>? filter = null);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -155,15 +155,16 @@ public abstract class MongoRepository<T> : IMongoRepository<T>
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
public async Task<IEnumerable<T>> GetPaginatedAsync(int pageNumber, int pageSize)
|
public async Task<IEnumerable<T>> GetPaginatedAsync(int pageNumber, int pageSize,FilterDefinition<T>? filter = null)
|
||||||
{
|
{
|
||||||
if (pageNumber <= 0) throw new ArgumentException("Page number must be greater than 0.", nameof(pageNumber));
|
if (pageNumber <= 0) throw new ArgumentException("Page number must be greater than 0.", nameof(pageNumber));
|
||||||
if (pageSize <= 0) throw new ArgumentException("Page size must be greater than 0.", nameof(pageSize));
|
if (pageSize <= 0) throw new ArgumentException("Page size must be greater than 0.", nameof(pageSize));
|
||||||
|
filter ??= FilterDefinition<T>.Empty; // Usa un filtro vacío si no se proporcionó ninguno
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return await Collection
|
return await Collection
|
||||||
.Find(FilterDefinition<T>.Empty)
|
.Find(filter)
|
||||||
.Skip((pageNumber - 1) * pageSize)
|
.Skip((pageNumber - 1) * pageSize)
|
||||||
.Limit(pageSize)
|
.Limit(pageSize)
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
@@ -175,17 +176,12 @@ public abstract class MongoRepository<T> : IMongoRepository<T>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<long> CountDocumentsAsync()
|
|
||||||
|
public async Task<long> CountDocumentsAsync(FilterDefinition<T>? filter = null)
|
||||||
{
|
{
|
||||||
try
|
filter ??= FilterDefinition<T>.Empty; // Usa un filtro vacío porsi no se pasa como parametro
|
||||||
{
|
|
||||||
return await Collection.CountDocumentsAsync(FilterDefinition<T>.Empty);
|
return await Collection.CountDocumentsAsync(filter);
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Log.Error("Error counting documents: {ExMessage}", ex.Message);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,14 @@
|
|||||||
|
using System.Security.Claims;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
using audit_logs.Models;
|
using audit_logs.Models;
|
||||||
|
using audit_logs.Models.AppSettings;
|
||||||
|
using audit_logs.Models.DTO;
|
||||||
|
using audit_logs.Services.Interfaces;
|
||||||
|
using Microsoft.Extensions.Options;
|
||||||
|
using MongoDB.Bson;
|
||||||
|
|
||||||
namespace audit_logs.Services;
|
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;
|
||||||
@@ -10,9 +18,9 @@ using Serilog;
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
public class AuditService
|
|
||||||
{
|
|
||||||
|
|
||||||
|
public class AuditService : IAuditService
|
||||||
|
{
|
||||||
private readonly IAuditRecordRepository _auditLogRepository;
|
private readonly IAuditRecordRepository _auditLogRepository;
|
||||||
|
|
||||||
public AuditService(IAuditRecordRepository auditLogRepository)
|
public AuditService(IAuditRecordRepository auditLogRepository)
|
||||||
@@ -23,8 +31,13 @@ public class AuditService
|
|||||||
public AuditService(IMongoDatabase database)
|
public AuditService(IMongoDatabase database)
|
||||||
{
|
{
|
||||||
_auditLogRepository = new AuditRecordRepository(database);
|
_auditLogRepository = new AuditRecordRepository(database);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
public AuditService(IOptions<MongoDbSettings> dbSettings)
|
||||||
|
{
|
||||||
|
_auditLogRepository = new AuditRecordRepository(dbSettings);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public IAuditRecordRepository AuditLogRepository => _auditLogRepository;
|
public IAuditRecordRepository AuditLogRepository => _auditLogRepository;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -34,12 +47,17 @@ public class AuditService
|
|||||||
public async Task RecordAuditAsync(AuditRecord auditLogData)
|
public async Task RecordAuditAsync(AuditRecord auditLogData)
|
||||||
{
|
{
|
||||||
if (auditLogData == null) throw new ArgumentNullException(nameof(auditLogData));
|
if (auditLogData == null) throw new ArgumentNullException(nameof(auditLogData));
|
||||||
if (string.IsNullOrWhiteSpace(auditLogData.EntityType)) throw new ArgumentNullException(nameof(auditLogData.EntityType));
|
if (string.IsNullOrWhiteSpace(auditLogData.EntityType))
|
||||||
if (string.IsNullOrWhiteSpace(auditLogData.RecordId)) throw new ArgumentNullException(nameof(auditLogData.RecordId));
|
throw new ArgumentNullException(nameof(auditLogData.EntityType));
|
||||||
if (string.IsNullOrWhiteSpace(auditLogData.UserId)) throw new ArgumentNullException(nameof(auditLogData.UserId));
|
if (string.IsNullOrWhiteSpace(auditLogData.RecordId))
|
||||||
if (string.IsNullOrWhiteSpace(auditLogData.ActionType)) throw new ArgumentNullException(nameof(auditLogData.ActionType));
|
throw new ArgumentNullException(nameof(auditLogData.RecordId));
|
||||||
|
if (string.IsNullOrWhiteSpace(auditLogData.UserId))
|
||||||
|
throw new ArgumentNullException(nameof(auditLogData.UserId));
|
||||||
|
if (string.IsNullOrWhiteSpace(auditLogData.ActionType))
|
||||||
|
throw new ArgumentNullException(nameof(auditLogData.ActionType));
|
||||||
if (auditLogData.Changes == null) throw new ArgumentNullException(nameof(auditLogData.Changes));
|
if (auditLogData.Changes == null) throw new ArgumentNullException(nameof(auditLogData.Changes));
|
||||||
if (string.IsNullOrWhiteSpace(auditLogData.UserIpAddress)) throw new ArgumentNullException(nameof(auditLogData.UserIpAddress));
|
if (string.IsNullOrWhiteSpace(auditLogData.UserIpAddress))
|
||||||
|
throw new ArgumentNullException(nameof(auditLogData.UserIpAddress));
|
||||||
|
|
||||||
var auditRecord = new AuditRecord
|
var auditRecord = new AuditRecord
|
||||||
{
|
{
|
||||||
@@ -48,13 +66,107 @@ public class AuditService
|
|||||||
UserId = auditLogData.UserId,
|
UserId = auditLogData.UserId,
|
||||||
ActionType = auditLogData.ActionType,
|
ActionType = auditLogData.ActionType,
|
||||||
ActionTime = auditLogData.ActionTime,
|
ActionTime = auditLogData.ActionTime,
|
||||||
Changes =auditLogData.Changes,
|
Changes = auditLogData.Changes,
|
||||||
Reason = auditLogData.Reason,
|
Reason = auditLogData.Reason,
|
||||||
UserIpAddress = auditLogData.UserIpAddress,
|
UserIpAddress = auditLogData.UserIpAddress,
|
||||||
};
|
};
|
||||||
|
|
||||||
await _auditLogRepository.InsertOneAsync(auditRecord);
|
await _auditLogRepository.InsertOneAsync(auditRecord);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 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.
|
||||||
|
/// 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>
|
||||||
|
/// <param name="user">The <see cref="ClaimsPrincipal"/> representing the user performing the action. This parameter is required.</param>
|
||||||
|
/// <param name="dataOriginal">The original object before the change, or null for new records.</param>
|
||||||
|
/// <param name="dataModified">The modified object after the change, or null for deleted records.</param>
|
||||||
|
/// <param name="reason">
|
||||||
|
/// The reason for the change. If null or empty, defaults to "Not specified".
|
||||||
|
/// </param>
|
||||||
|
/// <exception cref="ArgumentNullException">
|
||||||
|
/// Thrown if <paramref name="user"/> is null.
|
||||||
|
/// </exception>
|
||||||
|
/// <remarks>
|
||||||
|
/// This method constructs and populates an <see cref="AuditRecord"/> object to store all details related to the audit event.
|
||||||
|
/// It then asynchronously saves the record using <c>RecordAuditAsync</c>.
|
||||||
|
/// </remarks>
|
||||||
|
/// <returns>
|
||||||
|
/// A task representing the asynchronous operation of recording the audit log.
|
||||||
|
/// </returns>
|
||||||
|
public async Task CreateAuditLogAsync(ClaimsPrincipal user, Object? dataOriginal, Object? dataModified,
|
||||||
|
string? reason)
|
||||||
|
{
|
||||||
|
//auditLogData.ActionType falta este atributo
|
||||||
|
if (user == null) throw new ArgumentNullException(nameof(user));
|
||||||
|
AuditRecord auditLogData = new AuditRecord();
|
||||||
|
JsonComparer jsonComparer = new();
|
||||||
|
if (dataOriginal != null)
|
||||||
|
{
|
||||||
|
auditLogData.EntityType =
|
||||||
|
IsAnonymousType(dataOriginal.GetType()) ? "AnonymousType" : dataOriginal.GetType().Name;
|
||||||
|
var idProperty = dataOriginal.GetType().GetProperty("Id");
|
||||||
|
if (idProperty != null && idProperty.PropertyType == typeof(ObjectId))
|
||||||
|
{
|
||||||
|
ObjectId id = (ObjectId)idProperty.GetValue(dataOriginal);
|
||||||
|
//TODO verificar si esta bien obtener el valor asi:
|
||||||
|
auditLogData.RecordId = id.ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (dataModified != null)
|
||||||
|
{
|
||||||
|
auditLogData.EntityType =
|
||||||
|
IsAnonymousType(dataModified.GetType()) ? "AnonymousType" : dataModified.GetType().Name;
|
||||||
|
var idProperty = dataModified.GetType().GetProperty("Id");
|
||||||
|
if (idProperty != null && idProperty.PropertyType == typeof(ObjectId))
|
||||||
|
{
|
||||||
|
ObjectId id = (ObjectId)idProperty.GetValue(dataModified);
|
||||||
|
//TODO verificar si esta bien obtener el valor asi:
|
||||||
|
auditLogData.RecordId = id.ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
auditLogData.ActionTime = DateTime.Now;
|
||||||
|
auditLogData.Reason = string.IsNullOrEmpty(reason) ? "Not specified" : reason;
|
||||||
|
auditLogData.UserIpAddress = string.IsNullOrEmpty(user.FindFirst("IpAddress")?.Value)
|
||||||
|
? "Not specified"
|
||||||
|
: user.FindFirst("IpAddress")?.Value;
|
||||||
|
auditLogData.UserId = user.FindFirst(ClaimTypes.Name)?.Value;
|
||||||
|
|
||||||
|
// Asignar ActionType según las condiciones
|
||||||
|
if (dataOriginal == null || string.IsNullOrEmpty(dataOriginal.ToString()))
|
||||||
|
{
|
||||||
|
auditLogData.ActionType = "create";
|
||||||
|
}
|
||||||
|
else if (dataModified == null || string.IsNullOrEmpty(dataModified.ToString()))
|
||||||
|
{
|
||||||
|
auditLogData.ActionType = "delete";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
auditLogData.ActionType = "update";
|
||||||
|
}
|
||||||
|
|
||||||
|
auditLogData.Changes = jsonComparer.GetDifferences(dataOriginal, dataModified);
|
||||||
|
|
||||||
|
await RecordAuditAsync(auditLogData);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Método auxiliar para verificar si un tipo es anonimo, solo es necesario para pruebas
|
||||||
|
private bool IsAnonymousType(Type type)
|
||||||
|
{
|
||||||
|
return type.IsGenericType && type.Name.StartsWith("<>f__AnonymousType");
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates and records an audit log entry based on the differences between the original and modified data provided in an <see cref="AuditLogData"/> object.
|
/// Creates and records an audit log entry based on the differences between the original and modified data provided in an <see cref="AuditLogData"/> object.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -87,28 +199,167 @@ public class AuditService
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Retrieves paginated audit logs.
|
/// Retrieves paginated audit logs.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="pageNumber">The page number to retrieve (1-based).</param>
|
/// <param name="filterDto.pageNumber">The page number to retrieve (1-based).</param>
|
||||||
/// <param name="pageSize">The number of records per page.</param>
|
/// <param name="filterDto.pageSize">The number of records per page.</param>
|
||||||
|
/// <param name="filterDto.userId">filter taking into account the user who made the modification.</param>
|
||||||
|
/// <param name="filterDto.startDate">filter by the date the modification was made.</param>
|
||||||
|
/// <param name="filterDto.endDate">filter by the date the modification was made.</param>
|
||||||
|
/// <param name="filterDto.recordId">filter by modified record id in the collection.</param>
|
||||||
/// <returns>A paginated list of audit records.</returns>
|
/// <returns>A paginated list of audit records.</returns>
|
||||||
public async Task<PaginatedLogsResult<AuditRecord>> GetAuditLogsAsync(int pageNumber, int pageSize)
|
public async Task<PaginatedLogsResultDto<AuditRecordDto>> GetAuditLogsBySpecificFilterAsync(
|
||||||
|
SpecificAuditLogFilterDto filterDto)
|
||||||
{
|
{
|
||||||
if (pageNumber <= 0) throw new ArgumentException("Page number must be greater than 0.", nameof(pageNumber));
|
if (filterDto.pageNumber <= 0) throw new ArgumentException("Page number must be greater than 0.", nameof(filterDto.pageNumber));
|
||||||
if (pageSize <= 0) throw new ArgumentException("Page size must be greater than 0.", nameof(pageSize));
|
if (filterDto.pageSize <= 0) throw new ArgumentException("Page size must be greater than 0.", nameof(filterDto.pageSize));
|
||||||
|
|
||||||
var totalRecords = await _auditLogRepository.CountDocumentsAsync();
|
// Construir filtro dinámico
|
||||||
var totalPages = (int)Math.Ceiling((double)totalRecords / pageSize);
|
var filter = BuildAuditLogFilter(filterDto.userId, filterDto.recordId, filterDto.entityType, filterDto.startDate, filterDto.endDate);
|
||||||
|
|
||||||
var records = await _auditLogRepository.GetPaginatedAsync(pageNumber, pageSize);
|
var totalRecords = await _auditLogRepository.CountDocumentsAsync(filter);
|
||||||
|
var totalPages = (int)Math.Ceiling((double)totalRecords / filterDto.pageSize);
|
||||||
|
|
||||||
return new PaginatedLogsResult<AuditRecord>
|
var records = await _auditLogRepository.GetPaginatedAsync(filterDto.pageNumber, filterDto.pageSize, filter);
|
||||||
|
var recordsDto = records.Select(record => AuditRecordMapper.ToDto(record)).ToList();
|
||||||
|
|
||||||
|
return new PaginatedLogsResultDto<AuditRecordDto>
|
||||||
{
|
{
|
||||||
CurrentPage = pageNumber,
|
CurrentPage = filterDto.pageNumber,
|
||||||
PageSize = pageSize,
|
PageSize = filterDto.pageSize,
|
||||||
TotalRecords = totalRecords,
|
TotalRecords = totalRecords,
|
||||||
TotalPages = totalPages,
|
TotalPages = totalPages,
|
||||||
Records = records
|
Records = recordsDto
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves paginated audit logs with optional full-text search across multiple fields.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="filtertTextOrDateDto.pageNumber">The page number to retrieve (1-based).</param>
|
||||||
|
/// <param name="filtertTextOrDateDto.pageSize">The number of records per page.</param>
|
||||||
|
/// <param name="filtertTextOrDateDto.text_to_search">Text to search in any field.</param>
|
||||||
|
/// /// <param name="filtertTextOrDateDto.startDate">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>
|
||||||
|
public async Task<PaginatedLogsResultDto<AuditRecordDto>> GetAuditLogsMatchingTextOrDateAsync(
|
||||||
|
AuditLogTextOrDateSearchDTO filtertTextOrDateDto)
|
||||||
|
{
|
||||||
|
if (filtertTextOrDateDto.pageNumber <= 0) 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
|
||||||
|
FilterDefinition<AuditRecord> filter;
|
||||||
|
if (!string.IsNullOrWhiteSpace(filtertTextOrDateDto.searchText) || filtertTextOrDateDto.startDate.HasValue || filtertTextOrDateDto.endDate.HasValue)
|
||||||
|
{
|
||||||
|
filter = BuildAuditLogFilterByText(filtertTextOrDateDto.searchText,filtertTextOrDateDto.startDate, filtertTextOrDateDto.endDate);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
filter = Builders<AuditRecord>.Filter.Empty;
|
||||||
|
}
|
||||||
|
|
||||||
|
var totalRecords = await _auditLogRepository.CountDocumentsAsync(filter);
|
||||||
|
var totalPages = (int)Math.Ceiling((double)totalRecords / filtertTextOrDateDto.pageSize);
|
||||||
|
var records = await _auditLogRepository.GetPaginatedAsync(filtertTextOrDateDto.pageNumber, filtertTextOrDateDto.pageSize, filter);
|
||||||
|
var recordsDto = records.Select(record => AuditRecordMapper.ToDto(record)).ToList();
|
||||||
|
|
||||||
|
return new PaginatedLogsResultDto<AuditRecordDto>
|
||||||
|
{
|
||||||
|
CurrentPage = filtertTextOrDateDto.pageNumber,
|
||||||
|
PageSize = filtertTextOrDateDto.pageSize,
|
||||||
|
TotalRecords = totalRecords,
|
||||||
|
TotalPages = totalPages,
|
||||||
|
Records = recordsDto
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private static FilterDefinition<AuditRecord> BuildAuditLogFilter(
|
||||||
|
string? userId,
|
||||||
|
string? recordId,
|
||||||
|
string? entityType,
|
||||||
|
DateTime? startDate,
|
||||||
|
DateTime? endDate)
|
||||||
|
{
|
||||||
|
var builder = Builders<AuditRecord>.Filter;
|
||||||
|
var filters = new List<FilterDefinition<AuditRecord>>();
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(userId))
|
||||||
|
{
|
||||||
|
filters.Add(builder.Eq(x => x.UserId, userId));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(recordId))
|
||||||
|
{
|
||||||
|
filters.Add(builder.Eq(x => x.RecordId, recordId));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (startDate.HasValue)
|
||||||
|
{
|
||||||
|
filters.Add(builder.Gte(x => x.ActionTime, startDate.Value));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (endDate.HasValue)
|
||||||
|
{
|
||||||
|
filters.Add(builder.Lte(x => x.ActionTime, endDate.Value));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(entityType))
|
||||||
|
{
|
||||||
|
filters.Add(builder.Eq(x => x.EntityType, entityType));
|
||||||
|
}
|
||||||
|
|
||||||
|
return filters.Count > 0 ? builder.And(filters) : builder.Empty;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private static FilterDefinition<AuditRecord> BuildAuditLogFilterByText(
|
||||||
|
string? searchText,
|
||||||
|
DateTime? startDate = null,
|
||||||
|
DateTime? endDate = null)
|
||||||
|
{
|
||||||
|
var builder = Builders<AuditRecord>.Filter;
|
||||||
|
var filters = new List<FilterDefinition<AuditRecord>>();
|
||||||
|
|
||||||
|
// Filtro por rango de fechas
|
||||||
|
if (startDate.HasValue && endDate.HasValue)
|
||||||
|
{
|
||||||
|
filters.Add(builder.And(
|
||||||
|
builder.Gte(x => x.ActionTime, startDate.Value),
|
||||||
|
builder.Lte(x => x.ActionTime, endDate.Value)
|
||||||
|
));
|
||||||
|
}
|
||||||
|
else if (startDate.HasValue)
|
||||||
|
{
|
||||||
|
filters.Add(builder.Gte(x => x.ActionTime, startDate.Value));
|
||||||
|
}
|
||||||
|
else if (endDate.HasValue)
|
||||||
|
{
|
||||||
|
filters.Add(builder.Lte(x => x.ActionTime, endDate.Value));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Filtro por texto si se proporciona
|
||||||
|
if (!string.IsNullOrEmpty(searchText))
|
||||||
|
{
|
||||||
|
var regexFilter = new BsonRegularExpression(new Regex(searchText, RegexOptions.IgnoreCase));
|
||||||
|
filters.Add(builder.Or(
|
||||||
|
builder.Regex(x => x.UserId, regexFilter),
|
||||||
|
builder.Regex(x => x.RecordId, regexFilter),
|
||||||
|
builder.Regex(x => x.EntityType, regexFilter),
|
||||||
|
builder.Regex(x => x.ActionType, regexFilter)
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Combina todos los filtros con AND
|
||||||
|
if (filters.Any())
|
||||||
|
{
|
||||||
|
return builder.And(filters);
|
||||||
|
}
|
||||||
|
|
||||||
|
return builder.Empty; // Sin filtros, devuelve todos los documentos
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
using audit_logs.Models.DTO;
|
||||||
|
using audit.Model;
|
||||||
|
|
||||||
|
namespace audit_logs.Services.Interfaces;
|
||||||
|
using System.Security.Claims;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using audit_logs.Models;
|
||||||
|
using MongoDB.Bson;
|
||||||
|
public interface IAuditService
|
||||||
|
{
|
||||||
|
Task RecordAuditAsync(AuditRecord auditLogData);
|
||||||
|
Task CreateAuditLogAsync(ClaimsPrincipal user, object dataOriginal, object dataModified, string reason = null);
|
||||||
|
Task CreateAuditLogAsync(AuditLogData auditLogData);
|
||||||
|
Task<PaginatedLogsResultDto<AuditRecordDto>> GetAuditLogsBySpecificFilterAsync(
|
||||||
|
SpecificAuditLogFilterDto filterDto);
|
||||||
|
|
||||||
|
Task<PaginatedLogsResultDto<AuditRecordDto>> GetAuditLogsMatchingTextOrDateAsync(
|
||||||
|
AuditLogTextOrDateSearchDTO filtertTextOrDateDto);
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
using audit_logs.Models;
|
||||||
|
using audit.Model;
|
||||||
|
|
||||||
|
namespace audit_logs.Utils;
|
||||||
|
|
||||||
|
public static class AuditRecordMapper
|
||||||
|
{
|
||||||
|
public static AuditRecordDto ToDto(this AuditRecord record)
|
||||||
|
{
|
||||||
|
return new AuditRecordDto
|
||||||
|
{
|
||||||
|
Id = record.Id.ToString(),
|
||||||
|
EntityType = record.EntityType,
|
||||||
|
RecordId = record.RecordId,
|
||||||
|
UserId = record.UserId,
|
||||||
|
ActionType = record.ActionType,
|
||||||
|
ActionTime = record.ActionTime,
|
||||||
|
Reason = record.Reason,
|
||||||
|
UserIpAddress = record.UserIpAddress,
|
||||||
|
Changes = record.Changes?.Select(c => new ChangeDto
|
||||||
|
{
|
||||||
|
Field = c.Field,
|
||||||
|
OldValue = AuditRecord.Change.ConvertBsonValue(c.OldValue),
|
||||||
|
NewValue = AuditRecord.Change.ConvertBsonValue(c.NewValue),
|
||||||
|
ValueType = c.ValueType
|
||||||
|
}).ToList() ?? new List<ChangeDto>()
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
using Newtonsoft.Json.Linq;
|
||||||
|
|
||||||
|
namespace audit_logs.Utils;
|
||||||
|
|
||||||
|
public static class JsonClean
|
||||||
|
{
|
||||||
|
public static JObject CleanJObject(JObject obj)
|
||||||
|
{
|
||||||
|
var properties = obj.Properties().ToList();
|
||||||
|
foreach (var property in properties)
|
||||||
|
{
|
||||||
|
if (property.Value.Type == JTokenType.Null)
|
||||||
|
{
|
||||||
|
// Eliminar la propiedad si el valor es null
|
||||||
|
property.Remove();
|
||||||
|
}
|
||||||
|
else if (property.Value.Type == JTokenType.Object)
|
||||||
|
{
|
||||||
|
// Limpieza para objetos anidados
|
||||||
|
property.Value = CleanJObject((JObject)property.Value);
|
||||||
|
}
|
||||||
|
else if (property.Value.Type == JTokenType.Array)
|
||||||
|
{
|
||||||
|
// Limpieza para arrays, aplicando limpieza a cada objeto dentro del array
|
||||||
|
property.Value = CleanJArray((JArray)property.Value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static JArray CleanJArray(JArray array)
|
||||||
|
{
|
||||||
|
var cleanedArray = new JArray();
|
||||||
|
foreach (var item in array)
|
||||||
|
{
|
||||||
|
if (item.Type == JTokenType.Object)
|
||||||
|
{
|
||||||
|
cleanedArray.Add(CleanJObject((JObject)item));
|
||||||
|
}
|
||||||
|
else if (item.Type != JTokenType.Null)
|
||||||
|
{
|
||||||
|
cleanedArray.Add(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return cleanedArray;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -5,21 +5,76 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using MongoDB.Bson;
|
using MongoDB.Bson;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
|
using Utils;
|
||||||
|
|
||||||
public class JsonComparer
|
public class JsonComparer
|
||||||
{
|
{
|
||||||
public List<AuditRecord.Change> GetDifferences(string originalJson, string modifiedJson)
|
public List<AuditRecord.Change> GetDifferences(object? originalJson, object? modifiedJson)
|
||||||
{
|
{
|
||||||
var changes = new List<AuditRecord.Change>();
|
var changes = new List<AuditRecord.Change>();
|
||||||
|
|
||||||
var originalObj = JObject.Parse(originalJson);
|
// Convertir los objetos a cadenas JSON; usar "{}" si el objeto es null
|
||||||
var modifiedObj = JObject.Parse(modifiedJson);
|
var originalJsonString = originalJson != null
|
||||||
|
? JsonConverter.ConvertObjectToJson(originalJson)
|
||||||
|
: "{}";
|
||||||
|
var modifiedJsonString = modifiedJson != null
|
||||||
|
? JsonConverter.ConvertObjectToJson(modifiedJson)
|
||||||
|
: "{}";
|
||||||
|
|
||||||
|
// Intentar parsear a JObject solo si el JSON es un objeto
|
||||||
|
var originalObj = ParseAsJObject(originalJsonString);
|
||||||
|
var modifiedObj = ParseAsJObject(modifiedJsonString);
|
||||||
|
//eliminamos aquellas claves que contengan null, por ejemplo "allergies": [
|
||||||
|
// {
|
||||||
|
// "optionType": null,
|
||||||
|
// "name": "Sí",
|
||||||
|
// "iconDefault": "icCheck",
|
||||||
|
// "iconLight": null,
|
||||||
|
// "iconDark": null,
|
||||||
|
// "color": null,
|
||||||
|
// "bgColor": null,
|
||||||
|
// "description": null,
|
||||||
|
// "initDate": null,
|
||||||
|
// "endDate": null
|
||||||
|
// }
|
||||||
|
// ]
|
||||||
|
|
||||||
|
if (originalObj != null)
|
||||||
|
{
|
||||||
|
originalObj = JsonClean.CleanJObject(originalObj);
|
||||||
|
}
|
||||||
|
if (modifiedObj != null)
|
||||||
|
{
|
||||||
|
modifiedObj = JsonClean.CleanJObject(modifiedObj);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Comparar los objetos JSON
|
||||||
CompareJTokens(originalObj, modifiedObj, changes, string.Empty);
|
CompareJTokens(originalObj, modifiedObj, changes, string.Empty);
|
||||||
|
|
||||||
return changes;
|
return changes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Intenta parsear una cadena JSON como JObject. Devuelve null si no es un objeto.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="json">La cadena JSON a validar.</param>
|
||||||
|
/// <returns>Un JObject si es válido, de lo contrario null.</returns>
|
||||||
|
private static JObject? ParseAsJObject(string json)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var token = JToken.Parse(json);
|
||||||
|
return token as JObject; // Devuelve null si no es un JObject
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
return null; // Si ocurre un error, no es un JSON válido
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private void CompareJTokens(JToken original, JToken modified, List<AuditRecord.Change> changes, string path)
|
private void CompareJTokens(JToken original, JToken modified, List<AuditRecord.Change> changes, string path)
|
||||||
{
|
{
|
||||||
foreach (var property in modified.Children<JProperty>())
|
foreach (var property in modified.Children<JProperty>())
|
||||||
@@ -27,6 +82,11 @@ public class JsonComparer
|
|||||||
var fieldPath = string.IsNullOrEmpty(path) ? property.Name : $"{path}.{property.Name}";
|
var fieldPath = string.IsNullOrEmpty(path) ? property.Name : $"{path}.{property.Name}";
|
||||||
var originalValue = original[property.Name];
|
var originalValue = original[property.Name];
|
||||||
var modifiedValue = property.Value;
|
var modifiedValue = property.Value;
|
||||||
|
// Ignorar campos donde ambos valores son null
|
||||||
|
if (originalValue == null && modifiedValue.Type == JTokenType.Null)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (originalValue == null)
|
if (originalValue == null)
|
||||||
{
|
{
|
||||||
@@ -77,7 +137,7 @@ public class JsonComparer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private BsonValue ConvertToBsonValue(JToken token)
|
/*private BsonValue ConvertToBsonValue(JToken token)
|
||||||
{
|
{
|
||||||
return token.Type switch
|
return token.Type switch
|
||||||
{
|
{
|
||||||
@@ -91,8 +151,38 @@ public class JsonComparer
|
|||||||
JTokenType.Array => new BsonArray(token.ToObject<List<BsonValue>>()),
|
JTokenType.Array => new BsonArray(token.ToObject<List<BsonValue>>()),
|
||||||
_ => new BsonString(token.ToString())
|
_ => new BsonString(token.ToString())
|
||||||
};
|
};
|
||||||
|
}*/
|
||||||
|
private BsonValue ConvertToBsonValue(JToken token)
|
||||||
|
{
|
||||||
|
switch (token.Type)
|
||||||
|
{
|
||||||
|
case JTokenType.String:
|
||||||
|
return new BsonString(token.ToString());
|
||||||
|
case JTokenType.Integer:
|
||||||
|
return BsonValue.Create(token.ToObject<int>());
|
||||||
|
case JTokenType.Float:
|
||||||
|
return BsonValue.Create(token.ToObject<double>());
|
||||||
|
case JTokenType.Boolean:
|
||||||
|
return new BsonBoolean(token.ToObject<bool>());
|
||||||
|
case JTokenType.Date:
|
||||||
|
return new BsonDateTime(token.ToObject<DateTime>());
|
||||||
|
case JTokenType.Null:
|
||||||
|
return BsonNull.Value;
|
||||||
|
case JTokenType.Object:
|
||||||
|
return BsonDocument.Parse(token.ToString());
|
||||||
|
case JTokenType.Array:
|
||||||
|
var array = new BsonArray();
|
||||||
|
foreach (var item in token.Children())
|
||||||
|
{
|
||||||
|
array.Add(ConvertToBsonValue(item));
|
||||||
|
}
|
||||||
|
return array;
|
||||||
|
default:
|
||||||
|
return new BsonString(token.ToString()); // Trata cualquier otro tipo como string
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private string GetBsonType(JToken token)
|
private string GetBsonType(JToken token)
|
||||||
{
|
{
|
||||||
return token.Type switch
|
return token.Type switch
|
||||||
|
|||||||
@@ -0,0 +1,50 @@
|
|||||||
|
using Newtonsoft.Json.Linq;
|
||||||
|
|
||||||
|
namespace audit_logs.Utils;
|
||||||
|
using System.Text.Json;
|
||||||
|
|
||||||
|
public static class JsonConverter
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Converts an object to a JSON string.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="obj">the object to be converted</param>
|
||||||
|
/// <returns>A JSON string representing the object</returns>
|
||||||
|
public static string ConvertObjectToJson(object obj)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// Si el objeto es una cadena, asumimos que ya es JSON
|
||||||
|
if (obj is string jsonString && IsValidJson(jsonString))
|
||||||
|
{
|
||||||
|
return jsonString; // No volver a serializar
|
||||||
|
}
|
||||||
|
var options = new JsonSerializerOptions
|
||||||
|
{
|
||||||
|
WriteIndented = true,
|
||||||
|
Encoder = System.Text.Encodings.Web.JavaScriptEncoder.UnsafeRelaxedJsonEscaping
|
||||||
|
};
|
||||||
|
var json = JsonSerializer.Serialize(obj);
|
||||||
|
return json;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
return $"Error converting object to JSON: {ex.Message}";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Valida si una cadena es un JSON válido.
|
||||||
|
/// </summary>
|
||||||
|
private static bool IsValidJson(string jsonString)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
JToken.Parse(jsonString);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
<!-- Informacion para NuGet -->
|
<!-- Informacion para NuGet -->
|
||||||
<PackageId>AuditLogs</PackageId>
|
<PackageId>AuditLogs</PackageId>
|
||||||
<Version>1.0.0</Version>
|
<Version>1.0.17</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>
|
||||||
@@ -16,13 +16,14 @@
|
|||||||
<RepositoryUrl>https://git.teralevel.io/jrojas/audit/src/branch/master/audit-logs</RepositoryUrl> <!-- URL del repo (si aplica) -->
|
<RepositoryUrl>https://git.teralevel.io/jrojas/audit/src/branch/master/audit-logs</RepositoryUrl> <!-- URL del repo (si aplica) -->
|
||||||
<PackageLicenseExpression>MIT</PackageLicenseExpression>
|
<PackageLicenseExpression>MIT</PackageLicenseExpression>
|
||||||
<PackageOutputPath>./nupkgs</PackageOutputPath>
|
<PackageOutputPath>./nupkgs</PackageOutputPath>
|
||||||
|
<GeneratePackageOnBuild>true</GeneratePackageOnBuild> <!-- Genera el paquete al construir, revisar si sobra esta instruccion -->
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.Extensions.Hosting" Version="9.0.0-rc.2.24473.5" />
|
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
|
||||||
<PackageReference Include="MongoDB.Driver" Version="2.23.1" />
|
<PackageReference Include="MongoDB.Driver" Version="2.23.1" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||||
<PackageReference Include="Serilog" Version="4.1.1-dev-02318" />
|
<PackageReference Include="Serilog" Version="4.0.2" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,24 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
|
||||||
|
<metadata>
|
||||||
|
<id>AuditLogs</id>
|
||||||
|
<version>1.0.0</version>
|
||||||
|
<authors>Epigram</authors>
|
||||||
|
<license type="expression">MIT</license>
|
||||||
|
<licenseUrl>https://licenses.nuget.org/MIT</licenseUrl>
|
||||||
|
<description>Library for recording audit logs using MongoDB.</description>
|
||||||
|
<tags>audit logs mongodb</tags>
|
||||||
|
<repository type="git" url="https://git.teralevel.io/jrojas/audit/src/branch/master/audit-logs" commit="8c3be106f93e44ea3daffe2267723e4026a0569d" />
|
||||||
|
<dependencies>
|
||||||
|
<group targetFramework="net8.0">
|
||||||
|
<dependency id="Microsoft.Extensions.Hosting" version="9.0.0-rc.2.24473.5" exclude="Build,Analyzers" />
|
||||||
|
<dependency id="MongoDB.Driver" version="2.23.1" exclude="Build,Analyzers" />
|
||||||
|
<dependency id="Newtonsoft.Json" version="13.0.3" exclude="Build,Analyzers" />
|
||||||
|
<dependency id="Serilog" version="4.1.1-dev-02318" exclude="Build,Analyzers" />
|
||||||
|
</group>
|
||||||
|
</dependencies>
|
||||||
|
</metadata>
|
||||||
|
<files>
|
||||||
|
<file src="/home/julian/Documentos/repos/audit/audit-logs/audit-logs/bin/Debug/net8.0/audit-logs.dll" target="lib/net8.0/audit-logs.dll" />
|
||||||
|
</files>
|
||||||
|
</package>
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
|
||||||
|
<metadata>
|
||||||
|
<id>AuditLogs</id>
|
||||||
|
<version>1.0.1</version>
|
||||||
|
<authors>Epigram</authors>
|
||||||
|
<license type="expression">MIT</license>
|
||||||
|
<licenseUrl>https://licenses.nuget.org/MIT</licenseUrl>
|
||||||
|
<description>Library for recording audit logs using MongoDB.</description>
|
||||||
|
<tags>audit logs mongodb</tags>
|
||||||
|
<repository type="git" url="https://git.teralevel.io/jrojas/audit/src/branch/master/audit-logs" commit="8c3be106f93e44ea3daffe2267723e4026a0569d" />
|
||||||
|
<dependencies>
|
||||||
|
<group targetFramework="net8.0">
|
||||||
|
<dependency id="Microsoft.Extensions.Hosting" version="9.0.0-rc.2.24473.5" exclude="Build,Analyzers" />
|
||||||
|
<dependency id="MongoDB.Driver" version="2.23.1" exclude="Build,Analyzers" />
|
||||||
|
<dependency id="Newtonsoft.Json" version="13.0.3" exclude="Build,Analyzers" />
|
||||||
|
<dependency id="Serilog" version="4.0.2" exclude="Build,Analyzers" />
|
||||||
|
</group>
|
||||||
|
</dependencies>
|
||||||
|
</metadata>
|
||||||
|
<files>
|
||||||
|
<file src="/home/julian/Documentos/repos/audit/audit-logs/audit-logs/bin/Debug/net8.0/audit-logs.dll" target="lib/net8.0/audit-logs.dll" />
|
||||||
|
</files>
|
||||||
|
</package>
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
|
||||||
|
<metadata>
|
||||||
|
<id>AuditLogs</id>
|
||||||
|
<version>1.0.11</version>
|
||||||
|
<authors>Epigram</authors>
|
||||||
|
<license type="expression">MIT</license>
|
||||||
|
<licenseUrl>https://licenses.nuget.org/MIT</licenseUrl>
|
||||||
|
<description>Library for recording audit logs using MongoDB.</description>
|
||||||
|
<tags>audit logs mongodb</tags>
|
||||||
|
<repository type="git" url="https://git.teralevel.io/jrojas/audit/src/branch/master/audit-logs" commit="8c3be106f93e44ea3daffe2267723e4026a0569d" />
|
||||||
|
<dependencies>
|
||||||
|
<group targetFramework="net8.0">
|
||||||
|
<dependency id="Microsoft.Extensions.Hosting" version="8.0.0" exclude="Build,Analyzers" />
|
||||||
|
<dependency id="MongoDB.Driver" version="2.23.1" exclude="Build,Analyzers" />
|
||||||
|
<dependency id="Newtonsoft.Json" version="13.0.3" exclude="Build,Analyzers" />
|
||||||
|
<dependency id="Serilog" version="4.0.2" exclude="Build,Analyzers" />
|
||||||
|
</group>
|
||||||
|
</dependencies>
|
||||||
|
</metadata>
|
||||||
|
<files>
|
||||||
|
<file src="/home/julian/Documentos/repos/audit/audit-logs/audit-logs/bin/Debug/net8.0/audit-logs.dll" target="lib/net8.0/audit-logs.dll" />
|
||||||
|
</files>
|
||||||
|
</package>
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
|
||||||
|
<metadata>
|
||||||
|
<id>AuditLogs</id>
|
||||||
|
<version>1.0.12</version>
|
||||||
|
<authors>Epigram</authors>
|
||||||
|
<license type="expression">MIT</license>
|
||||||
|
<licenseUrl>https://licenses.nuget.org/MIT</licenseUrl>
|
||||||
|
<description>Library for recording audit logs using MongoDB.</description>
|
||||||
|
<tags>audit logs mongodb</tags>
|
||||||
|
<repository type="git" url="https://git.teralevel.io/jrojas/audit/src/branch/master/audit-logs" commit="8c3be106f93e44ea3daffe2267723e4026a0569d" />
|
||||||
|
<dependencies>
|
||||||
|
<group targetFramework="net8.0">
|
||||||
|
<dependency id="Microsoft.Extensions.Hosting" version="8.0.0" exclude="Build,Analyzers" />
|
||||||
|
<dependency id="MongoDB.Driver" version="2.23.1" exclude="Build,Analyzers" />
|
||||||
|
<dependency id="Newtonsoft.Json" version="13.0.3" exclude="Build,Analyzers" />
|
||||||
|
<dependency id="Serilog" version="4.0.2" exclude="Build,Analyzers" />
|
||||||
|
</group>
|
||||||
|
</dependencies>
|
||||||
|
</metadata>
|
||||||
|
<files>
|
||||||
|
<file src="/home/julian/Documentos/repos/audit/audit-logs/audit-logs/bin/Debug/net8.0/audit-logs.dll" target="lib/net8.0/audit-logs.dll" />
|
||||||
|
</files>
|
||||||
|
</package>
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
|
||||||
|
<metadata>
|
||||||
|
<id>AuditLogs</id>
|
||||||
|
<version>1.0.13</version>
|
||||||
|
<authors>Epigram</authors>
|
||||||
|
<license type="expression">MIT</license>
|
||||||
|
<licenseUrl>https://licenses.nuget.org/MIT</licenseUrl>
|
||||||
|
<description>Library for recording audit logs using MongoDB.</description>
|
||||||
|
<tags>audit logs mongodb</tags>
|
||||||
|
<repository type="git" url="https://git.teralevel.io/jrojas/audit/src/branch/master/audit-logs" commit="8c3be106f93e44ea3daffe2267723e4026a0569d" />
|
||||||
|
<dependencies>
|
||||||
|
<group targetFramework="net8.0">
|
||||||
|
<dependency id="Microsoft.Extensions.Hosting" version="8.0.0" exclude="Build,Analyzers" />
|
||||||
|
<dependency id="MongoDB.Driver" version="2.23.1" exclude="Build,Analyzers" />
|
||||||
|
<dependency id="Newtonsoft.Json" version="13.0.3" exclude="Build,Analyzers" />
|
||||||
|
<dependency id="Serilog" version="4.0.2" exclude="Build,Analyzers" />
|
||||||
|
</group>
|
||||||
|
</dependencies>
|
||||||
|
</metadata>
|
||||||
|
<files>
|
||||||
|
<file src="/home/julian/Documentos/repos/audit/audit-logs/audit-logs/bin/Debug/net8.0/audit-logs.dll" target="lib/net8.0/audit-logs.dll" />
|
||||||
|
</files>
|
||||||
|
</package>
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
|
||||||
|
<metadata>
|
||||||
|
<id>AuditLogs</id>
|
||||||
|
<version>1.0.14</version>
|
||||||
|
<authors>Epigram</authors>
|
||||||
|
<license type="expression">MIT</license>
|
||||||
|
<licenseUrl>https://licenses.nuget.org/MIT</licenseUrl>
|
||||||
|
<description>Library for recording audit logs using MongoDB.</description>
|
||||||
|
<tags>audit logs mongodb</tags>
|
||||||
|
<repository type="git" url="https://git.teralevel.io/jrojas/audit/src/branch/master/audit-logs" commit="8c3be106f93e44ea3daffe2267723e4026a0569d" />
|
||||||
|
<dependencies>
|
||||||
|
<group targetFramework="net8.0">
|
||||||
|
<dependency id="Microsoft.Extensions.Hosting" version="8.0.0" exclude="Build,Analyzers" />
|
||||||
|
<dependency id="MongoDB.Driver" version="2.23.1" exclude="Build,Analyzers" />
|
||||||
|
<dependency id="Newtonsoft.Json" version="13.0.3" exclude="Build,Analyzers" />
|
||||||
|
<dependency id="Serilog" version="4.0.2" exclude="Build,Analyzers" />
|
||||||
|
</group>
|
||||||
|
</dependencies>
|
||||||
|
</metadata>
|
||||||
|
<files>
|
||||||
|
<file src="/home/julian/Documentos/repos/audit/audit-logs/audit-logs/bin/Debug/net8.0/audit-logs.dll" target="lib/net8.0/audit-logs.dll" />
|
||||||
|
</files>
|
||||||
|
</package>
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
|
||||||
|
<metadata>
|
||||||
|
<id>AuditLogs</id>
|
||||||
|
<version>1.0.15</version>
|
||||||
|
<authors>Epigram</authors>
|
||||||
|
<license type="expression">MIT</license>
|
||||||
|
<licenseUrl>https://licenses.nuget.org/MIT</licenseUrl>
|
||||||
|
<description>Library for recording audit logs using MongoDB.</description>
|
||||||
|
<tags>audit logs mongodb</tags>
|
||||||
|
<repository type="git" url="https://git.teralevel.io/jrojas/audit/src/branch/master/audit-logs" commit="8c3be106f93e44ea3daffe2267723e4026a0569d" />
|
||||||
|
<dependencies>
|
||||||
|
<group targetFramework="net8.0">
|
||||||
|
<dependency id="Microsoft.Extensions.Hosting" version="8.0.0" exclude="Build,Analyzers" />
|
||||||
|
<dependency id="MongoDB.Driver" version="2.23.1" exclude="Build,Analyzers" />
|
||||||
|
<dependency id="Newtonsoft.Json" version="13.0.3" exclude="Build,Analyzers" />
|
||||||
|
<dependency id="Serilog" version="4.0.2" exclude="Build,Analyzers" />
|
||||||
|
</group>
|
||||||
|
</dependencies>
|
||||||
|
</metadata>
|
||||||
|
<files>
|
||||||
|
<file src="/home/julian/Documentos/repos/audit/audit-logs/audit-logs/bin/Debug/net8.0/audit-logs.dll" target="lib/net8.0/audit-logs.dll" />
|
||||||
|
</files>
|
||||||
|
</package>
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
|
||||||
|
<metadata>
|
||||||
|
<id>AuditLogs</id>
|
||||||
|
<version>1.0.16</version>
|
||||||
|
<authors>Epigram</authors>
|
||||||
|
<license type="expression">MIT</license>
|
||||||
|
<licenseUrl>https://licenses.nuget.org/MIT</licenseUrl>
|
||||||
|
<description>Library for recording audit logs using MongoDB.</description>
|
||||||
|
<tags>audit logs mongodb</tags>
|
||||||
|
<repository type="git" url="https://git.teralevel.io/jrojas/audit/src/branch/master/audit-logs" commit="8c3be106f93e44ea3daffe2267723e4026a0569d" />
|
||||||
|
<dependencies>
|
||||||
|
<group targetFramework="net8.0">
|
||||||
|
<dependency id="Microsoft.Extensions.Hosting" version="8.0.0" exclude="Build,Analyzers" />
|
||||||
|
<dependency id="MongoDB.Driver" version="2.23.1" exclude="Build,Analyzers" />
|
||||||
|
<dependency id="Newtonsoft.Json" version="13.0.3" exclude="Build,Analyzers" />
|
||||||
|
<dependency id="Serilog" version="4.0.2" exclude="Build,Analyzers" />
|
||||||
|
</group>
|
||||||
|
</dependencies>
|
||||||
|
</metadata>
|
||||||
|
<files>
|
||||||
|
<file src="/home/julian/Documentos/repos/audit/audit-logs/audit-logs/bin/Debug/net8.0/audit-logs.dll" target="lib/net8.0/audit-logs.dll" />
|
||||||
|
</files>
|
||||||
|
</package>
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
|
||||||
|
<metadata>
|
||||||
|
<id>AuditLogs</id>
|
||||||
|
<version>1.0.17</version>
|
||||||
|
<authors>Epigram</authors>
|
||||||
|
<license type="expression">MIT</license>
|
||||||
|
<licenseUrl>https://licenses.nuget.org/MIT</licenseUrl>
|
||||||
|
<description>Library for recording audit logs using MongoDB.</description>
|
||||||
|
<tags>audit logs mongodb</tags>
|
||||||
|
<repository type="git" url="https://git.teralevel.io/jrojas/audit/src/branch/master/audit-logs" commit="8c3be106f93e44ea3daffe2267723e4026a0569d" />
|
||||||
|
<dependencies>
|
||||||
|
<group targetFramework="net8.0">
|
||||||
|
<dependency id="Microsoft.Extensions.Hosting" version="8.0.0" exclude="Build,Analyzers" />
|
||||||
|
<dependency id="MongoDB.Driver" version="2.23.1" exclude="Build,Analyzers" />
|
||||||
|
<dependency id="Newtonsoft.Json" version="13.0.3" exclude="Build,Analyzers" />
|
||||||
|
<dependency id="Serilog" version="4.0.2" exclude="Build,Analyzers" />
|
||||||
|
</group>
|
||||||
|
</dependencies>
|
||||||
|
</metadata>
|
||||||
|
<files>
|
||||||
|
<file src="/home/julian/Documentos/repos/audit/audit-logs/audit-logs/bin/Debug/net8.0/audit-logs.dll" target="lib/net8.0/audit-logs.dll" />
|
||||||
|
</files>
|
||||||
|
</package>
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
|
||||||
|
<metadata>
|
||||||
|
<id>AuditLogs</id>
|
||||||
|
<version>1.0.2</version>
|
||||||
|
<authors>Epigram</authors>
|
||||||
|
<license type="expression">MIT</license>
|
||||||
|
<licenseUrl>https://licenses.nuget.org/MIT</licenseUrl>
|
||||||
|
<description>Library for recording audit logs using MongoDB.</description>
|
||||||
|
<tags>audit logs mongodb</tags>
|
||||||
|
<repository type="git" url="https://git.teralevel.io/jrojas/audit/src/branch/master/audit-logs" commit="8c3be106f93e44ea3daffe2267723e4026a0569d" />
|
||||||
|
<dependencies>
|
||||||
|
<group targetFramework="net8.0">
|
||||||
|
<dependency id="Microsoft.Extensions.Hosting" version="8.0.0" exclude="Build,Analyzers" />
|
||||||
|
<dependency id="MongoDB.Driver" version="2.23.1" exclude="Build,Analyzers" />
|
||||||
|
<dependency id="Newtonsoft.Json" version="13.0.3" exclude="Build,Analyzers" />
|
||||||
|
<dependency id="Serilog" version="4.0.2" exclude="Build,Analyzers" />
|
||||||
|
</group>
|
||||||
|
</dependencies>
|
||||||
|
</metadata>
|
||||||
|
<files>
|
||||||
|
<file src="/home/julian/Documentos/repos/audit/audit-logs/audit-logs/bin/Debug/net8.0/audit-logs.dll" target="lib/net8.0/audit-logs.dll" />
|
||||||
|
</files>
|
||||||
|
</package>
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
|
||||||
|
<metadata>
|
||||||
|
<id>AuditLogs</id>
|
||||||
|
<version>1.0.3</version>
|
||||||
|
<authors>Epigram</authors>
|
||||||
|
<license type="expression">MIT</license>
|
||||||
|
<licenseUrl>https://licenses.nuget.org/MIT</licenseUrl>
|
||||||
|
<description>Library for recording audit logs using MongoDB.</description>
|
||||||
|
<tags>audit logs mongodb</tags>
|
||||||
|
<repository type="git" url="https://git.teralevel.io/jrojas/audit/src/branch/master/audit-logs" commit="8c3be106f93e44ea3daffe2267723e4026a0569d" />
|
||||||
|
<dependencies>
|
||||||
|
<group targetFramework="net8.0">
|
||||||
|
<dependency id="Microsoft.Extensions.Hosting" version="8.0.0" exclude="Build,Analyzers" />
|
||||||
|
<dependency id="MongoDB.Driver" version="2.23.1" exclude="Build,Analyzers" />
|
||||||
|
<dependency id="Newtonsoft.Json" version="13.0.3" exclude="Build,Analyzers" />
|
||||||
|
<dependency id="Serilog" version="4.0.2" exclude="Build,Analyzers" />
|
||||||
|
</group>
|
||||||
|
</dependencies>
|
||||||
|
</metadata>
|
||||||
|
<files>
|
||||||
|
<file src="/home/julian/Documentos/repos/audit/audit-logs/audit-logs/bin/Debug/net8.0/audit-logs.dll" target="lib/net8.0/audit-logs.dll" />
|
||||||
|
</files>
|
||||||
|
</package>
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
|
||||||
|
<metadata>
|
||||||
|
<id>AuditLogs</id>
|
||||||
|
<version>1.0.4</version>
|
||||||
|
<authors>Epigram</authors>
|
||||||
|
<license type="expression">MIT</license>
|
||||||
|
<licenseUrl>https://licenses.nuget.org/MIT</licenseUrl>
|
||||||
|
<description>Library for recording audit logs using MongoDB.</description>
|
||||||
|
<tags>audit logs mongodb</tags>
|
||||||
|
<repository type="git" url="https://git.teralevel.io/jrojas/audit/src/branch/master/audit-logs" commit="8c3be106f93e44ea3daffe2267723e4026a0569d" />
|
||||||
|
<dependencies>
|
||||||
|
<group targetFramework="net8.0">
|
||||||
|
<dependency id="Microsoft.Extensions.Hosting" version="8.0.0" exclude="Build,Analyzers" />
|
||||||
|
<dependency id="MongoDB.Driver" version="2.23.1" exclude="Build,Analyzers" />
|
||||||
|
<dependency id="Newtonsoft.Json" version="13.0.3" exclude="Build,Analyzers" />
|
||||||
|
<dependency id="Serilog" version="4.0.2" exclude="Build,Analyzers" />
|
||||||
|
</group>
|
||||||
|
</dependencies>
|
||||||
|
</metadata>
|
||||||
|
<files>
|
||||||
|
<file src="/home/julian/Documentos/repos/audit/audit-logs/audit-logs/bin/Debug/net8.0/audit-logs.dll" target="lib/net8.0/audit-logs.dll" />
|
||||||
|
</files>
|
||||||
|
</package>
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
|
||||||
|
<metadata>
|
||||||
|
<id>AuditLogs</id>
|
||||||
|
<version>1.0.5</version>
|
||||||
|
<authors>Epigram</authors>
|
||||||
|
<license type="expression">MIT</license>
|
||||||
|
<licenseUrl>https://licenses.nuget.org/MIT</licenseUrl>
|
||||||
|
<description>Library for recording audit logs using MongoDB.</description>
|
||||||
|
<tags>audit logs mongodb</tags>
|
||||||
|
<repository type="git" url="https://git.teralevel.io/jrojas/audit/src/branch/master/audit-logs" commit="8c3be106f93e44ea3daffe2267723e4026a0569d" />
|
||||||
|
<dependencies>
|
||||||
|
<group targetFramework="net8.0">
|
||||||
|
<dependency id="Microsoft.Extensions.Hosting" version="8.0.0" exclude="Build,Analyzers" />
|
||||||
|
<dependency id="MongoDB.Driver" version="2.23.1" exclude="Build,Analyzers" />
|
||||||
|
<dependency id="Newtonsoft.Json" version="13.0.3" exclude="Build,Analyzers" />
|
||||||
|
<dependency id="Serilog" version="4.0.2" exclude="Build,Analyzers" />
|
||||||
|
</group>
|
||||||
|
</dependencies>
|
||||||
|
</metadata>
|
||||||
|
<files>
|
||||||
|
<file src="/home/julian/Documentos/repos/audit/audit-logs/audit-logs/bin/Debug/net8.0/audit-logs.dll" target="lib/net8.0/audit-logs.dll" />
|
||||||
|
</files>
|
||||||
|
</package>
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
|
||||||
|
<metadata>
|
||||||
|
<id>AuditLogs</id>
|
||||||
|
<version>1.0.6</version>
|
||||||
|
<authors>Epigram</authors>
|
||||||
|
<license type="expression">MIT</license>
|
||||||
|
<licenseUrl>https://licenses.nuget.org/MIT</licenseUrl>
|
||||||
|
<description>Library for recording audit logs using MongoDB.</description>
|
||||||
|
<tags>audit logs mongodb</tags>
|
||||||
|
<repository type="git" url="https://git.teralevel.io/jrojas/audit/src/branch/master/audit-logs" commit="8c3be106f93e44ea3daffe2267723e4026a0569d" />
|
||||||
|
<dependencies>
|
||||||
|
<group targetFramework="net8.0">
|
||||||
|
<dependency id="Microsoft.Extensions.Hosting" version="8.0.0" exclude="Build,Analyzers" />
|
||||||
|
<dependency id="MongoDB.Driver" version="2.23.1" exclude="Build,Analyzers" />
|
||||||
|
<dependency id="Newtonsoft.Json" version="13.0.3" exclude="Build,Analyzers" />
|
||||||
|
<dependency id="Serilog" version="4.0.2" exclude="Build,Analyzers" />
|
||||||
|
</group>
|
||||||
|
</dependencies>
|
||||||
|
</metadata>
|
||||||
|
<files>
|
||||||
|
<file src="/home/julian/Documentos/repos/audit/audit-logs/audit-logs/bin/Debug/net8.0/audit-logs.dll" target="lib/net8.0/audit-logs.dll" />
|
||||||
|
</files>
|
||||||
|
</package>
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
|
||||||
|
<metadata>
|
||||||
|
<id>AuditLogs</id>
|
||||||
|
<version>1.0.7</version>
|
||||||
|
<authors>Epigram</authors>
|
||||||
|
<license type="expression">MIT</license>
|
||||||
|
<licenseUrl>https://licenses.nuget.org/MIT</licenseUrl>
|
||||||
|
<description>Library for recording audit logs using MongoDB.</description>
|
||||||
|
<tags>audit logs mongodb</tags>
|
||||||
|
<repository type="git" url="https://git.teralevel.io/jrojas/audit/src/branch/master/audit-logs" commit="8c3be106f93e44ea3daffe2267723e4026a0569d" />
|
||||||
|
<dependencies>
|
||||||
|
<group targetFramework="net8.0">
|
||||||
|
<dependency id="Microsoft.Extensions.Hosting" version="8.0.0" exclude="Build,Analyzers" />
|
||||||
|
<dependency id="MongoDB.Driver" version="2.23.1" exclude="Build,Analyzers" />
|
||||||
|
<dependency id="Newtonsoft.Json" version="13.0.3" exclude="Build,Analyzers" />
|
||||||
|
<dependency id="Serilog" version="4.0.2" exclude="Build,Analyzers" />
|
||||||
|
</group>
|
||||||
|
</dependencies>
|
||||||
|
</metadata>
|
||||||
|
<files>
|
||||||
|
<file src="/home/julian/Documentos/repos/audit/audit-logs/audit-logs/bin/Debug/net8.0/audit-logs.dll" target="lib/net8.0/audit-logs.dll" />
|
||||||
|
</files>
|
||||||
|
</package>
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
|
||||||
|
<metadata>
|
||||||
|
<id>AuditLogs</id>
|
||||||
|
<version>1.0.8</version>
|
||||||
|
<authors>Epigram</authors>
|
||||||
|
<license type="expression">MIT</license>
|
||||||
|
<licenseUrl>https://licenses.nuget.org/MIT</licenseUrl>
|
||||||
|
<description>Library for recording audit logs using MongoDB.</description>
|
||||||
|
<tags>audit logs mongodb</tags>
|
||||||
|
<repository type="git" url="https://git.teralevel.io/jrojas/audit/src/branch/master/audit-logs" commit="8c3be106f93e44ea3daffe2267723e4026a0569d" />
|
||||||
|
<dependencies>
|
||||||
|
<group targetFramework="net8.0">
|
||||||
|
<dependency id="Microsoft.Extensions.Hosting" version="8.0.0" exclude="Build,Analyzers" />
|
||||||
|
<dependency id="MongoDB.Driver" version="2.23.1" exclude="Build,Analyzers" />
|
||||||
|
<dependency id="Newtonsoft.Json" version="13.0.3" exclude="Build,Analyzers" />
|
||||||
|
<dependency id="Serilog" version="4.0.2" exclude="Build,Analyzers" />
|
||||||
|
</group>
|
||||||
|
</dependencies>
|
||||||
|
</metadata>
|
||||||
|
<files>
|
||||||
|
<file src="/home/julian/Documentos/repos/audit/audit-logs/audit-logs/bin/Debug/net8.0/audit-logs.dll" target="lib/net8.0/audit-logs.dll" />
|
||||||
|
</files>
|
||||||
|
</package>
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
|
||||||
|
<metadata>
|
||||||
|
<id>AuditLogs</id>
|
||||||
|
<version>1.0.9</version>
|
||||||
|
<authors>Epigram</authors>
|
||||||
|
<license type="expression">MIT</license>
|
||||||
|
<licenseUrl>https://licenses.nuget.org/MIT</licenseUrl>
|
||||||
|
<description>Library for recording audit logs using MongoDB.</description>
|
||||||
|
<tags>audit logs mongodb</tags>
|
||||||
|
<repository type="git" url="https://git.teralevel.io/jrojas/audit/src/branch/master/audit-logs" commit="8c3be106f93e44ea3daffe2267723e4026a0569d" />
|
||||||
|
<dependencies>
|
||||||
|
<group targetFramework="net8.0">
|
||||||
|
<dependency id="Microsoft.Extensions.Hosting" version="8.0.0" exclude="Build,Analyzers" />
|
||||||
|
<dependency id="MongoDB.Driver" version="2.23.1" exclude="Build,Analyzers" />
|
||||||
|
<dependency id="Newtonsoft.Json" version="13.0.3" exclude="Build,Analyzers" />
|
||||||
|
<dependency id="Serilog" version="4.0.2" exclude="Build,Analyzers" />
|
||||||
|
</group>
|
||||||
|
</dependencies>
|
||||||
|
</metadata>
|
||||||
|
<files>
|
||||||
|
<file src="/home/julian/Documentos/repos/audit/audit-logs/audit-logs/bin/Debug/net8.0/audit-logs.dll" target="lib/net8.0/audit-logs.dll" />
|
||||||
|
</files>
|
||||||
|
</package>
|
||||||
@@ -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.0.0")]
|
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.17.0")]
|
||||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+bdfe9ffd6d7ec01a3c152f620ff834559f34f36b")]
|
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.17+8c3be106f93e44ea3daffe2267723e4026a0569d")]
|
||||||
[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.0.0")]
|
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.17.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 @@
|
|||||||
3da583d53325d8c9886e8617ca36302f5a556e2ae15192f17c6fb59588f9f954
|
320b6d684f74b89619de8f730502db744f8cdec76db8b9368a26a05e0f551580
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
@@ -1 +1 @@
|
|||||||
cf177283a2ba8b126265dab8c16e39a85bbcfb3f00907c9cfaadb9566ddb513a
|
fee74b0a3f2ed58887d58c89fb59bc5939f2abe98f34889b8fcfd273ddc62914
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -8,7 +8,7 @@
|
|||||||
<licenseUrl>https://licenses.nuget.org/MIT</licenseUrl>
|
<licenseUrl>https://licenses.nuget.org/MIT</licenseUrl>
|
||||||
<description>Library for recording audit logs using MongoDB.</description>
|
<description>Library for recording audit logs using MongoDB.</description>
|
||||||
<tags>audit logs mongodb</tags>
|
<tags>audit logs mongodb</tags>
|
||||||
<repository type="git" url="https://git.teralevel.io/jrojas/audit/src/branch/master/audit-logs" commit="bdfe9ffd6d7ec01a3c152f620ff834559f34f36b" />
|
<repository type="git" url="https://git.teralevel.io/jrojas/audit/src/branch/master/audit-logs" commit="8c3be106f93e44ea3daffe2267723e4026a0569d" />
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<group targetFramework="net8.0">
|
<group targetFramework="net8.0">
|
||||||
<dependency id="Microsoft.Extensions.Hosting" version="9.0.0-rc.2.24473.5" exclude="Build,Analyzers" />
|
<dependency id="Microsoft.Extensions.Hosting" version="9.0.0-rc.2.24473.5" exclude="Build,Analyzers" />
|
||||||
|
|||||||
@@ -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.0",
|
"version": "1.0.16",
|
||||||
"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",
|
||||||
@@ -20,7 +20,8 @@
|
|||||||
"net8.0"
|
"net8.0"
|
||||||
],
|
],
|
||||||
"sources": {
|
"sources": {
|
||||||
"https://api.nuget.org/v3/index.json": {}
|
"https://api.nuget.org/v3/index.json": {},
|
||||||
|
"https://smacs-nuget.epigramdev.com/v3/index.json": {}
|
||||||
},
|
},
|
||||||
"frameworks": {
|
"frameworks": {
|
||||||
"net8.0": {
|
"net8.0": {
|
||||||
@@ -45,7 +46,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"Microsoft.Extensions.Hosting": {
|
"Microsoft.Extensions.Hosting": {
|
||||||
"target": "Package",
|
"target": "Package",
|
||||||
"version": "[9.0.0-rc.2.24473.5, )"
|
"version": "[8.0.0, )"
|
||||||
},
|
},
|
||||||
"MongoDB.Driver": {
|
"MongoDB.Driver": {
|
||||||
"target": "Package",
|
"target": "Package",
|
||||||
@@ -57,7 +58,7 @@
|
|||||||
},
|
},
|
||||||
"Serilog": {
|
"Serilog": {
|
||||||
"target": "Package",
|
"target": "Package",
|
||||||
"version": "[4.1.1-dev-02318, )"
|
"version": "[4.0.2, )"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"imports": [
|
"imports": [
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
<SourceRoot Include="/home/julian/.nuget/packages/" />
|
<SourceRoot Include="/home/julian/.nuget/packages/" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ImportGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
<ImportGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
||||||
<Import Project="$(NuGetPackageRoot)microsoft.extensions.configuration.usersecrets/9.0.0-rc.2.24473.5/buildTransitive/net8.0/Microsoft.Extensions.Configuration.UserSecrets.props" Condition="Exists('$(NuGetPackageRoot)microsoft.extensions.configuration.usersecrets/9.0.0-rc.2.24473.5/buildTransitive/net8.0/Microsoft.Extensions.Configuration.UserSecrets.props')" />
|
<Import Project="$(NuGetPackageRoot)microsoft.extensions.configuration.usersecrets/8.0.0/buildTransitive/net6.0/Microsoft.Extensions.Configuration.UserSecrets.props" Condition="Exists('$(NuGetPackageRoot)microsoft.extensions.configuration.usersecrets/8.0.0/buildTransitive/net6.0/Microsoft.Extensions.Configuration.UserSecrets.props')" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
||||||
<PkgAWSSDK_Core Condition=" '$(PkgAWSSDK_Core)' == '' ">/home/julian/.nuget/packages/awssdk.core/3.7.100.14</PkgAWSSDK_Core>
|
<PkgAWSSDK_Core Condition=" '$(PkgAWSSDK_Core)' == '' ">/home/julian/.nuget/packages/awssdk.core/3.7.100.14</PkgAWSSDK_Core>
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
||||||
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<ImportGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
<ImportGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
||||||
<Import Project="$(NuGetPackageRoot)system.text.json/9.0.0-rc.2.24473.5/buildTransitive/net8.0/System.Text.Json.targets" Condition="Exists('$(NuGetPackageRoot)system.text.json/9.0.0-rc.2.24473.5/buildTransitive/net8.0/System.Text.Json.targets')" />
|
<Import Project="$(NuGetPackageRoot)system.text.json/8.0.0/buildTransitive/net6.0/System.Text.Json.targets" Condition="Exists('$(NuGetPackageRoot)system.text.json/8.0.0/buildTransitive/net6.0/System.Text.Json.targets')" />
|
||||||
<Import Project="$(NuGetPackageRoot)microsoft.extensions.logging.abstractions/9.0.0-rc.2.24473.5/buildTransitive/net8.0/Microsoft.Extensions.Logging.Abstractions.targets" Condition="Exists('$(NuGetPackageRoot)microsoft.extensions.logging.abstractions/9.0.0-rc.2.24473.5/buildTransitive/net8.0/Microsoft.Extensions.Logging.Abstractions.targets')" />
|
<Import Project="$(NuGetPackageRoot)microsoft.extensions.logging.abstractions/8.0.0/buildTransitive/net6.0/Microsoft.Extensions.Logging.Abstractions.targets" Condition="Exists('$(NuGetPackageRoot)microsoft.extensions.logging.abstractions/8.0.0/buildTransitive/net6.0/Microsoft.Extensions.Logging.Abstractions.targets')" />
|
||||||
<Import Project="$(NuGetPackageRoot)microsoft.extensions.options/9.0.0-rc.2.24473.5/buildTransitive/net8.0/Microsoft.Extensions.Options.targets" Condition="Exists('$(NuGetPackageRoot)microsoft.extensions.options/9.0.0-rc.2.24473.5/buildTransitive/net8.0/Microsoft.Extensions.Options.targets')" />
|
<Import Project="$(NuGetPackageRoot)microsoft.extensions.options/8.0.0/buildTransitive/net6.0/Microsoft.Extensions.Options.targets" Condition="Exists('$(NuGetPackageRoot)microsoft.extensions.options/8.0.0/buildTransitive/net6.0/Microsoft.Extensions.Options.targets')" />
|
||||||
<Import Project="$(NuGetPackageRoot)microsoft.extensions.configuration.binder/9.0.0-rc.2.24473.5/buildTransitive/netstandard2.0/Microsoft.Extensions.Configuration.Binder.targets" Condition="Exists('$(NuGetPackageRoot)microsoft.extensions.configuration.binder/9.0.0-rc.2.24473.5/buildTransitive/netstandard2.0/Microsoft.Extensions.Configuration.Binder.targets')" />
|
<Import Project="$(NuGetPackageRoot)microsoft.extensions.configuration.binder/8.0.0/buildTransitive/netstandard2.0/Microsoft.Extensions.Configuration.Binder.targets" Condition="Exists('$(NuGetPackageRoot)microsoft.extensions.configuration.binder/8.0.0/buildTransitive/netstandard2.0/Microsoft.Extensions.Configuration.Binder.targets')" />
|
||||||
<Import Project="$(NuGetPackageRoot)microsoft.extensions.configuration.usersecrets/9.0.0-rc.2.24473.5/buildTransitive/net8.0/Microsoft.Extensions.Configuration.UserSecrets.targets" Condition="Exists('$(NuGetPackageRoot)microsoft.extensions.configuration.usersecrets/9.0.0-rc.2.24473.5/buildTransitive/net8.0/Microsoft.Extensions.Configuration.UserSecrets.targets')" />
|
<Import Project="$(NuGetPackageRoot)microsoft.extensions.configuration.usersecrets/8.0.0/buildTransitive/net6.0/Microsoft.Extensions.Configuration.UserSecrets.targets" Condition="Exists('$(NuGetPackageRoot)microsoft.extensions.configuration.usersecrets/8.0.0/buildTransitive/net6.0/Microsoft.Extensions.Configuration.UserSecrets.targets')" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
</Project>
|
</Project>
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,39 +1,39 @@
|
|||||||
{
|
{
|
||||||
"version": 2,
|
"version": 2,
|
||||||
"dgSpecHash": "GBe+TKnMpyo=",
|
"dgSpecHash": "Et3G5FTIc/k=",
|
||||||
"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": [
|
||||||
"/home/julian/.nuget/packages/awssdk.core/3.7.100.14/awssdk.core.3.7.100.14.nupkg.sha512",
|
"/home/julian/.nuget/packages/awssdk.core/3.7.100.14/awssdk.core.3.7.100.14.nupkg.sha512",
|
||||||
"/home/julian/.nuget/packages/awssdk.securitytoken/3.7.100.14/awssdk.securitytoken.3.7.100.14.nupkg.sha512",
|
"/home/julian/.nuget/packages/awssdk.securitytoken/3.7.100.14/awssdk.securitytoken.3.7.100.14.nupkg.sha512",
|
||||||
"/home/julian/.nuget/packages/dnsclient/1.6.1/dnsclient.1.6.1.nupkg.sha512",
|
"/home/julian/.nuget/packages/dnsclient/1.6.1/dnsclient.1.6.1.nupkg.sha512",
|
||||||
"/home/julian/.nuget/packages/microsoft.extensions.configuration/9.0.0-rc.2.24473.5/microsoft.extensions.configuration.9.0.0-rc.2.24473.5.nupkg.sha512",
|
"/home/julian/.nuget/packages/microsoft.extensions.configuration/8.0.0/microsoft.extensions.configuration.8.0.0.nupkg.sha512",
|
||||||
"/home/julian/.nuget/packages/microsoft.extensions.configuration.abstractions/9.0.0-rc.2.24473.5/microsoft.extensions.configuration.abstractions.9.0.0-rc.2.24473.5.nupkg.sha512",
|
"/home/julian/.nuget/packages/microsoft.extensions.configuration.abstractions/8.0.0/microsoft.extensions.configuration.abstractions.8.0.0.nupkg.sha512",
|
||||||
"/home/julian/.nuget/packages/microsoft.extensions.configuration.binder/9.0.0-rc.2.24473.5/microsoft.extensions.configuration.binder.9.0.0-rc.2.24473.5.nupkg.sha512",
|
"/home/julian/.nuget/packages/microsoft.extensions.configuration.binder/8.0.0/microsoft.extensions.configuration.binder.8.0.0.nupkg.sha512",
|
||||||
"/home/julian/.nuget/packages/microsoft.extensions.configuration.commandline/9.0.0-rc.2.24473.5/microsoft.extensions.configuration.commandline.9.0.0-rc.2.24473.5.nupkg.sha512",
|
"/home/julian/.nuget/packages/microsoft.extensions.configuration.commandline/8.0.0/microsoft.extensions.configuration.commandline.8.0.0.nupkg.sha512",
|
||||||
"/home/julian/.nuget/packages/microsoft.extensions.configuration.environmentvariables/9.0.0-rc.2.24473.5/microsoft.extensions.configuration.environmentvariables.9.0.0-rc.2.24473.5.nupkg.sha512",
|
"/home/julian/.nuget/packages/microsoft.extensions.configuration.environmentvariables/8.0.0/microsoft.extensions.configuration.environmentvariables.8.0.0.nupkg.sha512",
|
||||||
"/home/julian/.nuget/packages/microsoft.extensions.configuration.fileextensions/9.0.0-rc.2.24473.5/microsoft.extensions.configuration.fileextensions.9.0.0-rc.2.24473.5.nupkg.sha512",
|
"/home/julian/.nuget/packages/microsoft.extensions.configuration.fileextensions/8.0.0/microsoft.extensions.configuration.fileextensions.8.0.0.nupkg.sha512",
|
||||||
"/home/julian/.nuget/packages/microsoft.extensions.configuration.json/9.0.0-rc.2.24473.5/microsoft.extensions.configuration.json.9.0.0-rc.2.24473.5.nupkg.sha512",
|
"/home/julian/.nuget/packages/microsoft.extensions.configuration.json/8.0.0/microsoft.extensions.configuration.json.8.0.0.nupkg.sha512",
|
||||||
"/home/julian/.nuget/packages/microsoft.extensions.configuration.usersecrets/9.0.0-rc.2.24473.5/microsoft.extensions.configuration.usersecrets.9.0.0-rc.2.24473.5.nupkg.sha512",
|
"/home/julian/.nuget/packages/microsoft.extensions.configuration.usersecrets/8.0.0/microsoft.extensions.configuration.usersecrets.8.0.0.nupkg.sha512",
|
||||||
"/home/julian/.nuget/packages/microsoft.extensions.dependencyinjection/9.0.0-rc.2.24473.5/microsoft.extensions.dependencyinjection.9.0.0-rc.2.24473.5.nupkg.sha512",
|
"/home/julian/.nuget/packages/microsoft.extensions.dependencyinjection/8.0.0/microsoft.extensions.dependencyinjection.8.0.0.nupkg.sha512",
|
||||||
"/home/julian/.nuget/packages/microsoft.extensions.dependencyinjection.abstractions/9.0.0-rc.2.24473.5/microsoft.extensions.dependencyinjection.abstractions.9.0.0-rc.2.24473.5.nupkg.sha512",
|
"/home/julian/.nuget/packages/microsoft.extensions.dependencyinjection.abstractions/8.0.0/microsoft.extensions.dependencyinjection.abstractions.8.0.0.nupkg.sha512",
|
||||||
"/home/julian/.nuget/packages/microsoft.extensions.diagnostics/9.0.0-rc.2.24473.5/microsoft.extensions.diagnostics.9.0.0-rc.2.24473.5.nupkg.sha512",
|
"/home/julian/.nuget/packages/microsoft.extensions.diagnostics/8.0.0/microsoft.extensions.diagnostics.8.0.0.nupkg.sha512",
|
||||||
"/home/julian/.nuget/packages/microsoft.extensions.diagnostics.abstractions/9.0.0-rc.2.24473.5/microsoft.extensions.diagnostics.abstractions.9.0.0-rc.2.24473.5.nupkg.sha512",
|
"/home/julian/.nuget/packages/microsoft.extensions.diagnostics.abstractions/8.0.0/microsoft.extensions.diagnostics.abstractions.8.0.0.nupkg.sha512",
|
||||||
"/home/julian/.nuget/packages/microsoft.extensions.fileproviders.abstractions/9.0.0-rc.2.24473.5/microsoft.extensions.fileproviders.abstractions.9.0.0-rc.2.24473.5.nupkg.sha512",
|
"/home/julian/.nuget/packages/microsoft.extensions.fileproviders.abstractions/8.0.0/microsoft.extensions.fileproviders.abstractions.8.0.0.nupkg.sha512",
|
||||||
"/home/julian/.nuget/packages/microsoft.extensions.fileproviders.physical/9.0.0-rc.2.24473.5/microsoft.extensions.fileproviders.physical.9.0.0-rc.2.24473.5.nupkg.sha512",
|
"/home/julian/.nuget/packages/microsoft.extensions.fileproviders.physical/8.0.0/microsoft.extensions.fileproviders.physical.8.0.0.nupkg.sha512",
|
||||||
"/home/julian/.nuget/packages/microsoft.extensions.filesystemglobbing/9.0.0-rc.2.24473.5/microsoft.extensions.filesystemglobbing.9.0.0-rc.2.24473.5.nupkg.sha512",
|
"/home/julian/.nuget/packages/microsoft.extensions.filesystemglobbing/8.0.0/microsoft.extensions.filesystemglobbing.8.0.0.nupkg.sha512",
|
||||||
"/home/julian/.nuget/packages/microsoft.extensions.hosting/9.0.0-rc.2.24473.5/microsoft.extensions.hosting.9.0.0-rc.2.24473.5.nupkg.sha512",
|
"/home/julian/.nuget/packages/microsoft.extensions.hosting/8.0.0/microsoft.extensions.hosting.8.0.0.nupkg.sha512",
|
||||||
"/home/julian/.nuget/packages/microsoft.extensions.hosting.abstractions/9.0.0-rc.2.24473.5/microsoft.extensions.hosting.abstractions.9.0.0-rc.2.24473.5.nupkg.sha512",
|
"/home/julian/.nuget/packages/microsoft.extensions.hosting.abstractions/8.0.0/microsoft.extensions.hosting.abstractions.8.0.0.nupkg.sha512",
|
||||||
"/home/julian/.nuget/packages/microsoft.extensions.logging/9.0.0-rc.2.24473.5/microsoft.extensions.logging.9.0.0-rc.2.24473.5.nupkg.sha512",
|
"/home/julian/.nuget/packages/microsoft.extensions.logging/8.0.0/microsoft.extensions.logging.8.0.0.nupkg.sha512",
|
||||||
"/home/julian/.nuget/packages/microsoft.extensions.logging.abstractions/9.0.0-rc.2.24473.5/microsoft.extensions.logging.abstractions.9.0.0-rc.2.24473.5.nupkg.sha512",
|
"/home/julian/.nuget/packages/microsoft.extensions.logging.abstractions/8.0.0/microsoft.extensions.logging.abstractions.8.0.0.nupkg.sha512",
|
||||||
"/home/julian/.nuget/packages/microsoft.extensions.logging.configuration/9.0.0-rc.2.24473.5/microsoft.extensions.logging.configuration.9.0.0-rc.2.24473.5.nupkg.sha512",
|
"/home/julian/.nuget/packages/microsoft.extensions.logging.configuration/8.0.0/microsoft.extensions.logging.configuration.8.0.0.nupkg.sha512",
|
||||||
"/home/julian/.nuget/packages/microsoft.extensions.logging.console/9.0.0-rc.2.24473.5/microsoft.extensions.logging.console.9.0.0-rc.2.24473.5.nupkg.sha512",
|
"/home/julian/.nuget/packages/microsoft.extensions.logging.console/8.0.0/microsoft.extensions.logging.console.8.0.0.nupkg.sha512",
|
||||||
"/home/julian/.nuget/packages/microsoft.extensions.logging.debug/9.0.0-rc.2.24473.5/microsoft.extensions.logging.debug.9.0.0-rc.2.24473.5.nupkg.sha512",
|
"/home/julian/.nuget/packages/microsoft.extensions.logging.debug/8.0.0/microsoft.extensions.logging.debug.8.0.0.nupkg.sha512",
|
||||||
"/home/julian/.nuget/packages/microsoft.extensions.logging.eventlog/9.0.0-rc.2.24473.5/microsoft.extensions.logging.eventlog.9.0.0-rc.2.24473.5.nupkg.sha512",
|
"/home/julian/.nuget/packages/microsoft.extensions.logging.eventlog/8.0.0/microsoft.extensions.logging.eventlog.8.0.0.nupkg.sha512",
|
||||||
"/home/julian/.nuget/packages/microsoft.extensions.logging.eventsource/9.0.0-rc.2.24473.5/microsoft.extensions.logging.eventsource.9.0.0-rc.2.24473.5.nupkg.sha512",
|
"/home/julian/.nuget/packages/microsoft.extensions.logging.eventsource/8.0.0/microsoft.extensions.logging.eventsource.8.0.0.nupkg.sha512",
|
||||||
"/home/julian/.nuget/packages/microsoft.extensions.options/9.0.0-rc.2.24473.5/microsoft.extensions.options.9.0.0-rc.2.24473.5.nupkg.sha512",
|
"/home/julian/.nuget/packages/microsoft.extensions.options/8.0.0/microsoft.extensions.options.8.0.0.nupkg.sha512",
|
||||||
"/home/julian/.nuget/packages/microsoft.extensions.options.configurationextensions/9.0.0-rc.2.24473.5/microsoft.extensions.options.configurationextensions.9.0.0-rc.2.24473.5.nupkg.sha512",
|
"/home/julian/.nuget/packages/microsoft.extensions.options.configurationextensions/8.0.0/microsoft.extensions.options.configurationextensions.8.0.0.nupkg.sha512",
|
||||||
"/home/julian/.nuget/packages/microsoft.extensions.primitives/9.0.0-rc.2.24473.5/microsoft.extensions.primitives.9.0.0-rc.2.24473.5.nupkg.sha512",
|
"/home/julian/.nuget/packages/microsoft.extensions.primitives/8.0.0/microsoft.extensions.primitives.8.0.0.nupkg.sha512",
|
||||||
"/home/julian/.nuget/packages/microsoft.netcore.platforms/5.0.0/microsoft.netcore.platforms.5.0.0.nupkg.sha512",
|
"/home/julian/.nuget/packages/microsoft.netcore.platforms/5.0.0/microsoft.netcore.platforms.5.0.0.nupkg.sha512",
|
||||||
"/home/julian/.nuget/packages/microsoft.win32.registry/5.0.0/microsoft.win32.registry.5.0.0.nupkg.sha512",
|
"/home/julian/.nuget/packages/microsoft.win32.registry/5.0.0/microsoft.win32.registry.5.0.0.nupkg.sha512",
|
||||||
"/home/julian/.nuget/packages/mongodb.bson/2.23.1/mongodb.bson.2.23.1.nupkg.sha512",
|
"/home/julian/.nuget/packages/mongodb.bson/2.23.1/mongodb.bson.2.23.1.nupkg.sha512",
|
||||||
@@ -41,19 +41,18 @@
|
|||||||
"/home/julian/.nuget/packages/mongodb.driver.core/2.23.1/mongodb.driver.core.2.23.1.nupkg.sha512",
|
"/home/julian/.nuget/packages/mongodb.driver.core/2.23.1/mongodb.driver.core.2.23.1.nupkg.sha512",
|
||||||
"/home/julian/.nuget/packages/mongodb.libmongocrypt/1.8.0/mongodb.libmongocrypt.1.8.0.nupkg.sha512",
|
"/home/julian/.nuget/packages/mongodb.libmongocrypt/1.8.0/mongodb.libmongocrypt.1.8.0.nupkg.sha512",
|
||||||
"/home/julian/.nuget/packages/newtonsoft.json/13.0.3/newtonsoft.json.13.0.3.nupkg.sha512",
|
"/home/julian/.nuget/packages/newtonsoft.json/13.0.3/newtonsoft.json.13.0.3.nupkg.sha512",
|
||||||
"/home/julian/.nuget/packages/serilog/4.1.1-dev-02318/serilog.4.1.1-dev-02318.nupkg.sha512",
|
"/home/julian/.nuget/packages/serilog/4.0.2/serilog.4.0.2.nupkg.sha512",
|
||||||
"/home/julian/.nuget/packages/sharpcompress/0.30.1/sharpcompress.0.30.1.nupkg.sha512",
|
"/home/julian/.nuget/packages/sharpcompress/0.30.1/sharpcompress.0.30.1.nupkg.sha512",
|
||||||
"/home/julian/.nuget/packages/snappier/1.0.0/snappier.1.0.0.nupkg.sha512",
|
"/home/julian/.nuget/packages/snappier/1.0.0/snappier.1.0.0.nupkg.sha512",
|
||||||
"/home/julian/.nuget/packages/system.buffers/4.5.1/system.buffers.4.5.1.nupkg.sha512",
|
"/home/julian/.nuget/packages/system.buffers/4.5.1/system.buffers.4.5.1.nupkg.sha512",
|
||||||
"/home/julian/.nuget/packages/system.diagnostics.diagnosticsource/9.0.0-rc.2.24473.5/system.diagnostics.diagnosticsource.9.0.0-rc.2.24473.5.nupkg.sha512",
|
"/home/julian/.nuget/packages/system.diagnostics.diagnosticsource/8.0.0/system.diagnostics.diagnosticsource.8.0.0.nupkg.sha512",
|
||||||
"/home/julian/.nuget/packages/system.diagnostics.eventlog/9.0.0-rc.2.24473.5/system.diagnostics.eventlog.9.0.0-rc.2.24473.5.nupkg.sha512",
|
"/home/julian/.nuget/packages/system.diagnostics.eventlog/8.0.0/system.diagnostics.eventlog.8.0.0.nupkg.sha512",
|
||||||
"/home/julian/.nuget/packages/system.io.pipelines/9.0.0-rc.2.24473.5/system.io.pipelines.9.0.0-rc.2.24473.5.nupkg.sha512",
|
|
||||||
"/home/julian/.nuget/packages/system.memory/4.5.5/system.memory.4.5.5.nupkg.sha512",
|
"/home/julian/.nuget/packages/system.memory/4.5.5/system.memory.4.5.5.nupkg.sha512",
|
||||||
"/home/julian/.nuget/packages/system.runtime.compilerservices.unsafe/5.0.0/system.runtime.compilerservices.unsafe.5.0.0.nupkg.sha512",
|
"/home/julian/.nuget/packages/system.runtime.compilerservices.unsafe/5.0.0/system.runtime.compilerservices.unsafe.5.0.0.nupkg.sha512",
|
||||||
"/home/julian/.nuget/packages/system.security.accesscontrol/5.0.0/system.security.accesscontrol.5.0.0.nupkg.sha512",
|
"/home/julian/.nuget/packages/system.security.accesscontrol/5.0.0/system.security.accesscontrol.5.0.0.nupkg.sha512",
|
||||||
"/home/julian/.nuget/packages/system.security.principal.windows/5.0.0/system.security.principal.windows.5.0.0.nupkg.sha512",
|
"/home/julian/.nuget/packages/system.security.principal.windows/5.0.0/system.security.principal.windows.5.0.0.nupkg.sha512",
|
||||||
"/home/julian/.nuget/packages/system.text.encodings.web/9.0.0-rc.2.24473.5/system.text.encodings.web.9.0.0-rc.2.24473.5.nupkg.sha512",
|
"/home/julian/.nuget/packages/system.text.encodings.web/8.0.0/system.text.encodings.web.8.0.0.nupkg.sha512",
|
||||||
"/home/julian/.nuget/packages/system.text.json/9.0.0-rc.2.24473.5/system.text.json.9.0.0-rc.2.24473.5.nupkg.sha512",
|
"/home/julian/.nuget/packages/system.text.json/8.0.0/system.text.json.8.0.0.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"
|
||||||
],
|
],
|
||||||
"logs": []
|
"logs": []
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
"restore":{"projectUniqueName":"/home/julian/Documentos/repos/audit/audit-logs/audit-logs/audit-logs.csproj","projectName":"AuditLogs","projectPath":"/home/julian/Documentos/repos/audit/audit-logs/audit-logs/audit-logs.csproj","outputPath":"/home/julian/Documentos/repos/audit/audit-logs/audit-logs/obj/","projectStyle":"PackageReference","originalTargetFrameworks":["net8.0"],"sources":{"https://api.nuget.org/v3/index.json":{}},"frameworks":{"net8.0":{"targetAlias":"net8.0","projectReferences":{}}},"warningProperties":{"warnAsError":["NU1605"]},"restoreAuditProperties":{"enableAudit":"true","auditLevel":"low","auditMode":"direct"}}"frameworks":{"net8.0":{"targetAlias":"net8.0","dependencies":{"Microsoft.Extensions.Hosting":{"target":"Package","version":"[9.0.0-rc.2.24473.5, )"},"MongoDB.Driver":{"target":"Package","version":"[2.23.1, )"},"Newtonsoft.Json":{"target":"Package","version":"[13.0.3, )"},"Serilog":{"target":"Package","version":"[4.1.1-dev-02318, )"}},"imports":["net461","net462","net47","net471","net472","net48","net481"],"assetTargetFallback":true,"warn":true,"frameworkReferences":{"Microsoft.NETCore.App":{"privateAssets":"all"}},"runtimeIdentifierGraphPath":"/home/julian/.dotnet/sdk/8.0.401/PortableRuntimeIdentifierGraph.json"}}
|
"restore":{"projectUniqueName":"/home/julian/Documentos/repos/audit/audit-logs/audit-logs/audit-logs.csproj","projectName":"AuditLogs","projectPath":"/home/julian/Documentos/repos/audit/audit-logs/audit-logs/audit-logs.csproj","outputPath":"/home/julian/Documentos/repos/audit/audit-logs/audit-logs/obj/","projectStyle":"PackageReference","originalTargetFrameworks":["net8.0"],"sources":{"https://api.nuget.org/v3/index.json":{},"https://smacs-nuget.epigramdev.com/v3/index.json":{}},"frameworks":{"net8.0":{"targetAlias":"net8.0","projectReferences":{}}},"warningProperties":{"warnAsError":["NU1605"]},"restoreAuditProperties":{"enableAudit":"true","auditLevel":"low","auditMode":"direct"}}"frameworks":{"net8.0":{"targetAlias":"net8.0","dependencies":{"Microsoft.Extensions.Hosting":{"target":"Package","version":"[8.0.0, )"},"MongoDB.Driver":{"target":"Package","version":"[2.23.1, )"},"Newtonsoft.Json":{"target":"Package","version":"[13.0.3, )"},"Serilog":{"target":"Package","version":"[4.0.2, )"}},"imports":["net461","net462","net47","net471","net472","net48","net481"],"assetTargetFallback":true,"warn":true,"frameworkReferences":{"Microsoft.NETCore.App":{"privateAssets":"all"}},"runtimeIdentifierGraphPath":"/home/julian/.dotnet/sdk/8.0.401/PortableRuntimeIdentifierGraph.json"}}
|
||||||
@@ -1 +1 @@
|
|||||||
17316668982811724
|
17322799320339764
|
||||||
@@ -1 +1 @@
|
|||||||
17316668982811724
|
17326086729278728
|
||||||
@@ -0,0 +1,520 @@
|
|||||||
|
using audit_logs.Models.DTO;
|
||||||
|
using audit.Model;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
namespace audit_test.Repository;
|
||||||
|
|
||||||
|
using audit_logs.Models;
|
||||||
|
using audit_logs.Services;
|
||||||
|
using NUnit.Framework;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
public class AuditServiceFilterTests
|
||||||
|
{
|
||||||
|
private AuditService _service;
|
||||||
|
|
||||||
|
[SetUp]
|
||||||
|
public void Setup()
|
||||||
|
{
|
||||||
|
// Limpia la base de datos antes de cada prueba
|
||||||
|
IntegrationDb.Database.DropCollectionAsync("AuditRecords").Wait();
|
||||||
|
_service = new AuditService(IntegrationDb.Database);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public async Task GetAuditLogsAsync_FilterByUserId_ReturnsMatchingRecords()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
var records = new List<AuditRecord>
|
||||||
|
{
|
||||||
|
new AuditRecord
|
||||||
|
{
|
||||||
|
EntityType = "User",
|
||||||
|
RecordId = "1",
|
||||||
|
UserId = "User123",
|
||||||
|
ActionType = "Create",
|
||||||
|
ActionTime = DateTime.UtcNow.AddMinutes(-10),
|
||||||
|
Reason = "Testing filter",
|
||||||
|
Changes = new List<AuditRecord.Change>()
|
||||||
|
},
|
||||||
|
new AuditRecord
|
||||||
|
{
|
||||||
|
EntityType = "Admin",
|
||||||
|
RecordId = "2",
|
||||||
|
UserId = "User456",
|
||||||
|
ActionType = "Delete",
|
||||||
|
ActionTime = DateTime.UtcNow,
|
||||||
|
Reason = "Testing filter",
|
||||||
|
Changes = new List<AuditRecord.Change>()
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
foreach (var record in records)
|
||||||
|
{
|
||||||
|
await _service.AuditLogRepository.InsertOneAsync(record);
|
||||||
|
}
|
||||||
|
SpecificAuditLogFilterDto auditLogParametersDto = new SpecificAuditLogFilterDto();
|
||||||
|
auditLogParametersDto.pageNumber=1;
|
||||||
|
auditLogParametersDto.pageSize = 10;
|
||||||
|
auditLogParametersDto.userId="User123";
|
||||||
|
|
||||||
|
// Act
|
||||||
|
var paginatedResult = await _service.GetAuditLogsBySpecificFilterAsync(auditLogParametersDto);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
// Assert
|
||||||
|
Assert.That(paginatedResult.Records.Count(), Is.EqualTo(1), "Should return only records matching the UserId.");
|
||||||
|
var result = paginatedResult.Records.First();
|
||||||
|
Assert.That(result.UserId, Is.EqualTo("User123"), "The UserId should match the filter.");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public async Task GetAuditLogsAsync_FilterByRecordId_ReturnsMatchingRecords()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
var records = new List<AuditRecord>
|
||||||
|
{
|
||||||
|
new AuditRecord
|
||||||
|
{
|
||||||
|
EntityType = "User",
|
||||||
|
RecordId = "Record123",
|
||||||
|
UserId = "User123",
|
||||||
|
ActionType = "Create",
|
||||||
|
ActionTime = DateTime.UtcNow.AddMinutes(-10),
|
||||||
|
Reason = "Testing filter",
|
||||||
|
Changes = new List<AuditRecord.Change>()
|
||||||
|
},
|
||||||
|
new AuditRecord
|
||||||
|
{
|
||||||
|
EntityType = "Admin",
|
||||||
|
RecordId = "Record456",
|
||||||
|
UserId = "User456",
|
||||||
|
ActionType = "Delete",
|
||||||
|
ActionTime = DateTime.UtcNow,
|
||||||
|
Reason = "Testing filter",
|
||||||
|
Changes = new List<AuditRecord.Change>()
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
foreach (var record in records)
|
||||||
|
{
|
||||||
|
await _service.AuditLogRepository.InsertOneAsync(record);
|
||||||
|
}
|
||||||
|
SpecificAuditLogFilterDto auditLogParametersDto = new SpecificAuditLogFilterDto();
|
||||||
|
auditLogParametersDto.pageNumber=1;
|
||||||
|
auditLogParametersDto.pageSize = 10;
|
||||||
|
auditLogParametersDto.userId="User123";
|
||||||
|
|
||||||
|
// Act
|
||||||
|
var paginatedResult = await _service.GetAuditLogsBySpecificFilterAsync(auditLogParametersDto);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
// Assert
|
||||||
|
Assert.That(paginatedResult.Records.Count(), Is.EqualTo(1), "Should return only records matching the RecordId.");
|
||||||
|
var result = paginatedResult.Records.First();
|
||||||
|
Assert.That(result.RecordId, Is.EqualTo("Record123"), "The RecordId should match the filter.");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public async Task GetAuditLogsAsync_FilterByDateRange_ReturnsMatchingRecords()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
var now = DateTime.UtcNow;
|
||||||
|
var records = new List<AuditRecord>
|
||||||
|
{
|
||||||
|
new AuditRecord
|
||||||
|
{
|
||||||
|
EntityType = "User",
|
||||||
|
RecordId = "1",
|
||||||
|
UserId = "User1",
|
||||||
|
ActionType = "Create",
|
||||||
|
ActionTime = now.AddDays(-2),
|
||||||
|
Reason = "Old record",
|
||||||
|
Changes = new List<AuditRecord.Change>()
|
||||||
|
},
|
||||||
|
new AuditRecord
|
||||||
|
{
|
||||||
|
EntityType = "Admin",
|
||||||
|
RecordId = "2",
|
||||||
|
UserId = "User2",
|
||||||
|
ActionType = "Update",
|
||||||
|
ActionTime = now,
|
||||||
|
Reason = "Current record",
|
||||||
|
Changes = new List<AuditRecord.Change>()
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
foreach (var record in records)
|
||||||
|
{
|
||||||
|
await _service.AuditLogRepository.InsertOneAsync(record);
|
||||||
|
}
|
||||||
|
SpecificAuditLogFilterDto auditLogParametersDto = new SpecificAuditLogFilterDto();
|
||||||
|
auditLogParametersDto.pageNumber=1;
|
||||||
|
auditLogParametersDto.pageSize = 10;
|
||||||
|
auditLogParametersDto.startDate=now.AddDays(-1);
|
||||||
|
auditLogParametersDto.endDate=now;
|
||||||
|
|
||||||
|
// Act
|
||||||
|
var paginatedResult = await _service.GetAuditLogsBySpecificFilterAsync(auditLogParametersDto);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
// Assert
|
||||||
|
Assert.That(paginatedResult.Records.Count(), Is.EqualTo(1), "Should return only records within the date range.");
|
||||||
|
var result = paginatedResult.Records.First();
|
||||||
|
Assert.That(result.RecordId, Is.EqualTo("2"), "Only the record within the date range should be returned.");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public async Task GetAuditLogsAsync_CombinationOfFilters_ReturnsMatchingRecords()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
var now = DateTime.UtcNow;
|
||||||
|
var records = new List<AuditRecord>
|
||||||
|
{
|
||||||
|
new AuditRecord
|
||||||
|
{
|
||||||
|
EntityType = "User",
|
||||||
|
RecordId = "123",
|
||||||
|
UserId = "User123",
|
||||||
|
ActionType = "Create",
|
||||||
|
ActionTime = now.AddDays(-1),
|
||||||
|
Reason = "Testing combinatoin filter",
|
||||||
|
Changes = new List<AuditRecord.Change>()
|
||||||
|
},
|
||||||
|
new AuditRecord
|
||||||
|
{
|
||||||
|
EntityType = "Admin",
|
||||||
|
RecordId = "456",
|
||||||
|
UserId = "User456",
|
||||||
|
ActionType = "Delete",
|
||||||
|
ActionTime = now,
|
||||||
|
Reason = "Testng combination filter",
|
||||||
|
Changes = new List<AuditRecord.Change>()
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
foreach (var record in records)
|
||||||
|
{
|
||||||
|
await _service.AuditLogRepository.InsertOneAsync(record);
|
||||||
|
}
|
||||||
|
|
||||||
|
SpecificAuditLogFilterDto auditLogParametersDto = new SpecificAuditLogFilterDto();
|
||||||
|
auditLogParametersDto.pageNumber=1;
|
||||||
|
auditLogParametersDto.pageSize = 10;
|
||||||
|
auditLogParametersDto.userId="User123";
|
||||||
|
auditLogParametersDto.startDate=now.AddDays(-2);
|
||||||
|
auditLogParametersDto.endDate=now;
|
||||||
|
|
||||||
|
// Act
|
||||||
|
var paginatedResult = await _service.GetAuditLogsBySpecificFilterAsync(auditLogParametersDto);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
// Assert
|
||||||
|
Assert.That(paginatedResult.Records.Count(), Is.EqualTo(1), "Should return only records matching all filters.");
|
||||||
|
var result = paginatedResult.Records.First();
|
||||||
|
Assert.That(result.RecordId, Is.EqualTo("123"), "The record should match all filters.");
|
||||||
|
Assert.That(result.UserId, Is.EqualTo("User123"), "The UserId should match the filter.");
|
||||||
|
|
||||||
|
}
|
||||||
|
[Test]
|
||||||
|
public async Task GetAuditLogsAsync_FilterByEntityType_ReturnsMatchingRecords()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
var records = new List<AuditRecord>
|
||||||
|
{
|
||||||
|
new AuditRecord
|
||||||
|
{
|
||||||
|
EntityType = "User",
|
||||||
|
RecordId = "1",
|
||||||
|
UserId = "User123",
|
||||||
|
ActionType = "Create",
|
||||||
|
ActionTime = DateTime.UtcNow.AddMinutes(-10),
|
||||||
|
Reason = "Testing filter by EntityType",
|
||||||
|
Changes = new List<AuditRecord.Change>()
|
||||||
|
},
|
||||||
|
new AuditRecord
|
||||||
|
{
|
||||||
|
EntityType = "Admin",
|
||||||
|
RecordId = "2",
|
||||||
|
UserId = "User456",
|
||||||
|
ActionType = "Delete",
|
||||||
|
ActionTime = DateTime.UtcNow,
|
||||||
|
Reason = "Testing filter by EntityType",
|
||||||
|
Changes = new List<AuditRecord.Change>()
|
||||||
|
}
|
||||||
|
};
|
||||||
|
SpecificAuditLogFilterDto auditLogParametersDto = new SpecificAuditLogFilterDto();
|
||||||
|
auditLogParametersDto.pageNumber=1;
|
||||||
|
auditLogParametersDto.pageSize = 10;
|
||||||
|
auditLogParametersDto.entityType = "User";
|
||||||
|
|
||||||
|
foreach (var record in records)
|
||||||
|
{
|
||||||
|
await _service.AuditLogRepository.InsertOneAsync(record);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Act
|
||||||
|
var paginatedResult = await _service.GetAuditLogsBySpecificFilterAsync(auditLogParametersDto);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
Assert.That(paginatedResult.Records.Count(), Is.EqualTo(1), "Should return only records matching the EntityType filter.");
|
||||||
|
var result = paginatedResult.Records.First();
|
||||||
|
Assert.That(result.EntityType, Is.EqualTo("User"), "The EntityType should match the filter.");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public async Task GetAuditLogsMatchingTextAsync_WithSearchText_ReturnsMatchingRecords()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
var records = new List<AuditRecord>
|
||||||
|
{
|
||||||
|
new AuditRecord
|
||||||
|
{
|
||||||
|
EntityType = "User",
|
||||||
|
RecordId = "nhc1",
|
||||||
|
UserId = "User123",
|
||||||
|
ActionType = "Create",
|
||||||
|
ActionTime = DateTime.UtcNow,
|
||||||
|
Reason = "Include this record",
|
||||||
|
UserIpAddress = "192.168.1.1"
|
||||||
|
},
|
||||||
|
new AuditRecord
|
||||||
|
{
|
||||||
|
EntityType = "Admin",
|
||||||
|
RecordId = "nhc2",
|
||||||
|
UserId = "User456",
|
||||||
|
ActionType = "Delete",
|
||||||
|
ActionTime = DateTime.UtcNow,
|
||||||
|
Reason = "Do not include this record",
|
||||||
|
UserIpAddress = "192.168.1.2"
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
foreach (var record in records)
|
||||||
|
{
|
||||||
|
await _service.AuditLogRepository.InsertOneAsync(record);
|
||||||
|
}
|
||||||
|
|
||||||
|
AuditLogTextOrDateSearchDTO orDateSearchTextOrDateDto = new AuditLogTextOrDateSearchDTO
|
||||||
|
{
|
||||||
|
pageNumber = 1,
|
||||||
|
pageSize = 10,
|
||||||
|
searchText = "nhc2"
|
||||||
|
};
|
||||||
|
|
||||||
|
// Act
|
||||||
|
var result = await _service.GetAuditLogsMatchingTextOrDateAsync(orDateSearchTextOrDateDto);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
Assert.That(result.Records.Count, Is.EqualTo(1), "Should return only records matching the search text.");
|
||||||
|
Assert.That(result.Records.First().UserId, Is.EqualTo("User456"), "The UserId should match the record with the included search text.");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public async Task GetAuditLogsMatchingTextAsync_WithoutSearchText_ReturnsAllRecords()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
var records = new List<AuditRecord>
|
||||||
|
{
|
||||||
|
new AuditRecord
|
||||||
|
{
|
||||||
|
EntityType = "User",
|
||||||
|
RecordId = "1",
|
||||||
|
UserId = "User123",
|
||||||
|
ActionType = "Create",
|
||||||
|
ActionTime = DateTime.UtcNow,
|
||||||
|
Reason = "First record",
|
||||||
|
UserIpAddress = "192.168.1.1"
|
||||||
|
},
|
||||||
|
new AuditRecord
|
||||||
|
{
|
||||||
|
EntityType = "Admin",
|
||||||
|
RecordId = "2",
|
||||||
|
UserId = "User456",
|
||||||
|
ActionType = "Delete",
|
||||||
|
ActionTime = DateTime.UtcNow,
|
||||||
|
Reason = "Second record",
|
||||||
|
UserIpAddress = "192.168.1.2"
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
foreach (var record in records)
|
||||||
|
{
|
||||||
|
await _service.AuditLogRepository.InsertOneAsync(record);
|
||||||
|
}
|
||||||
|
|
||||||
|
AuditLogTextOrDateSearchDTO orDateSearchTextOrDateDto = new AuditLogTextOrDateSearchDTO
|
||||||
|
{
|
||||||
|
pageNumber = 1,
|
||||||
|
pageSize = 10
|
||||||
|
};
|
||||||
|
|
||||||
|
// Act
|
||||||
|
var result = await _service.GetAuditLogsMatchingTextOrDateAsync(orDateSearchTextOrDateDto);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
Assert.That(result.Records.Count, Is.EqualTo(2), "Should return all records when no search text is provided.");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public async Task GetAuditLogsMatchingTextAsync_WithDateRange_ReturnsMatchingRecords()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
var now = DateTime.UtcNow;
|
||||||
|
var earlier = now.AddDays(-1);
|
||||||
|
var records = new List<AuditRecord>
|
||||||
|
{
|
||||||
|
new AuditRecord
|
||||||
|
{
|
||||||
|
EntityType = "User",
|
||||||
|
RecordId = "123",
|
||||||
|
UserId = "User123",
|
||||||
|
ActionType = "Create",
|
||||||
|
ActionTime = earlier,
|
||||||
|
Reason = "Old record",
|
||||||
|
UserIpAddress = "192.168.1.1"
|
||||||
|
},
|
||||||
|
new AuditRecord
|
||||||
|
{
|
||||||
|
EntityType = "Admin",
|
||||||
|
RecordId = "456",
|
||||||
|
UserId = "User456",
|
||||||
|
ActionType = "Delete",
|
||||||
|
ActionTime = now,
|
||||||
|
Reason = "Recent record",
|
||||||
|
UserIpAddress = "192.168.1.2"
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
foreach (var record in records)
|
||||||
|
{
|
||||||
|
await _service.AuditLogRepository.InsertOneAsync(record);
|
||||||
|
}
|
||||||
|
|
||||||
|
AuditLogTextOrDateSearchDTO searchDto = new AuditLogTextOrDateSearchDTO
|
||||||
|
{
|
||||||
|
pageNumber = 1,
|
||||||
|
pageSize = 10,
|
||||||
|
searchText = "",
|
||||||
|
startDate = earlier,
|
||||||
|
endDate = now
|
||||||
|
};
|
||||||
|
|
||||||
|
// Act
|
||||||
|
var result = await _service.GetAuditLogsMatchingTextOrDateAsync(searchDto);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
|
||||||
|
Assert.That(result.Records.Count(),Is.EqualTo(2),"Should return records within the date range.");
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public async Task GetAuditLogsMatchingTextAsync_WithTextAndDateFilters_ReturnsCorrectlyFilteredRecords()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
var now = DateTime.UtcNow;
|
||||||
|
var earlier = now.AddDays(-2);
|
||||||
|
var records = new List<AuditRecord>
|
||||||
|
{
|
||||||
|
new AuditRecord
|
||||||
|
{
|
||||||
|
EntityType = "User",
|
||||||
|
RecordId = "123",
|
||||||
|
UserId = "User123",
|
||||||
|
ActionType = "Create",
|
||||||
|
ActionTime = now.AddDays(-1),
|
||||||
|
Reason = "Old record",
|
||||||
|
UserIpAddress = "192.168.1.1"
|
||||||
|
},
|
||||||
|
new AuditRecord
|
||||||
|
{
|
||||||
|
EntityType = "Admin",
|
||||||
|
RecordId = "456",
|
||||||
|
UserId = "User456",
|
||||||
|
ActionType = "Delete",
|
||||||
|
ActionTime = now,
|
||||||
|
Reason = "Recent record",
|
||||||
|
UserIpAddress = "192.168.1.2"
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
foreach (var record in records)
|
||||||
|
{
|
||||||
|
await _service.AuditLogRepository.InsertOneAsync(record);
|
||||||
|
}
|
||||||
|
|
||||||
|
AuditLogTextOrDateSearchDTO searchDto = new AuditLogTextOrDateSearchDTO
|
||||||
|
{
|
||||||
|
pageNumber = 1,
|
||||||
|
pageSize = 10,
|
||||||
|
searchText = "123",
|
||||||
|
startDate = earlier,
|
||||||
|
endDate = now//now.AddDays(-0.5) // This will exclude the recent record
|
||||||
|
};
|
||||||
|
|
||||||
|
// Act
|
||||||
|
var result = await _service.GetAuditLogsMatchingTextOrDateAsync(searchDto);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
Assert.That(result.Records.Count, Is.EqualTo(1), "Should return only records matching both text and date range filters.");
|
||||||
|
Assert.That(result.Records.First().Reason, Is.EqualTo("Old record"), "The Reason should match the filter.");
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public async Task GetAuditLogsMatchingTextAsync_NoMatchingCriteria_ReturnsNoRecords()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
var now = DateTime.UtcNow;
|
||||||
|
var records = new List<AuditRecord>
|
||||||
|
{
|
||||||
|
new AuditRecord
|
||||||
|
{
|
||||||
|
EntityType = "User",
|
||||||
|
RecordId = "123",
|
||||||
|
UserId = "User123",
|
||||||
|
ActionType = "Create",
|
||||||
|
ActionTime = now.AddDays(-2),
|
||||||
|
Reason = "Old record",
|
||||||
|
UserIpAddress = "192.168.1.1"
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
foreach (var record in records)
|
||||||
|
{
|
||||||
|
await _service.AuditLogRepository.InsertOneAsync(record);
|
||||||
|
}
|
||||||
|
|
||||||
|
AuditLogTextOrDateSearchDTO searchDto = new AuditLogTextOrDateSearchDTO
|
||||||
|
{
|
||||||
|
pageNumber = 1,
|
||||||
|
pageSize = 10,
|
||||||
|
searchText = "No match",
|
||||||
|
startDate = DateTime.UtcNow.AddDays(-5),
|
||||||
|
endDate = DateTime.UtcNow.AddDays(-3)
|
||||||
|
};
|
||||||
|
|
||||||
|
// Act
|
||||||
|
var result = await _service.GetAuditLogsMatchingTextOrDateAsync(searchDto);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
Assert.That(result.Records.Count(),Is.EqualTo(0));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,77 @@
|
|||||||
|
namespace audit_test.Repository;
|
||||||
|
|
||||||
|
using audit_logs.Models.DTO;
|
||||||
|
using audit.Model;
|
||||||
|
using audit_logs.Services;
|
||||||
|
using NUnit.Framework;
|
||||||
|
using System;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
[TestFixture]
|
||||||
|
[Category("Integration")]
|
||||||
|
public class AuditServiceFilterbyTextAndDateTests
|
||||||
|
{
|
||||||
|
private AuditService _service;
|
||||||
|
|
||||||
|
[SetUp]
|
||||||
|
public void Setup()
|
||||||
|
{
|
||||||
|
// Crear la instancia del servicio utilizando la base de datos real
|
||||||
|
_service = new AuditService(IntegrationDbReal.Database);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public async Task VerifyAllRecordsLoaded_ReturnsCorrectCount()
|
||||||
|
{
|
||||||
|
// Act
|
||||||
|
var allRecords = await _service.AuditLogRepository.GetAllAuditRecordsAsync();
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
Assert.That(allRecords.Count(), Is.EqualTo(5), "All records from the JSON file should be loaded.");
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public async Task GetAuditLogsAsync_FilterByDateRange_ReturnsCorrectRecords()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
var startDate = DateTime.ParseExact("2024-11-21T23:29:40.267Z", "yyyy-MM-ddTHH:mm:ss.fffZ", System.Globalization.CultureInfo.InvariantCulture).ToUniversalTime();
|
||||||
|
var endDate = DateTime.ParseExact("2024-11-22T08:48:51.194Z", "yyyy-MM-ddTHH:mm:ss.fffZ", System.Globalization.CultureInfo.InvariantCulture).ToUniversalTime();
|
||||||
|
|
||||||
|
var auditLogParametersDto = new AuditLogTextOrDateSearchDTO
|
||||||
|
{
|
||||||
|
pageNumber = 1,
|
||||||
|
pageSize = 10,
|
||||||
|
startDate = startDate,
|
||||||
|
endDate = endDate
|
||||||
|
};
|
||||||
|
|
||||||
|
// Act
|
||||||
|
var paginatedResult = await _service.GetAuditLogsMatchingTextOrDateAsync(auditLogParametersDto);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
Assert.That(paginatedResult.Records.Count, Is.EqualTo(3), "Should return only records within the specified date range.");
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public async Task GetAuditLogsAsync_FilterByTextAndDateRange_ReturnsCorrectRecords()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
var startDate = DateTime.Parse("2024-11-21T23:29:40.267Z");
|
||||||
|
var endDate = DateTime.Parse("2024-11-22T08:48:51.194Z");
|
||||||
|
var auditLogParametersDto = new AuditLogTextOrDateSearchDTO
|
||||||
|
{
|
||||||
|
pageNumber = 1,
|
||||||
|
pageSize = 10,
|
||||||
|
startDate = startDate,
|
||||||
|
endDate = endDate,
|
||||||
|
searchText = "673fc258d26d3f5086c49598"
|
||||||
|
};
|
||||||
|
|
||||||
|
// Act
|
||||||
|
var paginatedResult = await _service.GetAuditLogsMatchingTextOrDateAsync(auditLogParametersDto);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
Assert.That(paginatedResult.Records.Count, Is.EqualTo(1), "Should return only records matching the text and date range.");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,8 @@
|
|||||||
|
using System.Security.Claims;
|
||||||
using audit_logs.Models;
|
using audit_logs.Models;
|
||||||
|
using audit_logs.Models.DTO;
|
||||||
using audit_logs.Utils;
|
using audit_logs.Utils;
|
||||||
|
using MongoDB.Bson;
|
||||||
|
|
||||||
namespace audit_test.Repository;
|
namespace audit_test.Repository;
|
||||||
|
|
||||||
@@ -10,7 +13,7 @@ using audit_logs.Services;
|
|||||||
public class AuditServiceIntegrationTests
|
public class AuditServiceIntegrationTests
|
||||||
{
|
{
|
||||||
private AuditService _service;
|
private AuditService _service;
|
||||||
// private AuditRecordRepository _repository;
|
// private AuditRecordRepository _repository;
|
||||||
|
|
||||||
[Order(1)]
|
[Order(1)]
|
||||||
[SetUp]
|
[SetUp]
|
||||||
@@ -78,11 +81,11 @@ public class AuditServiceIntegrationTests
|
|||||||
|
|
||||||
foreach (var rec in records)
|
foreach (var rec in records)
|
||||||
{
|
{
|
||||||
await _service.AuditLogRepository.InsertOneAsync(rec);
|
await _service.AuditLogRepository.InsertOneAsync(rec);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test retrieval method
|
// Test retrieval method
|
||||||
var allRecords = await _service.AuditLogRepository.GetAllAuditRecordsAsync();
|
var allRecords = await _service.AuditLogRepository.GetAllAuditRecordsAsync();
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
Assert.AreEqual(2, allRecords.Count, "All records should be retrieved.");
|
Assert.AreEqual(2, allRecords.Count, "All records should be retrieved.");
|
||||||
@@ -91,15 +94,21 @@ public class AuditServiceIntegrationTests
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public async Task DetectChangesAsync_DetectsAndRecordsChanges()
|
public async Task DetectChangesAsync_DetectsAndRecordsChanges() //este es el que da problemas
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
|
// Arrange
|
||||||
|
var user = new ClaimsPrincipal(new ClaimsIdentity(new[]
|
||||||
|
{
|
||||||
|
new Claim(ClaimTypes.Name, "testUser"),
|
||||||
|
new Claim("IpAddress", "127.0.0.1")
|
||||||
|
}));
|
||||||
|
|
||||||
// Variables de auditoría
|
// Variables de auditoría
|
||||||
AuditLogData auditLogData = new();
|
AuditLogData auditLogData = new();
|
||||||
auditLogData.OriginalJson = "{ \"Username\": \"oldUser\", \"Email\": \"old@example.com\", \"address\": 15 }";
|
auditLogData.OriginalJson = "{\"nhc\":\"C469\",\"person\":{\"admTime\":\"2024-11-26T12:03:36.276Z\",\"birthDate\":\"2024-11-02\",\"firstName\":\"Carlos Vi\",\"secondName\":\"Rey\",\"gender\":\"Male\",\"allergies\":\"\",\"ids\":{\"MR\":\"C469\"},\"historicalIds\":{}},\"unitId\":\"662760a96bdc7150b49fe29d\",\"admissionDate\":\"2024-11-26T12:03:36.276Z\",\"allergies\":\"\",\"diagnosis\":{\"optionType\":null,\"name\":\"Absceso amebiano del cerebro\",\"iconDefault\":null,\"iconLight\":null,\"iconDark\":null,\"color\":null,\"bgColor\":null,\"description\":\"A06.6\",\"initDate\":null,\"endDate\":null},\"origin\":{\"optionType\":null,\"name\":\"3A ucip\",\"iconDefault\":null,\"iconLight\":null,\"iconDark\":null,\"color\":null,\"bgColor\":null,\"description\":null,\"initDate\":null,\"endDate\":null},\"pointOfCareId\":null,\"languageBarrier\":\"\",\"originAux\":\"\",\"diagnosisAux\":\"Absceso amebiano del cerebro\"}";
|
||||||
auditLogData.ModifiedJson =
|
// auditLogData.ModifiedJson = "{\"nhc\":\"H987541\",\"patientLocation\":{\"unitName\":\"SMACST\",\"bed\":\"SMT 2\",\"room\":\"SMT 2\"},\"person\":{\"admTime\":\"2024-11-26T10:31:37.018Z\",\"birthDate\":\"2024-11-01\",\"firstName\":\"Carlos\",\"secondName\":\"Borja\",\"gender\":\"Male\",\"allergies\":[{\"optionType\":null,\"name\":\"Sí\",\"iconDefault\":\"icCheck\",\"iconLight\":null,\"iconDark\":null,\"color\":null,\"bgColor\":null,\"description\":null,\"initDate\":null,\"endDate\":null}],\"ids\":{\"MR\":\"H987541\"},\"historicalIds\":{}},\"unitId\":\"662760a96bdc7150b49fe29d\",\"admissionDate\":\"2024-11-26T10:31:37.018Z\",\"allergies\":[{\"optionType\":null,\"name\":\"Sí\",\"iconDefault\":\"icCheck\",\"iconLight\":null,\"iconDark\":null,\"color\":null,\"bgColor\":null,\"description\":null,\"initDate\":null,\"endDate\":null}],\"diagnosis\":{\"optionType\":null,\"name\":\"Absceso amebiano del cerebro\",\"iconDefault\":null,\"iconLight\":null,\"iconDark\":null,\"color\":null,\"bgColor\":null,\"description\":\"A06.6\",\"initDate\":null,\"endDate\":null},\"origin\":{\"optionType\":null,\"name\":\"3A ucip\",\"iconDefault\":null,\"iconLight\":null,\"iconDark\":null,\"color\":null,\"bgColor\":null,\"description\":null,\"initDate\":null,\"endDate\":null},\"pointOfCareId\":\"662761fc6bdc7150b49fe29f\",\"languageBarrier\":\"\",\"originAux\":\"\",\"diagnosisAux\":\"Absceso amebiano del cerebro\"}";
|
||||||
"{ \"Username\": \"newUser\", \"Email\": \"old@example.com\", \"PhoneNumber\": \"123456789\" }";
|
auditLogData.ModifiedJson = null;//"{\"nhc\":\"C469\",\"person\":{\"admTime\":\"2024-11-26T12:03:36.276Z\",\"birthDate\":\"2024-11-01\",\"firstName\":\"Carlos V\",\"secondName\":\"Rey\",\"gender\":\"Male\",\"allergies\":\"\",\"ids\":{\"MR\":\"C469\"},\"historicalIds\":{}},\"unitId\":\"662760a96bdc7150b49fe29d\",\"admissionDate\":\"2024-11-26T12:03:36.276Z\",\"allergies\":\"\",\"diagnosis\":{\"optionType\":null,\"name\":\"Absceso amebiano del cerebro\",\"iconDefault\":null,\"iconLight\":null,\"iconDark\":null,\"color\":null,\"bgColor\":null,\"description\":\"A06.6\",\"initDate\":null,\"endDate\":null},\"origin\":{\"optionType\":null,\"name\":\"3A ucip\",\"iconDefault\":null,\"iconLight\":null,\"iconDark\":null,\"color\":null,\"bgColor\":null,\"description\":null,\"initDate\":null,\"endDate\":null},\"pointOfCareId\":null,\"languageBarrier\":\"\",\"originAux\":\"\",\"diagnosisAux\":\"Absceso amebiano del cerebro\"}";
|
||||||
auditLogData.EntityType = "User";
|
auditLogData.EntityType = "User";
|
||||||
auditLogData.RecordId = "1";
|
auditLogData.RecordId = "1";
|
||||||
auditLogData.UserId = "123";
|
auditLogData.UserId = "123";
|
||||||
@@ -111,12 +120,9 @@ public class AuditServiceIntegrationTests
|
|||||||
// Act - Llamar a DetectChangesAsync para que identifique cambios
|
// Act - Llamar a DetectChangesAsync para que identifique cambios
|
||||||
await _service.CreateAuditLogAsync(auditLogData);
|
await _service.CreateAuditLogAsync(auditLogData);
|
||||||
|
|
||||||
// Act - Registrar la auditoría usando los cambios detectados
|
|
||||||
// List<AuditRecord.Change> changes = new JsonComparer().GetDifferences(originalJson, modifiedJson);
|
|
||||||
//await _service.RecordAuditAsync(entityType, recordId, userId, actionType, reason,actionTime, changes, );
|
|
||||||
|
|
||||||
// Retrieve all records to validate insertion
|
// Retrieve all records to validate insertion
|
||||||
var allRecords = await _service.AuditLogRepository.GetAllAuditRecordsAsync();
|
var allRecords = await _service.AuditLogRepository.GetAllAuditRecordsAsync();
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
Assert.AreEqual(1, allRecords.Count, "Debe haber exactamente un registro de auditoría en la base de datos.");
|
Assert.AreEqual(1, allRecords.Count, "Debe haber exactamente un registro de auditoría en la base de datos.");
|
||||||
@@ -128,80 +134,237 @@ public class AuditServiceIntegrationTests
|
|||||||
Assert.AreEqual(auditLogData.Reason, storedRecord.Reason);
|
Assert.AreEqual(auditLogData.Reason, storedRecord.Reason);
|
||||||
|
|
||||||
// Verificar que los cambios detectados sean correctos
|
// Verificar que los cambios detectados sean correctos
|
||||||
Assert.That(storedRecord.Changes.Count, Is.EqualTo(3), "Debería detectar tres cambios.");
|
Assert.That(storedRecord.Changes.Count, Is.EqualTo(10), "Debería detectar tres cambios.");
|
||||||
|
|
||||||
|
|
||||||
var changeUsername = storedRecord.Changes.Find(c => c.Field == "Username");
|
|
||||||
Assert.NotNull(changeUsername, "Debe existir un cambio en el campo 'Username'.");
|
|
||||||
Assert.AreEqual("oldUser", changeUsername.OldValue.AsString);
|
|
||||||
Assert.AreEqual("newUser", changeUsername.NewValue.AsString);
|
|
||||||
Assert.AreEqual("string", changeUsername.ValueType);
|
|
||||||
|
|
||||||
var changePhoneNumber = storedRecord.Changes.Find(c => c.Field == "PhoneNumber");
|
|
||||||
Assert.NotNull(changePhoneNumber, "Debe existir un cambio en el campo 'PhoneNumber'.");
|
|
||||||
Assert.IsTrue(changePhoneNumber.OldValue.IsBsonNull, "El valor anterior de 'PhoneNumber' debe ser nulo.");
|
|
||||||
Assert.AreEqual("123456789", changePhoneNumber.NewValue.AsString);
|
|
||||||
Assert.AreEqual("string", changePhoneNumber.ValueType);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public async Task GetAuditLogsAsync_ReturnsPaginatedRecords()
|
public async Task GetAuditLogsAsync_ReturnsPaginatedRecords()
|
||||||
{
|
|
||||||
// Arrange - Insert multiple audit records to test pagination
|
|
||||||
var records = new List<AuditRecord>();
|
|
||||||
for (int i = 1; i <= 20; i++)
|
|
||||||
{
|
{
|
||||||
records.Add(new AuditRecord
|
// Arrange - Insert multiple audit records to test pagination
|
||||||
|
var records = new List<AuditRecord>();
|
||||||
|
for (int i = 1; i <= 20; i++)
|
||||||
{
|
{
|
||||||
EntityType = "TestEntity",
|
records.Add(new AuditRecord
|
||||||
RecordId = i.ToString(),
|
|
||||||
UserId = "User" + i,
|
|
||||||
ActionType = "Create",
|
|
||||||
ActionTime = DateTime.UtcNow,
|
|
||||||
Reason = "Test Reason " + i,
|
|
||||||
Changes = new List<AuditRecord.Change>
|
|
||||||
{
|
{
|
||||||
new AuditRecord.Change
|
EntityType = "TestEntity",
|
||||||
|
RecordId = i.ToString(),
|
||||||
|
UserId = "User" + i,
|
||||||
|
ActionType = "Create",
|
||||||
|
ActionTime = DateTime.UtcNow,
|
||||||
|
Reason = "Test Reason " + i,
|
||||||
|
Changes = new List<AuditRecord.Change>
|
||||||
{
|
{
|
||||||
Field = "Field" + i,
|
new AuditRecord.Change
|
||||||
OldValue = "OldValue" + i,
|
{
|
||||||
NewValue = "NewValue" + i,
|
Field = "Field" + i,
|
||||||
ValueType = "String"
|
OldValue = "OldValue" + i,
|
||||||
|
NewValue = "NewValue" + i,
|
||||||
|
ValueType = "String"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
});
|
}
|
||||||
|
|
||||||
|
foreach (var record in records)
|
||||||
|
{
|
||||||
|
await _service.AuditLogRepository.InsertOneAsync(record);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Act - Retrieve the first page with a page size of 5
|
||||||
|
int pageNumber = 1;
|
||||||
|
int pageSize = 5;
|
||||||
|
SpecificAuditLogFilterDto auditLogParametersDto = new SpecificAuditLogFilterDto();
|
||||||
|
auditLogParametersDto.pageNumber=1;
|
||||||
|
auditLogParametersDto.pageSize = 5;
|
||||||
|
var paginatedResult = await _service.GetAuditLogsBySpecificFilterAsync(auditLogParametersDto);
|
||||||
|
|
||||||
|
// Assert - Check that the pagination returns the correct number of records and page information
|
||||||
|
Assert.AreEqual(pageSize, paginatedResult.Records.Count(), "The number of records should match the page size.");
|
||||||
|
Assert.AreEqual(20, paginatedResult.TotalRecords,"The total number of records should match the inserted records.");
|
||||||
|
Assert.AreEqual(4, paginatedResult.TotalPages, "The total pages should be calculated correctly.");
|
||||||
|
Assert.AreEqual(pageNumber, paginatedResult.CurrentPage, "The current page should be correct.");
|
||||||
|
|
||||||
|
// Further assertions to check that the records and changes are the expected ones
|
||||||
|
var firstRecord = paginatedResult.Records.First();
|
||||||
|
Assert.AreEqual("TestEntity", firstRecord.EntityType);
|
||||||
|
Assert.AreEqual("1", firstRecord.RecordId);
|
||||||
|
Assert.AreEqual("User1", firstRecord.UserId);
|
||||||
|
Assert.AreEqual("Create", firstRecord.ActionType);
|
||||||
|
|
||||||
|
// Verify the changes for the first record
|
||||||
|
Assert.IsNotNull(firstRecord.Changes);
|
||||||
|
Assert.AreEqual(1, firstRecord.Changes.Count, "There should be exactly one change in the first record.");
|
||||||
|
var firstChange = firstRecord.Changes.First();
|
||||||
|
Assert.AreEqual("Field1", firstChange.Field);
|
||||||
|
Assert.AreEqual("OldValue1", firstChange.OldValue);
|
||||||
|
Assert.AreEqual("NewValue1", firstChange.NewValue);
|
||||||
|
Assert.AreEqual("String", firstChange.ValueType);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var record in records)
|
[Test]
|
||||||
|
public async Task CreateAuditLogAsync_CreatesCorrectAuditLog()
|
||||||
{
|
{
|
||||||
await _service.AuditLogRepository.InsertOneAsync(record);
|
// Arrange
|
||||||
|
var user = new ClaimsPrincipal(new ClaimsIdentity(new[]
|
||||||
|
{
|
||||||
|
new Claim(ClaimTypes.Name, "testUser"),
|
||||||
|
new Claim("IpAddress", "127.0.0.1")
|
||||||
|
}));
|
||||||
|
|
||||||
|
var dataOriginal = new
|
||||||
|
{
|
||||||
|
Id = ObjectId.GenerateNewId(),
|
||||||
|
Name = "OldName",
|
||||||
|
Email = "old@example.com"
|
||||||
|
};
|
||||||
|
|
||||||
|
var dataModified = new
|
||||||
|
{
|
||||||
|
Id = dataOriginal.Id,
|
||||||
|
Name = "NewName",
|
||||||
|
Email = "new@example.com"
|
||||||
|
};
|
||||||
|
|
||||||
|
string reason = "Updating user details";
|
||||||
|
|
||||||
|
// Act
|
||||||
|
await _service.CreateAuditLogAsync(user, dataOriginal, dataModified, reason);
|
||||||
|
|
||||||
|
// Assert - Retrieve audit logs to validate
|
||||||
|
var allRecords = await _service.AuditLogRepository.GetAllAuditRecordsAsync();
|
||||||
|
|
||||||
|
Assert.AreEqual(1, allRecords.Count, "There should be exactly one audit log entry.");
|
||||||
|
var storedRecord = allRecords[0];
|
||||||
|
|
||||||
|
// Validate stored record
|
||||||
|
Assert.AreEqual("AnonymousType", storedRecord.EntityType);
|
||||||
|
Assert.AreEqual(dataOriginal.Id.ToString(), storedRecord.RecordId);
|
||||||
|
Assert.AreEqual("testUser", storedRecord.UserId);
|
||||||
|
Assert.AreEqual("update", storedRecord.ActionType);
|
||||||
|
Assert.AreEqual(reason, storedRecord.Reason);
|
||||||
|
Assert.AreEqual("127.0.0.1", storedRecord.UserIpAddress);
|
||||||
|
|
||||||
|
// Validate changes
|
||||||
|
Assert.AreEqual(2, storedRecord.Changes.Count, "There should be exactly two detected changes.");
|
||||||
|
var nameChange = storedRecord.Changes.Find(c => c.Field == "Name");
|
||||||
|
Assert.NotNull(nameChange, "There should be a change in the 'Name' field.");
|
||||||
|
Assert.AreEqual("OldName", nameChange.OldValue.AsString);
|
||||||
|
Assert.AreEqual("NewName", nameChange.NewValue.AsString);
|
||||||
|
Assert.AreEqual("string", nameChange.ValueType);
|
||||||
|
|
||||||
|
var emailChange = storedRecord.Changes.Find(c => c.Field == "Email");
|
||||||
|
Assert.NotNull(emailChange, "There should be a change in the 'Email' field.");
|
||||||
|
Assert.AreEqual("old@example.com", emailChange.OldValue.AsString);
|
||||||
|
Assert.AreEqual("new@example.com", emailChange.NewValue.AsString);
|
||||||
|
Assert.AreEqual("string", emailChange.ValueType);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Act - Retrieve the first page with a page size of 5
|
[Test]
|
||||||
int pageNumber = 1;
|
public async Task CreateAuditLogAsync_WithNullIpAndDataOriginal_CreatesCorrectAuditLog()
|
||||||
int pageSize = 5;
|
{
|
||||||
var paginatedResult = await _service.GetAuditLogsAsync(pageNumber, pageSize);
|
// Arrange
|
||||||
|
var user = new ClaimsPrincipal(new ClaimsIdentity(new[]
|
||||||
|
{
|
||||||
|
new Claim(ClaimTypes.Name, "testUser"),
|
||||||
|
// IP Address claim is not included to simulate a null IP scenario
|
||||||
|
}));
|
||||||
|
|
||||||
// Assert - Check that the pagination returns the correct number of records and page information
|
// Set dataOriginal to null to simulate scenario
|
||||||
Assert.AreEqual(pageSize, paginatedResult.Records.Count(), "The number of records should match the page size.");
|
object dataOriginal = null;
|
||||||
Assert.AreEqual(20, paginatedResult.TotalRecords, "The total number of records should match the inserted records.");
|
|
||||||
Assert.AreEqual(4, paginatedResult.TotalPages, "The total pages should be calculated correctly.");
|
|
||||||
Assert.AreEqual(pageNumber, paginatedResult.CurrentPage, "The current page should be correct.");
|
|
||||||
|
|
||||||
// Further assertions to check that the records and changes are the expected ones
|
var dataModified = new
|
||||||
var firstRecord = paginatedResult.Records.First();
|
{
|
||||||
Assert.AreEqual("TestEntity", firstRecord.EntityType);
|
Id = ObjectId.GenerateNewId(),
|
||||||
Assert.AreEqual("1", firstRecord.RecordId);
|
Name = "NewName",
|
||||||
Assert.AreEqual("User1", firstRecord.UserId);
|
Email = "new@example.com"
|
||||||
Assert.AreEqual("Create", firstRecord.ActionType);
|
};
|
||||||
|
|
||||||
// Verify the changes for the first record
|
|
||||||
Assert.IsNotNull(firstRecord.Changes);
|
|
||||||
Assert.AreEqual(1, firstRecord.Changes.Count, "There should be exactly one change in the first record.");
|
|
||||||
var firstChange = firstRecord.Changes.First();
|
|
||||||
Assert.AreEqual("Field1", firstChange.Field);
|
|
||||||
Assert.AreEqual("OldValue1", firstChange.OldValue.AsString);
|
|
||||||
Assert.AreEqual("NewValue1", firstChange.NewValue.AsString);
|
|
||||||
Assert.AreEqual("String", firstChange.ValueType);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
string reason = "Creating new user";
|
||||||
|
|
||||||
|
// Act
|
||||||
|
await _service.CreateAuditLogAsync(user, dataOriginal, dataModified, reason);
|
||||||
|
|
||||||
|
// Assert - Retrieve audit logs to validate
|
||||||
|
var allRecords = await _service.AuditLogRepository.GetAllAuditRecordsAsync();
|
||||||
|
|
||||||
|
Assert.AreEqual(1, allRecords.Count, "There should be exactly one audit log entry.");
|
||||||
|
var storedRecord = allRecords[0];
|
||||||
|
|
||||||
|
// Validate stored record
|
||||||
|
Assert.AreEqual("AnonymousType", storedRecord.EntityType);
|
||||||
|
Assert.AreEqual(dataModified.Id.ToString(), storedRecord.RecordId);
|
||||||
|
Assert.AreEqual("testUser", storedRecord.UserId);
|
||||||
|
Assert.AreEqual("create", storedRecord.ActionType); // Action type should be 'create' as original data is null
|
||||||
|
Assert.AreEqual(reason, storedRecord.Reason);
|
||||||
|
|
||||||
|
// Validate changes - expecting changes in name and email as it's a creation
|
||||||
|
Assert.AreEqual(3, storedRecord.Changes.Count, "There should be exactly two detected changes.");
|
||||||
|
var nameChange = storedRecord.Changes.Find(c => c.Field == "Name");
|
||||||
|
Assert.NotNull(nameChange, "There should be a change in the 'Name' field.");
|
||||||
|
Assert.IsTrue(nameChange.OldValue.IsBsonNull, "Old value should be null for new creations.");
|
||||||
|
|
||||||
|
Assert.AreEqual("NewName", nameChange.NewValue.AsString);
|
||||||
|
Assert.AreEqual("string", nameChange.ValueType);
|
||||||
|
|
||||||
|
var emailChange = storedRecord.Changes.Find(c => c.Field == "Email");
|
||||||
|
Assert.NotNull(emailChange, "There should be a change in the 'Email' field.");
|
||||||
|
Assert.IsTrue(emailChange.OldValue.IsBsonNull, "Old value should be null for new creations.");
|
||||||
|
Assert.AreEqual("new@example.com", emailChange.NewValue.AsString);
|
||||||
|
Assert.AreEqual("string", emailChange.ValueType);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public async Task CreateAuditLogAsync_WithNullIpAndDataModified_CreatesCorrectAuditLog()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
var user = new ClaimsPrincipal(new ClaimsIdentity(new[]
|
||||||
|
{
|
||||||
|
new Claim(ClaimTypes.Name, "testUser"),
|
||||||
|
// IP Address claim is not included to simulate a null IP scenario
|
||||||
|
}));
|
||||||
|
|
||||||
|
// Set dataModified to null to simulate the scenario
|
||||||
|
object? dataModified = null;
|
||||||
|
|
||||||
|
var dataOriginal = new
|
||||||
|
{
|
||||||
|
Id = ObjectId.GenerateNewId(),
|
||||||
|
Name = "OldName",
|
||||||
|
Email = "old@example.com"
|
||||||
|
};
|
||||||
|
|
||||||
|
string reason = "Deleting user";
|
||||||
|
|
||||||
|
// Act
|
||||||
|
await _service.CreateAuditLogAsync(user, dataOriginal, dataModified, reason);
|
||||||
|
|
||||||
|
// Assert - Retrieve audit logs to validate
|
||||||
|
var allRecords = await _service.AuditLogRepository.GetAllAuditRecordsAsync();
|
||||||
|
|
||||||
|
Assert.AreEqual(1, allRecords.Count, "There should be exactly one audit log entry.");
|
||||||
|
var storedRecord = allRecords[0];
|
||||||
|
|
||||||
|
// Validate stored record
|
||||||
|
Assert.AreEqual("AnonymousType", storedRecord.EntityType);
|
||||||
|
Assert.AreEqual(dataOriginal.Id.ToString(), storedRecord.RecordId);
|
||||||
|
Assert.AreEqual("testUser", storedRecord.UserId);
|
||||||
|
Assert.AreEqual("delete", storedRecord.ActionType); // Action type should be 'delete' as modified data is null
|
||||||
|
Assert.AreEqual(reason, storedRecord.Reason);
|
||||||
|
|
||||||
|
// Validate changes - expecting no changes as it's a deletion
|
||||||
|
Assert.AreEqual(3, storedRecord.Changes.Count, "There should be exactly two detected changes.");
|
||||||
|
var nameChange = storedRecord.Changes.Find(c => c.Field == "Name");
|
||||||
|
Assert.NotNull(nameChange, "There should be a change in the 'Name' field.");
|
||||||
|
Assert.AreEqual("OldName", nameChange.OldValue.AsString, "Old value should be 'OldName'.");
|
||||||
|
Assert.IsTrue(nameChange.NewValue.IsBsonNull, "New value should be null for deletions.");
|
||||||
|
Assert.AreEqual("string", nameChange.ValueType);
|
||||||
|
|
||||||
|
var emailChange = storedRecord.Changes.Find(c => c.Field == "Email");
|
||||||
|
Assert.NotNull(emailChange, "There should be a change in the 'Email' field.");
|
||||||
|
Assert.AreEqual("old@example.com", emailChange.OldValue.AsString, "Old value should be 'old@example.com'.");
|
||||||
|
Assert.IsTrue(emailChange.NewValue.IsBsonNull, "New value should be null for deletions.");
|
||||||
|
Assert.AreEqual("string", emailChange.ValueType);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
namespace audit_test.Repository;
|
||||||
|
|
||||||
|
using MongoDB.Bson;
|
||||||
|
using MongoDB.Driver;
|
||||||
|
using NUnit.Framework;
|
||||||
|
|
||||||
|
[SetUpFixture]
|
||||||
|
[Category("Integration")]
|
||||||
|
public class IntegrationDbReal
|
||||||
|
{
|
||||||
|
public static IMongoClient Client { get; private set; } = null!;
|
||||||
|
public static IMongoDatabase Database { get; private set; } = null!;
|
||||||
|
|
||||||
|
private const string ConnectionString = "mongodb://smacsuci:2(R*aQpu2r@julianrojas.xyz:27017/?authSource=admin";
|
||||||
|
private const string DatabaseName = "AuditMeddisPlanUciPanel";
|
||||||
|
|
||||||
|
[OneTimeSetUp]
|
||||||
|
public void InitIntegrationTests()
|
||||||
|
{
|
||||||
|
// Configurar cliente y base de datos
|
||||||
|
Client = new MongoClient(ConnectionString);
|
||||||
|
Database = Client.GetDatabase(DatabaseName);
|
||||||
|
}
|
||||||
|
|
||||||
|
[OneTimeTearDown]
|
||||||
|
public void TeardownIntegrationTests()
|
||||||
|
{
|
||||||
|
Client = null;
|
||||||
|
Database = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -12,6 +12,7 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="coverlet.collector" Version="6.0.0"/>
|
<PackageReference Include="coverlet.collector" Version="6.0.0"/>
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0"/>
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0"/>
|
||||||
<PackageReference Include="Mongo2Go" Version="2.2.16" />
|
<PackageReference Include="Mongo2Go" Version="2.2.16" />
|
||||||
<PackageReference Include="Moq" Version="4.20.72" />
|
<PackageReference Include="Moq" Version="4.20.72" />
|
||||||
|
|||||||
BIN
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user