diff --git a/dotnetcore.csproj b/dotnetcore.csproj
deleted file mode 100644
index 120e38c..0000000
--- a/dotnetcore.csproj
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
- Exe
- net7.0
-
-
-
diff --git a/src/Agent/Insight.Agent/Constants/Appsettings.cs b/src/Agent/Insight.Agent/Constants/Appsettings.cs
index 9a45fe7..074d6b8 100644
--- a/src/Agent/Insight.Agent/Constants/Appsettings.cs
+++ b/src/Agent/Insight.Agent/Constants/Appsettings.cs
@@ -1,10 +1,9 @@
-namespace Insight.Agent
+namespace Insight.Agent;
+
+public static class Appsettings
{
- public static class Appsettings
- {
- public const string Api = "api";
- public const string ServerHost = "server.host";
- public const string ServerPort = "server.port";
- public const string TrapPort = "trap.port";
- }
+ public const string Api = "api";
+ public const string ServerHost = "server.host";
+ public const string ServerPort = "server.port";
+ public const string TrapPort = "trap.port";
}
\ No newline at end of file
diff --git a/src/Agent/Insight.Agent/Constants/Deploy.cs b/src/Agent/Insight.Agent/Constants/Deploy.cs
index 35aa19b..ded093c 100644
--- a/src/Agent/Insight.Agent/Constants/Deploy.cs
+++ b/src/Agent/Insight.Agent/Constants/Deploy.cs
@@ -1,21 +1,20 @@
-namespace Insight.Agent.Constants
+namespace Insight.Agent.Constants;
+
+public static class Deploy
{
- public static class Deploy
+ public static class Updater
{
- public static class Updater
- {
- public const string Name = "Updater";
- public const string ServiceName = "insight_updater";
- public const string Description = "Insight Updater";
- }
-
- public static DirectoryInfo GetAppDirectory(string appName)
- => new($"{Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData)}/Webmatic/Insight/{appName}");
-
- public static FileInfo GetAppExecutable(string appName)
- => new($"{GetAppDirectory(appName).FullName}/{appName.ToLower()}.exe");
-
- public static Uri GetUpdateHref(Uri api, string appName)
- => new($"{api.AbsoluteUri}/update/{appName.ToLower()}/windows");
+ public const string Name = "Updater";
+ public const string ServiceName = "insight_updater";
+ public const string Description = "Insight Updater";
}
+
+ public static DirectoryInfo GetAppDirectory(string appName)
+ => new($"{Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData)}/Webmatic/Insight/{appName}");
+
+ public static FileInfo GetAppExecutable(string appName)
+ => new($"{GetAppDirectory(appName).FullName}/{appName.ToLower()}.exe");
+
+ public static Uri GetUpdateHref(Uri api, string appName)
+ => new($"{api.AbsoluteUri}/update/{appName.ToLower()}/windows");
}
\ No newline at end of file
diff --git a/src/Agent/Insight.Agent/Extensions/Configuration.cs b/src/Agent/Insight.Agent/Extensions/Configuration.cs
index c5df5da..8646d47 100644
--- a/src/Agent/Insight.Agent/Extensions/Configuration.cs
+++ b/src/Agent/Insight.Agent/Extensions/Configuration.cs
@@ -1,14 +1,13 @@
using Microsoft.Extensions.Configuration;
-namespace Insight.Agent.Extensions
+namespace Insight.Agent.Extensions;
+
+public static class ConfigurationExtensions
{
- public static class ConfigurationExtensions
+ public static IConfigurationBuilder Defaults(this IConfigurationBuilder configuration)
{
- public static IConfigurationBuilder Defaults(this IConfigurationBuilder configuration)
- {
- configuration.Sources.Clear();
- configuration.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true);
- return configuration.AddJsonFile($"appsettings.{Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT")}.json", optional: true, reloadOnChange: true);
- }
+ configuration.Sources.Clear();
+ configuration.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true);
+ return configuration.AddJsonFile($"appsettings.{Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT")}.json", optional: true, reloadOnChange: true);
}
}
\ No newline at end of file
diff --git a/src/Agent/Insight.Agent/Extensions/Linux.cs b/src/Agent/Insight.Agent/Extensions/Linux.cs
index da4f85a..0574954 100644
--- a/src/Agent/Insight.Agent/Extensions/Linux.cs
+++ b/src/Agent/Insight.Agent/Extensions/Linux.cs
@@ -1,32 +1,31 @@
using System.Diagnostics;
using System.Runtime.Versioning;
-namespace Insight.Agent.Extensions
+namespace Insight.Agent.Extensions;
+
+public static class Linux
{
- public static class Linux
+ [SupportedOSPlatform("linux")]
+ public static string Bash(this string cmd)
{
- [SupportedOSPlatform("linux")]
- public static string Bash(this string cmd)
+ var escaped = cmd.Replace("\"", "\\\"");
+
+ using var proc = new Process()
{
- var escaped = cmd.Replace("\"", "\\\"");
-
- using var proc = new Process()
+ StartInfo = new ProcessStartInfo
{
- StartInfo = new ProcessStartInfo
- {
- FileName = "/bin/bash",
- Arguments = $"-c \"{escaped}\"",
- RedirectStandardOutput = true,
- UseShellExecute = false,
- CreateNoWindow = true,
- }
- };
+ FileName = "/bin/bash",
+ Arguments = $"-c \"{escaped}\"",
+ RedirectStandardOutput = true,
+ UseShellExecute = false,
+ CreateNoWindow = true,
+ }
+ };
- proc.Start();
- var result = proc.StandardOutput.ReadToEnd();
- proc.WaitForExit();
+ proc.Start();
+ var result = proc.StandardOutput.ReadToEnd();
+ proc.WaitForExit();
- return result;
- }
+ return result;
}
}
\ No newline at end of file
diff --git a/src/Agent/Insight.Agent/Internals/Extensions.cs b/src/Agent/Insight.Agent/Internals/Extensions.cs
index 9699249..a9380f8 100644
--- a/src/Agent/Insight.Agent/Internals/Extensions.cs
+++ b/src/Agent/Insight.Agent/Internals/Extensions.cs
@@ -1,69 +1,68 @@
using System.Management;
using System.Runtime.Versioning;
-namespace Insight.Agent
+namespace Insight.Agent;
+
+public static class ManagmentExtensions
{
- public static class ManagmentExtensions
+ [SupportedOSPlatform("windows")]
+ public static HashSet GetPropertyHashes(this ManagementBaseObject @object)
{
- [SupportedOSPlatform("windows")]
- public static HashSet GetPropertyHashes(this ManagementBaseObject @object)
+ var properties = new HashSet();
+
+ foreach (var property in @object.Properties)
{
- var properties = new HashSet();
-
- foreach (var property in @object.Properties)
- {
- properties.Add(property.Name);
- }
-
- return properties;
+ properties.Add(property.Name);
}
- [SupportedOSPlatform("windows")]
- internal static bool TryGet(this ManagementObjectSearcher searcher, out ManagementObjectCollection collection)
+ return properties;
+ }
+
+ [SupportedOSPlatform("windows")]
+ internal static bool TryGet(this ManagementObjectSearcher searcher, out ManagementObjectCollection collection)
+ {
+ collection = searcher.Get();
+
+ try
{
- collection = searcher.Get();
-
- try
- {
- _ = collection.Count;
- return true;
- }
- catch (ManagementException)
- {
- collection.Dispose();
- return false;
- }
- }
-
- [SupportedOSPlatform("windows")]
- internal static T? GetValue(this ManagementObject @object, HashSet properties, string key)
- {
- if (@object is null || properties is null || key is null) return default;
- if (properties.Contains(key, StringComparer.OrdinalIgnoreCase) is false) return default;
-
- if (@object[key] is not T obj)
- {
- return default;
- }
-
- return obj;
- }
-
- [SupportedOSPlatform("windows")]
- internal static bool TryGetValue(this ManagementBaseObject @object, HashSet properties, string key, out T? value)
- {
- value = default;
-
- if (@object is null || properties is null || key is null) return default;
- if (properties.Contains(key, StringComparer.OrdinalIgnoreCase) is false) return false;
-
- if (@object[key] is not T obj)
- {
- return false;
- }
-
- value = obj;
+ _ = collection.Count;
return true;
}
+ catch (ManagementException)
+ {
+ collection.Dispose();
+ return false;
+ }
+ }
+
+ [SupportedOSPlatform("windows")]
+ internal static T? GetValue(this ManagementObject @object, HashSet properties, string key)
+ {
+ if (@object is null || properties is null || key is null) return default;
+ if (properties.Contains(key, StringComparer.OrdinalIgnoreCase) is false) return default;
+
+ if (@object[key] is not T obj)
+ {
+ return default;
+ }
+
+ return obj;
+ }
+
+ [SupportedOSPlatform("windows")]
+ internal static bool TryGetValue(this ManagementBaseObject @object, HashSet properties, string key, out T? value)
+ {
+ value = default;
+
+ if (@object is null || properties is null || key is null) return default;
+ if (properties.Contains(key, StringComparer.OrdinalIgnoreCase) is false) return false;
+
+ if (@object[key] is not T obj)
+ {
+ return false;
+ }
+
+ value = obj;
+ return true;
}
}
\ No newline at end of file
diff --git a/src/Agent/Insight.Agent/Internals/Helpers.cs b/src/Agent/Insight.Agent/Internals/Helpers.cs
index 93d7e62..e0a0a23 100644
--- a/src/Agent/Insight.Agent/Internals/Helpers.cs
+++ b/src/Agent/Insight.Agent/Internals/Helpers.cs
@@ -2,43 +2,42 @@
using System.ServiceProcess;
using System.Text;
-namespace Insight.Agent
+namespace Insight.Agent;
+
+internal class Helpers
{
- internal class Helpers
+ internal static string? EscapeWql(string text)
{
- internal static string? EscapeWql(string text)
- {
- if (text == null) return null;
+ if (text == null) return null;
- var sb = new StringBuilder(text.Length);
- foreach (var c in text)
+ var sb = new StringBuilder(text.Length);
+ foreach (var c in text)
+ {
+ if (c == '\\' || c == '\'' || c == '"')
{
- if (c == '\\' || c == '\'' || c == '"')
- {
- sb.Append('\\');
- }
- sb.Append(c);
+ sb.Append('\\');
}
- return sb.ToString();
+ sb.Append(c);
+ }
+ return sb.ToString();
+ }
+
+ [SupportedOSPlatform("windows")]
+ internal static bool ForceWinRmStart()
+ {
+ var winRm = ServiceController
+ .GetServices()
+ .First(x => x.ServiceName
+ .ToLower()
+ .Equals("winrm", StringComparison.Ordinal));
+
+ if (winRm.Status is not ServiceControllerStatus.Running)
+ {
+ winRm.Start();
+ winRm.WaitForStatus(ServiceControllerStatus.Running);
}
- [SupportedOSPlatform("windows")]
- internal static bool ForceWinRmStart()
- {
- var winRm = ServiceController
- .GetServices()
- .First(x => x.ServiceName
- .ToLower()
- .Equals("winrm", StringComparison.Ordinal));
-
- if (winRm.Status is not ServiceControllerStatus.Running)
- {
- winRm.Start();
- winRm.WaitForStatus(ServiceControllerStatus.Running);
- }
-
- if (winRm.Status != ServiceControllerStatus.Running) return false;
- return true;
- }
+ if (winRm.Status != ServiceControllerStatus.Running) return false;
+ return true;
}
}
\ No newline at end of file
diff --git a/src/Agent/Insight.Agent/Models/Config.cs b/src/Agent/Insight.Agent/Models/Config.cs
index 4be9391..4fdd2ae 100644
--- a/src/Agent/Insight.Agent/Models/Config.cs
+++ b/src/Agent/Insight.Agent/Models/Config.cs
@@ -1,7 +1,6 @@
-namespace Insight.Agent.Models
+namespace Insight.Agent.Models;
+
+public class Config
{
- public class Config
- {
- public Guid? Serial { get; set; }
- }
+ public Guid? Serial { get; set; }
}
\ No newline at end of file
diff --git a/src/Agent/Insight.Agent/Services/CollectorService.cs b/src/Agent/Insight.Agent/Services/CollectorService.cs
index 6b8d224..03ac923 100644
--- a/src/Agent/Insight.Agent/Services/CollectorService.cs
+++ b/src/Agent/Insight.Agent/Services/CollectorService.cs
@@ -2,16 +2,15 @@
using Microsoft.Extensions.Logging.Abstractions;
using System.Runtime.Versioning;
-namespace Insight.Agent.Services
-{
- [SupportedOSPlatform("linux")]
- public partial class CollectorService
- {
- public ILogger Logger { get; }
+namespace Insight.Agent.Services;
- public CollectorService(ILogger? logger = null)
- {
- Logger = logger ?? NullLogger.Instance;
- }
+[SupportedOSPlatform("linux")]
+public partial class CollectorService
+{
+ public ILogger Logger { get; }
+
+ public CollectorService(ILogger? logger = null)
+ {
+ Logger = logger ?? NullLogger.Instance;
}
}
\ No newline at end of file
diff --git a/src/Agent/Insight.Agent/Services/Configurator.cs b/src/Agent/Insight.Agent/Services/Configurator.cs
index 0778ac2..3dbfa76 100644
--- a/src/Agent/Insight.Agent/Services/Configurator.cs
+++ b/src/Agent/Insight.Agent/Services/Configurator.cs
@@ -1,97 +1,96 @@
using System.Text.Json;
-namespace Insight.Agent.Services
+namespace Insight.Agent.Services;
+
+public static class Configurator
{
- public static class Configurator
+ public static async ValueTask ReadAsync(string file, CancellationToken cancellationToken = default)
+ where TConfig : class
{
- public static async ValueTask ReadAsync(string file, CancellationToken cancellationToken = default)
- where TConfig : class
+ var json = await File.ReadAllTextAsync(file, cancellationToken);
+
+ if (JsonSerializer.Deserialize(json, new JsonSerializerOptions { PropertyNameCaseInsensitive = true, WriteIndented = true }) is not TConfig config)
{
- var json = await File.ReadAllTextAsync(file, cancellationToken);
-
- if (JsonSerializer.Deserialize(json, new JsonSerializerOptions { PropertyNameCaseInsensitive = true, WriteIndented = true }) is not TConfig config)
- {
- throw new InvalidDataException($"Failed to deserialize ({file})");
- }
-
- return config;
- }
- public static async ValueTask ReadJsonAsync(string file, CancellationToken cancellationToken = default)
- {
- var json = await File.ReadAllTextAsync(file, cancellationToken);
-
- if (JsonDocument.Parse(json) is not JsonDocument doc)
- {
- throw new InvalidDataException($"Failed to deserialize ({file})");
- }
-
- return doc;
- }
- public static async ValueTask> ReadDictionaryAsync(string file, CancellationToken cancellationToken = default)
- {
- var json = await File.ReadAllTextAsync(file, cancellationToken);
-
- if (JsonSerializer.Deserialize>(json, new JsonSerializerOptions { PropertyNameCaseInsensitive = true, WriteIndented = true }) is not IDictionary config)
- {
- throw new InvalidDataException($"Failed to deserialize ({file})");
- }
-
- return config;
+ throw new InvalidDataException($"Failed to deserialize ({file})");
}
- public static async ValueTask WriteAsync(TConfig config, string file, CancellationToken cancellationToken) where TConfig : class
+ return config;
+ }
+ public static async ValueTask ReadJsonAsync(string file, CancellationToken cancellationToken = default)
+ {
+ var json = await File.ReadAllTextAsync(file, cancellationToken);
+
+ if (JsonDocument.Parse(json) is not JsonDocument doc)
{
- await WriteToFileAsync(config, file, cancellationToken);
- }
- public static async ValueTask WriteAsync(JsonDocument config, string file, CancellationToken cancellationToken)
- {
- await WriteToFileAsync(config, file, cancellationToken);
- }
- public static async ValueTask WriteAsync(IDictionary config, string file, CancellationToken cancellationToken)
- {
- await WriteToFileAsync(config, file, cancellationToken);
+ throw new InvalidDataException($"Failed to deserialize ({file})");
}
- public static async ValueTask AddOrUpdateAsync(KeyValuePair data, string file, CancellationToken cancellationToken)
+ return doc;
+ }
+ public static async ValueTask> ReadDictionaryAsync(string file, CancellationToken cancellationToken = default)
+ {
+ var json = await File.ReadAllTextAsync(file, cancellationToken);
+
+ if (JsonSerializer.Deserialize>(json, new JsonSerializerOptions { PropertyNameCaseInsensitive = true, WriteIndented = true }) is not IDictionary config)
{
- var readData = await ReadDictionaryAsync(file, cancellationToken);
-
- var key = readData.Keys.FirstOrDefault(dic => string.Compare(dic, data.Key, StringComparison.OrdinalIgnoreCase) == 0);
-
- if (key is null)
- {
- readData.Add(data.Key, data.Value);
- }
- else
- {
- readData[key] = data.Value;
- }
-
- await WriteToFileAsync(readData, file, cancellationToken);
- }
- public static async ValueTask RemoveAsync(string data, string file, CancellationToken cancellationToken)
- {
- var readData = await ReadDictionaryAsync(file, cancellationToken);
-
- var key = readData.Keys.FirstOrDefault(dic => string.Compare(dic, data, StringComparison.OrdinalIgnoreCase) == 0);
-
- if (key is null)
- {
- return;
- }
- else
- {
- readData.Remove(key);
- }
-
- await WriteToFileAsync(readData, file, cancellationToken);
+ throw new InvalidDataException($"Failed to deserialize ({file})");
}
- private static async ValueTask WriteToFileAsync(TData data, string file, CancellationToken cancellationToken)
- {
- var json = JsonSerializer.Serialize(data, new JsonSerializerOptions { WriteIndented = true });
+ return config;
+ }
- await File.WriteAllTextAsync(file, json, cancellationToken);
+ public static async ValueTask WriteAsync(TConfig config, string file, CancellationToken cancellationToken) where TConfig : class
+ {
+ await WriteToFileAsync(config, file, cancellationToken);
+ }
+ public static async ValueTask WriteAsync(JsonDocument config, string file, CancellationToken cancellationToken)
+ {
+ await WriteToFileAsync(config, file, cancellationToken);
+ }
+ public static async ValueTask WriteAsync(IDictionary config, string file, CancellationToken cancellationToken)
+ {
+ await WriteToFileAsync(config, file, cancellationToken);
+ }
+
+ public static async ValueTask AddOrUpdateAsync(KeyValuePair data, string file, CancellationToken cancellationToken)
+ {
+ var readData = await ReadDictionaryAsync(file, cancellationToken);
+
+ var key = readData.Keys.FirstOrDefault(dic => string.Compare(dic, data.Key, StringComparison.OrdinalIgnoreCase) == 0);
+
+ if (key is null)
+ {
+ readData.Add(data.Key, data.Value);
}
+ else
+ {
+ readData[key] = data.Value;
+ }
+
+ await WriteToFileAsync(readData, file, cancellationToken);
+ }
+ public static async ValueTask RemoveAsync(string data, string file, CancellationToken cancellationToken)
+ {
+ var readData = await ReadDictionaryAsync(file, cancellationToken);
+
+ var key = readData.Keys.FirstOrDefault(dic => string.Compare(dic, data, StringComparison.OrdinalIgnoreCase) == 0);
+
+ if (key is null)
+ {
+ return;
+ }
+ else
+ {
+ readData.Remove(key);
+ }
+
+ await WriteToFileAsync(readData, file, cancellationToken);
+ }
+
+ private static async ValueTask WriteToFileAsync(TData data, string file, CancellationToken cancellationToken)
+ {
+ var json = JsonSerializer.Serialize(data, new JsonSerializerOptions { WriteIndented = true });
+
+ await File.WriteAllTextAsync(file, json, cancellationToken);
}
}
\ No newline at end of file
diff --git a/src/Api/Insight.Api/Constants/Locations.cs b/src/Api/Insight.Api/Constants/Locations.cs
index 8db6a8f..94d66e7 100644
--- a/src/Api/Insight.Api/Constants/Locations.cs
+++ b/src/Api/Insight.Api/Constants/Locations.cs
@@ -1,9 +1,8 @@
using Insight.Domain.Constants;
-namespace Insight.Api
+namespace Insight.Api;
+
+public static class Locations
{
- public static class Locations
- {
- public static DirectoryInfo UpdatesPath { get; } = new DirectoryInfo($"{Configuration.AppDirectory?.FullName}/files/updates");
- }
+ public static DirectoryInfo UpdatesPath { get; } = new DirectoryInfo($"{Configuration.AppDirectory?.FullName}/files/updates");
}
\ No newline at end of file
diff --git a/src/Api/Insight.Api/Controllers/AccountController.cs b/src/Api/Insight.Api/Controllers/AccountController.cs
index 21756f3..3510438 100644
--- a/src/Api/Insight.Api/Controllers/AccountController.cs
+++ b/src/Api/Insight.Api/Controllers/AccountController.cs
@@ -4,73 +4,72 @@ using Insight.Infrastructure.Services;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
-namespace Insight.Api.Controllers
+namespace Insight.Api.Controllers;
+
+[ApiController, Route("api/accounts")]
+public class AccountController : ControllerBase
{
- [ApiController, Route("api/accounts")]
- public class AccountController : ControllerBase
+ private readonly IdentityService _identityService;
+ private readonly AccountService _accountService;
+ private readonly ILogger _logger;
+
+ public AccountController(IdentityService identityService, AccountService accountService, ILogger logger)
{
- private readonly IdentityService _identityService;
- private readonly AccountService _accountService;
- private readonly ILogger _logger;
+ _identityService = identityService;
+ _accountService = accountService;
+ _logger = logger;
+ }
- public AccountController(IdentityService identityService, AccountService accountService, ILogger logger)
+ [HttpGet, Authorize]
+ public async Task Get([FromQuery] PagedDataRequest request, CancellationToken cancellationToken)
+ {
+ try
{
- _identityService = identityService;
- _accountService = accountService;
- _logger = logger;
+ var result = await _accountService.GetAsync(
+ offset: request.Offset,
+ limit: request.Limit,
+ request: Request,
+ response: Response,
+ cancellationToken: cancellationToken).ConfigureAwait(false);
+
+ return Ok(result);
}
-
- [HttpGet, Authorize]
- public async Task Get([FromQuery] PagedDataRequest request, CancellationToken cancellationToken)
+ catch (UnauthorizedAccessException ex)
{
- try
- {
- var result = await _accountService.GetAsync(
- offset: request.Offset,
- limit: request.Limit,
- request: Request,
- response: Response,
- cancellationToken: cancellationToken).ConfigureAwait(false);
-
- return Ok(result);
- }
- catch (UnauthorizedAccessException ex)
- {
- return Unauthorized(ex.ToString());
- }
- catch (Exception ex)
- {
- return BadRequest(ex.Message);
- }
+ return Unauthorized(ex.ToString());
}
-
- [HttpPost("register"), Authorize]
- public async Task Register([FromBody] RegistrationModel model)
+ catch (Exception ex)
{
- if (string.IsNullOrWhiteSpace(model.Email)) return BadRequest("Email Required");
- if (string.IsNullOrWhiteSpace(model.Password)) return BadRequest("Password Required");
- if (string.IsNullOrWhiteSpace(model.ConfirmPassword)) return BadRequest("Password Confirmation Required");
-
- if (model.Password != model.ConfirmPassword) return BadRequest("Passwords do not match");
-
- try
- {
- var result = await _identityService.CreateUserAsync(model.Email, model.Password).ConfigureAwait(false);
-
- if (result.Succeeded is false) return BadRequest(result.Errors);
- }
- catch (UnauthorizedAccessException ex)
- {
- return Unauthorized(ex.Message);
- }
- catch (Exception ex)
- {
- return BadRequest(ex.Message);
- }
-
- //await _userManager.AddToRoleAsync(user, "Visitor");
-
- return Ok(model.Email);
+ return BadRequest(ex.Message);
}
}
+
+ [HttpPost("register"), Authorize]
+ public async Task Register([FromBody] RegistrationModel model)
+ {
+ if (string.IsNullOrWhiteSpace(model.Email)) return BadRequest("Email Required");
+ if (string.IsNullOrWhiteSpace(model.Password)) return BadRequest("Password Required");
+ if (string.IsNullOrWhiteSpace(model.ConfirmPassword)) return BadRequest("Password Confirmation Required");
+
+ if (model.Password != model.ConfirmPassword) return BadRequest("Passwords do not match");
+
+ try
+ {
+ var result = await _identityService.CreateUserAsync(model.Email, model.Password).ConfigureAwait(false);
+
+ if (result.Succeeded is false) return BadRequest(result.Errors);
+ }
+ catch (UnauthorizedAccessException ex)
+ {
+ return Unauthorized(ex.Message);
+ }
+ catch (Exception ex)
+ {
+ return BadRequest(ex.Message);
+ }
+
+ //await _userManager.AddToRoleAsync(user, "Visitor");
+
+ return Ok(model.Email);
+ }
}
\ No newline at end of file
diff --git a/src/Api/Insight.Api/Controllers/AgentController.cs b/src/Api/Insight.Api/Controllers/AgentController.cs
index cc0f6b1..0a1e5b9 100644
--- a/src/Api/Insight.Api/Controllers/AgentController.cs
+++ b/src/Api/Insight.Api/Controllers/AgentController.cs
@@ -3,42 +3,41 @@ using Insight.Infrastructure.Services;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
-namespace Insight.Api.Controllers
+namespace Insight.Api.Controllers;
+
+[ApiController, Route("api/agents")]
+public class AgentController : ControllerBase
{
- [ApiController, Route("api/agents")]
- public class AgentController : ControllerBase
+ private readonly AgentService _agentService;
+ private readonly ILogger _logger;
+
+ public AgentController(AgentService agentService, ILogger logger)
{
- private readonly AgentService _agentService;
- private readonly ILogger _logger;
+ _agentService = agentService;
+ _logger = logger;
+ }
- public AgentController(AgentService agentService, ILogger logger)
+ [HttpGet, Authorize]
+ public async Task Get([FromQuery] PagedDataRequest request, CancellationToken cancellationToken)
+ {
+ try
{
- _agentService = agentService;
- _logger = logger;
+ var result = await _agentService.GetAsync(
+ offset: request.Offset,
+ limit: request.Limit,
+ request: Request,
+ response: Response,
+ cancellationToken: cancellationToken).ConfigureAwait(false);
+
+ return Ok(result);
}
-
- [HttpGet, Authorize]
- public async Task Get([FromQuery] PagedDataRequest request, CancellationToken cancellationToken)
+ catch (UnauthorizedAccessException ex)
{
- try
- {
- var result = await _agentService.GetAsync(
- offset: request.Offset,
- limit: request.Limit,
- request: Request,
- response: Response,
- cancellationToken: cancellationToken).ConfigureAwait(false);
-
- return Ok(result);
- }
- catch (UnauthorizedAccessException ex)
- {
- return Unauthorized(ex.ToString());
- }
- catch (Exception ex)
- {
- return BadRequest(ex.Message);
- }
+ return Unauthorized(ex.ToString());
+ }
+ catch (Exception ex)
+ {
+ return BadRequest(ex.Message);
}
}
}
\ No newline at end of file
diff --git a/src/Api/Insight.Api/Controllers/CustomerController.cs b/src/Api/Insight.Api/Controllers/CustomerController.cs
index 6733f81..4aedc19 100644
--- a/src/Api/Insight.Api/Controllers/CustomerController.cs
+++ b/src/Api/Insight.Api/Controllers/CustomerController.cs
@@ -3,42 +3,41 @@ using Insight.Infrastructure.Services;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
-namespace Insight.Api.Controllers
+namespace Insight.Api.Controllers;
+
+[ApiController, Route("api/customers")]
+public class CustomerController : ControllerBase
{
- [ApiController, Route("api/customers")]
- public class CustomerController : ControllerBase
+ private readonly CustomerService _customerService;
+ private readonly ILogger _logger;
+
+ public CustomerController(CustomerService customerService, ILogger logger)
{
- private readonly CustomerService _customerService;
- private readonly ILogger _logger;
+ _customerService = customerService;
+ _logger = logger;
+ }
- public CustomerController(CustomerService customerService, ILogger logger)
+ [HttpGet, Authorize]
+ public async Task Get([FromQuery] PagedDataRequest request, CancellationToken cancellationToken)
+ {
+ try
{
- _customerService = customerService;
- _logger = logger;
+ var result = await _customerService.GetAsync(
+ offset: request.Offset,
+ limit: request.Limit,
+ request: Request,
+ response: Response,
+ cancellationToken: cancellationToken).ConfigureAwait(false);
+
+ return Ok(result);
}
-
- [HttpGet, Authorize]
- public async Task Get([FromQuery] PagedDataRequest request, CancellationToken cancellationToken)
+ catch (UnauthorizedAccessException ex)
{
- try
- {
- var result = await _customerService.GetAsync(
- offset: request.Offset,
- limit: request.Limit,
- request: Request,
- response: Response,
- cancellationToken: cancellationToken).ConfigureAwait(false);
-
- return Ok(result);
- }
- catch (UnauthorizedAccessException ex)
- {
- return Unauthorized(ex.ToString());
- }
- catch (Exception ex)
- {
- return BadRequest(ex.Message);
- }
+ return Unauthorized(ex.ToString());
+ }
+ catch (Exception ex)
+ {
+ return BadRequest(ex.Message);
}
}
}
\ No newline at end of file
diff --git a/src/Api/Insight.Api/Controllers/HostController.cs b/src/Api/Insight.Api/Controllers/HostController.cs
index bd42dac..d8eb5c5 100644
--- a/src/Api/Insight.Api/Controllers/HostController.cs
+++ b/src/Api/Insight.Api/Controllers/HostController.cs
@@ -3,42 +3,41 @@ using Insight.Infrastructure.Services;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
-namespace Insight.Api.Controllers
+namespace Insight.Api.Controllers;
+
+[ApiController, Route("api/hosts")]
+public class HostController : ControllerBase
{
- [ApiController, Route("api/hosts")]
- public class HostController : ControllerBase
+ private readonly HostService _hostService;
+ private readonly ILogger _logger;
+
+ public HostController(HostService hostService, ILogger logger)
{
- private readonly HostService _hostService;
- private readonly ILogger _logger;
+ _hostService = hostService;
+ _logger = logger;
+ }
- public HostController(HostService hostService, ILogger logger)
+ [HttpGet, Authorize]
+ public async Task Get([FromQuery] PagedDataRequest request, CancellationToken cancellationToken)
+ {
+ try
{
- _hostService = hostService;
- _logger = logger;
+ var result = await _hostService.GetAsync(
+ offset: request.Offset,
+ limit: request.Limit,
+ request: Request,
+ response: Response,
+ cancellationToken: cancellationToken).ConfigureAwait(false);
+
+ return Ok(result);
}
-
- [HttpGet, Authorize]
- public async Task Get([FromQuery] PagedDataRequest request, CancellationToken cancellationToken)
+ catch (UnauthorizedAccessException ex)
{
- try
- {
- var result = await _hostService.GetAsync(
- offset: request.Offset,
- limit: request.Limit,
- request: Request,
- response: Response,
- cancellationToken: cancellationToken).ConfigureAwait(false);
-
- return Ok(result);
- }
- catch (UnauthorizedAccessException ex)
- {
- return Unauthorized(ex.ToString());
- }
- catch (Exception ex)
- {
- return BadRequest(ex.Message);
- }
+ return Unauthorized(ex.ToString());
+ }
+ catch (Exception ex)
+ {
+ return BadRequest(ex.Message);
}
}
}
\ No newline at end of file
diff --git a/src/Api/Insight.Api/Controllers/InventoryController.cs b/src/Api/Insight.Api/Controllers/InventoryController.cs
index 2a47dff..4327843 100644
--- a/src/Api/Insight.Api/Controllers/InventoryController.cs
+++ b/src/Api/Insight.Api/Controllers/InventoryController.cs
@@ -8,66 +8,65 @@ using MongoDB.Driver;
using System.Text.Json.Serialization;
using System.Text.RegularExpressions;
-namespace Insight.Api.Controllers
+namespace Insight.Api.Controllers;
+
+[ApiController, Route("api/inventory")]
+public class InventoryController : ControllerBase
{
- [ApiController, Route("api/inventory")]
- public class InventoryController : ControllerBase
+ private readonly InventoryService _inventoryService;
+ private readonly ILogger _logger;
+
+ public InventoryController(InventoryService inventoryService, ILogger logger)
{
- private readonly InventoryService _inventoryService;
- private readonly ILogger _logger;
+ _inventoryService = inventoryService;
+ _logger = logger;
+ }
- public InventoryController(InventoryService inventoryService, ILogger logger)
+ [HttpGet, Authorize]
+ public async Task Get([FromQuery] HostApplicationEntity request, [FromQuery] PagedDataRequest meta, CancellationToken cancellationToken)
+ {
+ try
{
- _inventoryService = inventoryService;
- _logger = logger;
+ var filter = Builders.Filter.Empty;
+
+ if (request.Id is not null)
+ filter &= Builders.Filter.Eq(p => p.Id, request.Id);
+
+ if (request.Host is not null)
+ filter &= Builders.Filter.Eq(p => p.Host, request.Host);
+
+ if (request.Name is not null)
+ filter &= Builders.Filter.Regex(p => p.Name, new BsonRegularExpression(new Regex(request.Name, RegexOptions.IgnoreCase)));
+
+ var result = await _inventoryService.GetAsync(
+ filter: filter,
+ offset: meta.Offset,
+ limit: meta.Limit,
+ request: Request,
+ response: Response,
+ cancellationToken: cancellationToken).ConfigureAwait(false);
+
+ return Ok(result);
}
-
- [HttpGet, Authorize]
- public async Task Get([FromQuery] HostApplicationEntity request, [FromQuery] PagedDataRequest meta, CancellationToken cancellationToken)
+ catch (UnauthorizedAccessException ex)
{
- try
- {
- var filter = Builders.Filter.Empty;
-
- if (request.Id is not null)
- filter &= Builders.Filter.Eq(p => p.Id, request.Id);
-
- if (request.Host is not null)
- filter &= Builders.Filter.Eq(p => p.Host, request.Host);
-
- if (request.Name is not null)
- filter &= Builders.Filter.Regex(p => p.Name, new BsonRegularExpression(new Regex(request.Name, RegexOptions.IgnoreCase)));
-
- var result = await _inventoryService.GetAsync(
- filter: filter,
- offset: meta.Offset,
- limit: meta.Limit,
- request: Request,
- response: Response,
- cancellationToken: cancellationToken).ConfigureAwait(false);
-
- return Ok(result);
- }
- catch (UnauthorizedAccessException ex)
- {
- return Unauthorized(ex.ToString());
- }
- catch (Exception ex)
- {
- return BadRequest(ex.Message);
- }
+ return Unauthorized(ex.ToString());
}
-
- public class ApplicationRequest
+ catch (Exception ex)
{
- [JsonPropertyName("id")]
- public string? Id { get; set; }
-
- [JsonPropertyName("host")]
- public string? Host { get; set; }
-
- [JsonPropertyName("name")]
- public string? Name { get; set; }
+ return BadRequest(ex.Message);
}
}
+
+ public class ApplicationRequest
+ {
+ [JsonPropertyName("id")]
+ public string? Id { get; set; }
+
+ [JsonPropertyName("host")]
+ public string? Host { get; set; }
+
+ [JsonPropertyName("name")]
+ public string? Name { get; set; }
+ }
}
\ No newline at end of file
diff --git a/src/Api/Insight.Api/Controllers/SetupController.cs b/src/Api/Insight.Api/Controllers/SetupController.cs
index 913e294..831a922 100644
--- a/src/Api/Insight.Api/Controllers/SetupController.cs
+++ b/src/Api/Insight.Api/Controllers/SetupController.cs
@@ -1,30 +1,29 @@
using Microsoft.AspNetCore.Mvc;
-namespace Insight.Server.Controllers
+namespace Insight.Server.Controllers;
+
+[ApiController, Route("api/setup")]
+public class SetupController : ControllerBase
{
- [ApiController, Route("api/setup")]
- public class SetupController : ControllerBase
+ private readonly ILogger _logger;
+
+ public SetupController(ILogger logger)
{
- private readonly ILogger _logger;
+ _logger = logger;
+ }
- public SetupController(ILogger logger)
+ [HttpGet("windows")]
+ public async Task GetAsync(CancellationToken cancellationToken)
+ {
+ _logger.LogInformation("[{method}] {route} => {ep}", Request.Method, Request.HttpContext.Request.Path, Request.HttpContext.Connection.RemoteIpAddress);
+
+ var files = new DirectoryInfo($"{Domain.Constants.Configuration.AppDirectory?.FullName}/files/setup").GetFiles();
+
+ if (files.Length == 0)
{
- _logger = logger;
+ return NotFound();
}
- [HttpGet("windows")]
- public async Task GetAsync(CancellationToken cancellationToken)
- {
- _logger.LogInformation("[{method}] {route} => {ep}", Request.Method, Request.HttpContext.Request.Path, Request.HttpContext.Connection.RemoteIpAddress);
-
- var files = new DirectoryInfo($"{Domain.Constants.Configuration.AppDirectory?.FullName}/files/setup").GetFiles();
-
- if (files.Length == 0)
- {
- return NotFound();
- }
-
- return File(await System.IO.File.ReadAllBytesAsync(files.OrderBy(p => p.LastWriteTime).First().FullName, cancellationToken), "application/zip", "setup-win64.zip");
- }
+ return File(await System.IO.File.ReadAllBytesAsync(files.OrderBy(p => p.LastWriteTime).First().FullName, cancellationToken), "application/zip", "setup-win64.zip");
}
}
\ No newline at end of file
diff --git a/src/Api/Insight.Api/Controllers/TokenController.cs b/src/Api/Insight.Api/Controllers/TokenController.cs
index 372a066..9c36083 100644
--- a/src/Api/Insight.Api/Controllers/TokenController.cs
+++ b/src/Api/Insight.Api/Controllers/TokenController.cs
@@ -3,83 +3,82 @@ using Insight.Infrastructure.Services;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
-namespace Insight.Api.Controllers
+namespace Insight.Api.Controllers;
+
+[ApiController, Route("api/token", Order = 0)]
+public class TokenController : ControllerBase
{
- [ApiController, Route("api/token", Order = 0)]
- public class TokenController : ControllerBase
+ private readonly TokenService _tokenService;
+
+ public TokenController(TokenService tokenService)
{
- private readonly TokenService _tokenService;
+ _tokenService = tokenService;
+ }
- public TokenController(TokenService tokenService)
+ ///
+ /// Access Token Request
+ ///
+ [HttpPost, AllowAnonymous]
+ public async Task Authentication([FromBody] TokenRequest request)
+ {
+ try
{
- _tokenService = tokenService;
+ var result = await _tokenService.GetAsync(request.Username, request.Password, request.Code, HttpContext.Connection.RemoteIpAddress).ConfigureAwait(false);
+ return Ok(result);
}
-
- ///
- /// Access Token Request
- ///
- [HttpPost, AllowAnonymous]
- public async Task Authentication([FromBody] TokenRequest request)
+ catch (UnauthorizedAccessException ex)
{
- try
- {
- var result = await _tokenService.GetAsync(request.Username, request.Password, request.Code, HttpContext.Connection.RemoteIpAddress).ConfigureAwait(false);
- return Ok(result);
- }
- catch (UnauthorizedAccessException ex)
- {
- return Unauthorized(ex.Message);
- }
- catch (Exception ex)
- {
- return BadRequest(ex.Message);
- }
+ return Unauthorized(ex.Message);
}
-
- ///
- /// Refresh Token Request
- ///
- [HttpPost("refresh"), AllowAnonymous]
- public async Task Refresh([FromBody] TokenRefreshRequest request)
+ catch (Exception ex)
{
- if (string.IsNullOrWhiteSpace(request.Token)) return BadRequest("Refresh Token Required");
-
- try
- {
- var result = await _tokenService.RefreshAsync(request.Token, HttpContext.Connection.RemoteIpAddress).ConfigureAwait(false);
- return Ok(result);
- }
- catch (UnauthorizedAccessException ex)
- {
- return Unauthorized(ex.Message);
- }
- catch (Exception ex)
- {
- return BadRequest(ex.Message);
- }
+ return BadRequest(ex.Message);
}
+ }
- ///
- /// Revoke Token Request
- ///
- [HttpPost("revoke"), AllowAnonymous]
- public async Task Revoke([FromBody] TokenRevokeRequest request)
+ ///
+ /// Refresh Token Request
+ ///
+ [HttpPost("refresh"), AllowAnonymous]
+ public async Task Refresh([FromBody] TokenRefreshRequest request)
+ {
+ if (string.IsNullOrWhiteSpace(request.Token)) return BadRequest("Refresh Token Required");
+
+ try
{
- if (string.IsNullOrWhiteSpace(request.Token)) return BadRequest("Refresh Token Required");
+ var result = await _tokenService.RefreshAsync(request.Token, HttpContext.Connection.RemoteIpAddress).ConfigureAwait(false);
+ return Ok(result);
+ }
+ catch (UnauthorizedAccessException ex)
+ {
+ return Unauthorized(ex.Message);
+ }
+ catch (Exception ex)
+ {
+ return BadRequest(ex.Message);
+ }
+ }
- try
- {
- await _tokenService.RevokeAsync(request.Token, request.Reason ?? "revoked by user", HttpContext.Connection.RemoteIpAddress).ConfigureAwait(false);
- return Ok();
- }
- catch (UnauthorizedAccessException ex)
- {
- return Unauthorized(ex.Message);
- }
- catch (Exception ex)
- {
- return BadRequest(ex.Message);
- }
+ ///
+ /// Revoke Token Request
+ ///
+ [HttpPost("revoke"), AllowAnonymous]
+ public async Task Revoke([FromBody] TokenRevokeRequest request)
+ {
+ if (string.IsNullOrWhiteSpace(request.Token)) return BadRequest("Refresh Token Required");
+
+ try
+ {
+ await _tokenService.RevokeAsync(request.Token, request.Reason ?? "revoked by user", HttpContext.Connection.RemoteIpAddress).ConfigureAwait(false);
+ return Ok();
+ }
+ catch (UnauthorizedAccessException ex)
+ {
+ return Unauthorized(ex.Message);
+ }
+ catch (Exception ex)
+ {
+ return BadRequest(ex.Message);
}
}
}
\ No newline at end of file
diff --git a/src/Api/Insight.Api/Controllers/UpdateController.cs b/src/Api/Insight.Api/Controllers/UpdateController.cs
index 6ff09df..173a636 100644
--- a/src/Api/Insight.Api/Controllers/UpdateController.cs
+++ b/src/Api/Insight.Api/Controllers/UpdateController.cs
@@ -2,92 +2,91 @@
using Insight.Domain.Models;
using Microsoft.AspNetCore.Mvc;
-namespace Insight.Server.Controllers
+namespace Insight.Server.Controllers;
+
+[ApiController, Route("api/update")]
+public class UpdateController : ControllerBase
{
- [ApiController, Route("api/update")]
- public class UpdateController : ControllerBase
+ private readonly ILogger _logger;
+
+ public UpdateController(ILogger logger)
{
- private readonly ILogger _logger;
+ _logger = logger;
+ }
- public UpdateController(ILogger logger)
+ [HttpGet("updater/windows")]
+ public IActionResult UpdaterWindows()
+ {
+ _logger.LogInformation("[{method}] {route} => {ep}", Request.Method, Request.HttpContext.Request.Path, Request.HttpContext.Connection.RemoteIpAddress);
+
+ var updateDir = new DirectoryInfo($"{Locations.UpdatesPath}/updater/windows");
+
+ if (updateDir.Exists is false)
{
- _logger = logger;
+ return NotFound();
}
- [HttpGet("updater/windows")]
- public IActionResult UpdaterWindows()
+ var updateLock = new FileInfo($"{updateDir.FullName}/.lock");
+
+ if (updateLock.Exists)
{
- _logger.LogInformation("[{method}] {route} => {ep}", Request.Method, Request.HttpContext.Request.Path, Request.HttpContext.Connection.RemoteIpAddress);
-
- var updateDir = new DirectoryInfo($"{Locations.UpdatesPath}/updater/windows");
-
- if (updateDir.Exists is false)
- {
- return NotFound();
- }
-
- var updateLock = new FileInfo($"{updateDir.FullName}/.lock");
-
- if (updateLock.Exists)
- {
- return NotFound("locked");
- }
-
- var versions = updateDir.GetFiles("*.zip", SearchOption.TopDirectoryOnly);
-
- if (versions is null || versions.Any() is false) return NotFound();
-
- var latest = versions.OrderBy(x => x.Name).FirstOrDefault();
-
- if (latest is null) return NotFound();
-
- var relPath = $"{Path.GetRelativePath($"{Domain.Constants.Configuration.AppDirectory?.FullName}", latest.FullName)}";
-
- if (Version.TryParse(Path.GetFileNameWithoutExtension(latest.Name), out var fileversion) is false) return NotFound();
-
- return Ok(new UpdateResponse
- {
- Version = fileversion,
- Uri = new Uri($"{Request.Scheme}://{Request.Host}/api/{relPath}")
- });
+ return NotFound("locked");
}
- [HttpGet("agent/windows")]
- public IActionResult AgentWindows()
+ var versions = updateDir.GetFiles("*.zip", SearchOption.TopDirectoryOnly);
+
+ if (versions is null || versions.Any() is false) return NotFound();
+
+ var latest = versions.OrderBy(x => x.Name).FirstOrDefault();
+
+ if (latest is null) return NotFound();
+
+ var relPath = $"{Path.GetRelativePath($"{Domain.Constants.Configuration.AppDirectory?.FullName}", latest.FullName)}";
+
+ if (Version.TryParse(Path.GetFileNameWithoutExtension(latest.Name), out var fileversion) is false) return NotFound();
+
+ return Ok(new UpdateResponse
{
- _logger.LogInformation("[{method}] {route} => {ep}", Request.Method, Request.HttpContext.Request.Path, Request.HttpContext.Connection.RemoteIpAddress);
+ Version = fileversion,
+ Uri = new Uri($"{Request.Scheme}://{Request.Host}/api/{relPath}")
+ });
+ }
- var updateDir = new DirectoryInfo($"{Locations.UpdatesPath}/agent/windows");
+ [HttpGet("agent/windows")]
+ public IActionResult AgentWindows()
+ {
+ _logger.LogInformation("[{method}] {route} => {ep}", Request.Method, Request.HttpContext.Request.Path, Request.HttpContext.Connection.RemoteIpAddress);
- if (updateDir.Exists is false)
- {
- return NotFound();
- }
+ var updateDir = new DirectoryInfo($"{Locations.UpdatesPath}/agent/windows");
- var updateLock = new FileInfo($"{updateDir.FullName}/.lock");
-
- if (updateLock.Exists)
- {
- return NotFound("locked");
- }
-
- var versions = updateDir.GetFiles("*.zip", SearchOption.TopDirectoryOnly);
-
- if (versions is null || versions.Any() is false) return NotFound();
-
- var latest = versions.OrderBy(x => x.Name).FirstOrDefault();
-
- if (latest is null) return NotFound();
-
- var relPath = $"{Path.GetRelativePath($"{Domain.Constants.Configuration.AppDirectory?.FullName}", latest.FullName)}";
-
- if (Version.TryParse(Path.GetFileNameWithoutExtension(latest.Name), out var fileversion) is false) return NotFound();
-
- return Ok(new UpdateResponse
- {
- Version = fileversion,
- Uri = new Uri($"{Request.Scheme}://{Request.Host}/api/{relPath}")
- });
+ if (updateDir.Exists is false)
+ {
+ return NotFound();
}
+
+ var updateLock = new FileInfo($"{updateDir.FullName}/.lock");
+
+ if (updateLock.Exists)
+ {
+ return NotFound("locked");
+ }
+
+ var versions = updateDir.GetFiles("*.zip", SearchOption.TopDirectoryOnly);
+
+ if (versions is null || versions.Any() is false) return NotFound();
+
+ var latest = versions.OrderBy(x => x.Name).FirstOrDefault();
+
+ if (latest is null) return NotFound();
+
+ var relPath = $"{Path.GetRelativePath($"{Domain.Constants.Configuration.AppDirectory?.FullName}", latest.FullName)}";
+
+ if (Version.TryParse(Path.GetFileNameWithoutExtension(latest.Name), out var fileversion) is false) return NotFound();
+
+ return Ok(new UpdateResponse
+ {
+ Version = fileversion,
+ Uri = new Uri($"{Request.Scheme}://{Request.Host}/api/{relPath}")
+ });
}
}
\ No newline at end of file
diff --git a/src/Api/Insight.Api/Extensions/ServiceExtensions.cs b/src/Api/Insight.Api/Extensions/ServiceExtensions.cs
index 46b91a7..afd32de 100644
--- a/src/Api/Insight.Api/Extensions/ServiceExtensions.cs
+++ b/src/Api/Insight.Api/Extensions/ServiceExtensions.cs
@@ -2,58 +2,57 @@
using Microsoft.OpenApi.Models;
using System.Reflection;
-namespace Insight.Api.Hosting
+namespace Insight.Api.Hosting;
+
+public static class ServiceExtensions
{
- public static class ServiceExtensions
+ internal static IServiceCollection AddSwaggerServices(this IServiceCollection services, IConfiguration configuration)
{
- internal static IServiceCollection AddSwaggerServices(this IServiceCollection services, IConfiguration configuration)
+ services.AddEndpointsApiExplorer();
+ services.AddSwaggerGen(options =>
{
- services.AddEndpointsApiExplorer();
- services.AddSwaggerGen(options =>
+ options.SwaggerDoc("v1", new OpenApiInfo
{
- options.SwaggerDoc("v1", new OpenApiInfo
- {
- Title = "Insight API",
- Version = "v1"
- });
-
- options.AddSecurityDefinition(name: "Bearer", securityScheme: new OpenApiSecurityScheme
- {
- Name = "Authorization",
- Description = "Enter the Bearer Authorization string as following: `Bearer Generated-JWT-Token`",
- In = ParameterLocation.Header,
- Type = SecuritySchemeType.ApiKey,
- Scheme = "Bearer",
- BearerFormat = "JWT",
-
- Reference = new OpenApiReference
- {
- Id = JwtBearerDefaults.AuthenticationScheme,
- Type = ReferenceType.SecurityScheme
- }
- });
-
- options.AddSecurityRequirement(new OpenApiSecurityRequirement
- {
- {
- new OpenApiSecurityScheme
- {
- In = ParameterLocation.Header,
- Reference = new OpenApiReference
- {
- Id = "Bearer",
- Type = ReferenceType.SecurityScheme
- }
- },
- new List()
- }
- });
-
- var xmlFilename = $"{Assembly.GetExecutingAssembly().GetName().Name}.xml";
- options.IncludeXmlComments(Path.Combine(AppContext.BaseDirectory, xmlFilename));
+ Title = "Insight API",
+ Version = "v1"
});
- return services;
- }
+ options.AddSecurityDefinition(name: "Bearer", securityScheme: new OpenApiSecurityScheme
+ {
+ Name = "Authorization",
+ Description = "Enter the Bearer Authorization string as following: `Bearer Generated-JWT-Token`",
+ In = ParameterLocation.Header,
+ Type = SecuritySchemeType.ApiKey,
+ Scheme = "Bearer",
+ BearerFormat = "JWT",
+
+ Reference = new OpenApiReference
+ {
+ Id = JwtBearerDefaults.AuthenticationScheme,
+ Type = ReferenceType.SecurityScheme
+ }
+ });
+
+ options.AddSecurityRequirement(new OpenApiSecurityRequirement
+ {
+ {
+ new OpenApiSecurityScheme
+ {
+ In = ParameterLocation.Header,
+ Reference = new OpenApiReference
+ {
+ Id = "Bearer",
+ Type = ReferenceType.SecurityScheme
+ }
+ },
+ new List()
+ }
+ });
+
+ var xmlFilename = $"{Assembly.GetExecutingAssembly().GetName().Name}.xml";
+ options.IncludeXmlComments(Path.Combine(AppContext.BaseDirectory, xmlFilename));
+ });
+
+ return services;
}
}
\ No newline at end of file
diff --git a/src/Api/Insight.Api/Models/RegistrationModel.cs b/src/Api/Insight.Api/Models/RegistrationModel.cs
index 206b2dc..0794854 100644
--- a/src/Api/Insight.Api/Models/RegistrationModel.cs
+++ b/src/Api/Insight.Api/Models/RegistrationModel.cs
@@ -1,23 +1,22 @@
using System.ComponentModel.DataAnnotations;
-namespace Insight.Api.Models
+namespace Insight.Api.Models;
+
+public class RegistrationModel
{
- public class RegistrationModel
- {
- public string? FirstName { get; set; }
- public string? LastName { get; set; }
+ public string? FirstName { get; set; }
+ public string? LastName { get; set; }
- [Required(ErrorMessage = "Email is required")]
- [EmailAddress]
- public string? Email { get; set; }
+ [Required(ErrorMessage = "Email is required")]
+ [EmailAddress]
+ public string? Email { get; set; }
- [Required(ErrorMessage = "Password is required")]
- [DataType(DataType.Password)]
- public string? Password { get; set; }
+ [Required(ErrorMessage = "Password is required")]
+ [DataType(DataType.Password)]
+ public string? Password { get; set; }
- [Required(ErrorMessage = "Password is required")]
- [DataType(DataType.Password)]
- [Compare("Password", ErrorMessage = "The password and confirmation password do not match.")]
- public string? ConfirmPassword { get; set; }
- }
+ [Required(ErrorMessage = "Password is required")]
+ [DataType(DataType.Password)]
+ [Compare("Password", ErrorMessage = "The password and confirmation password do not match.")]
+ public string? ConfirmPassword { get; set; }
}
diff --git a/src/Api/Insight.Api/Program.cs b/src/Api/Insight.Api/Program.cs
index 0c9e95f..8e2b778 100644
--- a/src/Api/Insight.Api/Program.cs
+++ b/src/Api/Insight.Api/Program.cs
@@ -3,97 +3,96 @@ using Insight.Domain.Constants;
using Insight.Infrastructure;
using Microsoft.Extensions.FileProviders;
-namespace Insight.Api
+namespace Insight.Api;
+
+internal class Program
{
- public class Program
+ public static async Task Main(string[] args)
{
- public static async Task Main(string[] args)
+ var builder = WebApplication.CreateBuilder(args);
+ builder.Host.UseWindowsService();
+ builder.Host.UseSystemd();
+
+ // LOGGER
+ builder.Logging.ClearProviders();
+ builder.Logging.SetMinimumLevel(LogLevel.Trace);
+ builder.Logging.AddFilter("Microsoft.AspNetCore", LogLevel.Warning);
+
+ builder.Logging.AddSimpleConsole(options =>
{
- var builder = WebApplication.CreateBuilder(args);
- builder.Host.UseWindowsService();
- builder.Host.UseSystemd();
+ options.IncludeScopes = true;
+ options.SingleLine = true;
+ options.TimestampFormat = "yyyy-MM-dd HH:mm:ss.fff ";
+ });
- // LOGGER
- builder.Logging.ClearProviders();
- builder.Logging.SetMinimumLevel(LogLevel.Trace);
- builder.Logging.AddFilter("Microsoft.AspNetCore", LogLevel.Warning);
+ builder.Logging.AddFile($"{Configuration.AppDirectory?.FullName}/" + "logs/api_{Date}.log", LogLevel.Trace, fileSizeLimitBytes: 104857600, retainedFileCountLimit: 10, outputTemplate: "{Timestamp:o} [{Level:u3}] {Message} {NewLine}{Exception}");
- builder.Logging.AddSimpleConsole(options =>
- {
- options.IncludeScopes = true;
- options.SingleLine = true;
- options.TimestampFormat = "yyyy-MM-dd HH:mm:ss.fff ";
- });
+ // INFRASTRUCTURE
+ builder.Services.AddDatabase(builder.Configuration);
+ builder.Services.AddInfrastructureServices();
- builder.Logging.AddFile($"{Configuration.AppDirectory?.FullName}/" + "logs/api_{Date}.log", LogLevel.Trace, fileSizeLimitBytes: 104857600, retainedFileCountLimit: 10, outputTemplate: "{Timestamp:o} [{Level:u3}] {Message} {NewLine}{Exception}");
+ // IDENTITY
+ builder.Services.AddIdentityServices(builder.Configuration);
+ builder.Services.AddBearerAuthentication(builder.Configuration);
+ builder.Services.AddTokenServices(builder.Configuration);
- // INFRASTRUCTURE
- builder.Services.AddDatabase(builder.Configuration);
- builder.Services.AddInfrastructureServices();
+ // SECURITY
+ builder.Services.AddAuthorization();
- // IDENTITY
- builder.Services.AddIdentityServices(builder.Configuration);
- builder.Services.AddBearerAuthentication(builder.Configuration);
- builder.Services.AddTokenServices(builder.Configuration);
+ // WEBSERVICES
+ builder.Services.AddProxyServices(builder.Configuration);
+ builder.Services.AddRoutingServices(builder.Configuration);
+ builder.Services.AddControllers();
- // SECURITY
- builder.Services.AddAuthorization();
+ // SWAGGER
+ builder.Services.AddSwaggerServices(builder.Configuration);
- // WEBSERVICES
- builder.Services.AddProxyServices(builder.Configuration);
- builder.Services.AddRoutingServices(builder.Configuration);
- builder.Services.AddControllers();
+ //builder.Services.AddControllers();
+ //builder.Services.AddEndpointsApiExplorer();
+ //builder.Services.AddSwaggerGen();
- // SWAGGER
- builder.Services.AddSwaggerServices(builder.Configuration);
+ var app = builder.Build();
- //builder.Services.AddControllers();
- //builder.Services.AddEndpointsApiExplorer();
- //builder.Services.AddSwaggerGen();
+ // Configure the HTTP request pipeline.
+ app.UseForwardedHeaders();
- var app = builder.Build();
+ if (app.Environment.IsDevelopment())
+ {
- // Configure the HTTP request pipeline.
- app.UseForwardedHeaders();
-
- if (app.Environment.IsDevelopment())
- {
-
- }
-
- app.UseSwagger(options =>
- {
- options.RouteTemplate = "api/swagger/{documentName}/swagger.json";
- });
-
- app.UseSwaggerUI(options =>
- {
- options.DefaultModelsExpandDepth(-1);
- options.SwaggerEndpoint("/api/swagger/v1/swagger.json", "v1");
- options.RoutePrefix = "api/swagger";
- });
-
- app.UseCors(x => x
- .AllowAnyOrigin()
- .AllowAnyMethod()
- .AllowAnyHeader());
-
- app.UseAuthorization();
-
- app.MapControllers();
-
- // STATIC FILES (UPDATES)
- var files = new DirectoryInfo($"{Domain.Constants.Configuration.AppDirectory?.FullName}/files");
- files.Create();
-
- app.UseStaticFiles(new StaticFileOptions
- {
- FileProvider = new PhysicalFileProvider(files.FullName),
- RequestPath = "/api/files",
- ServeUnknownFileTypes = true
- });
-
- await app.RunAsync();
}
+
+ app.UseSwagger(options =>
+ {
+ options.RouteTemplate = "api/swagger/{documentName}/swagger.json";
+ });
+
+ app.UseSwaggerUI(options =>
+ {
+ options.DefaultModelsExpandDepth(-1);
+ options.SwaggerEndpoint("/api/swagger/v1/swagger.json", "v1");
+ options.RoutePrefix = "api/swagger";
+ });
+
+ app.UseCors(x => x
+ .AllowAnyOrigin()
+ .AllowAnyMethod()
+ .AllowAnyHeader());
+
+ app.UseAuthorization();
+
+ app.MapControllers();
+
+ // STATIC FILES (UPDATES)
+ var files = new DirectoryInfo($"{Domain.Constants.Configuration.AppDirectory?.FullName}/files");
+ files.Create();
+
+ app.UseStaticFiles(new StaticFileOptions
+ {
+ FileProvider = new PhysicalFileProvider(files.FullName),
+ RequestPath = "/api/files",
+ ServeUnknownFileTypes = true
+ });
+
+ await app.RunAsync();
}
}
\ No newline at end of file
diff --git a/src/Core/Insight.Infrastructure/Constants/Appsettings.cs b/src/Core/Insight.Infrastructure/Constants/Appsettings.cs
index d85fd32..2d45d12 100644
--- a/src/Core/Insight.Infrastructure/Constants/Appsettings.cs
+++ b/src/Core/Insight.Infrastructure/Constants/Appsettings.cs
@@ -1,14 +1,13 @@
-namespace Insight.Infrastructure
-{
- public class Appsettings
- {
- public const string Database = "database";
- public const string JwtKey = "jwt.key";
- public const string JwtAudience = "jwt.audience";
- public const string JwtIssuer = "jwt.issuer";
- public const string JwtExp = "jwt.exp";
+namespace Insight.Infrastructure;
- public const string ServerHost = "server.host";
- public const string ServerPort = "server.port";
- }
+public class Appsettings
+{
+ public const string Database = "database";
+ public const string JwtKey = "jwt.key";
+ public const string JwtAudience = "jwt.audience";
+ public const string JwtIssuer = "jwt.issuer";
+ public const string JwtExp = "jwt.exp";
+
+ public const string ServerHost = "server.host";
+ public const string ServerPort = "server.port";
}
\ No newline at end of file
diff --git a/src/Core/Insight.Infrastructure/Constants/Monitoring.cs b/src/Core/Insight.Infrastructure/Constants/Monitoring.cs
index eb6c355..f88284b 100644
--- a/src/Core/Insight.Infrastructure/Constants/Monitoring.cs
+++ b/src/Core/Insight.Infrastructure/Constants/Monitoring.cs
@@ -1,8 +1,7 @@
-namespace Insight.Infrastructure
+namespace Insight.Infrastructure;
+
+public static class Monitoring
{
- public static class Monitoring
- {
- public static readonly Uri StatusUri = new("https://admin.webmatic.de/monitoring/computer/send/status");
- public static readonly Uri LogUri = new("https://admin.webmatic.de/monitoring/computer/send/log");
- }
+ public static readonly Uri StatusUri = new("https://admin.webmatic.de/monitoring/computer/send/status");
+ public static readonly Uri LogUri = new("https://admin.webmatic.de/monitoring/computer/send/log");
}
\ No newline at end of file
diff --git a/src/Core/Insight.Infrastructure/Constants/Settings.cs b/src/Core/Insight.Infrastructure/Constants/Settings.cs
index b667086..ec9bec6 100644
--- a/src/Core/Insight.Infrastructure/Constants/Settings.cs
+++ b/src/Core/Insight.Infrastructure/Constants/Settings.cs
@@ -1,7 +1,6 @@
-namespace Insight.Infrastructure
+namespace Insight.Infrastructure;
+
+public class Settings
{
- public class Settings
- {
- public const string Database = "insight";
- }
+ public const string Database = "insight";
}
\ No newline at end of file
diff --git a/src/Core/Insight.Infrastructure/Entities/Agent.cs b/src/Core/Insight.Infrastructure/Entities/Agent.cs
index d538498..1f4109e 100644
--- a/src/Core/Insight.Infrastructure/Entities/Agent.cs
+++ b/src/Core/Insight.Infrastructure/Entities/Agent.cs
@@ -3,60 +3,59 @@ using MongoDB.Bson.Serialization.Attributes;
using System.ComponentModel.DataAnnotations;
using System.Text.Json.Serialization;
-namespace Insight.Infrastructure.Entities
+namespace Insight.Infrastructure.Entities;
+
+[BsonIgnoreExtraElements]
+public class AgentEntity
{
- [BsonIgnoreExtraElements]
- public class AgentEntity
+ [BsonId, BsonRepresentation(BsonType.ObjectId), JsonPropertyName("id")]
+ public string? Id { get; set; }
+
+ [BsonElement("insert")]
+ public DateTime? Insert { get; set; }
+
+ [BsonElement("update")]
+ public DateTime? Update { get; set; }
+
+ [BsonElement("serial"), Required]
+ public string? Serial { get; set; }
+
+ [BsonElement("hostname")]
+ public string? Hostname { get; set; }
+
+ [BsonElement("version"), BsonRepresentation(BsonType.String)]
+ public Version? Version { get; set; }
+
+ [BsonElement("endpoint"), BsonRepresentation(BsonType.String)]
+ public string? Endpoint { get; set; }
+
+ [BsonElement("connected")]
+ public DateTime? Connected { get; set; }
+
+ [BsonElement("activity")]
+ public DateTime? Activity { get; set; }
+
+ [BsonElement("bytes_sent")]
+ public long SentBytes { get; set; }
+
+ [BsonElement("bytes_received")]
+ public long ReceivedBytes { get; set; }
+
+ [BsonElement("packets_sent")]
+ public long SentPackets { get; set; }
+
+ [BsonElement("packets_received")]
+ public long ReceivedPackets { get; set; }
+
+ //[BsonElement("latency")]
+ //public TimeSpan? Latency { get; set; }
+
+ [BsonIgnoreIfNull, JsonIgnore]
+ public List? Hosts { get; set; }
+
+ public bool GetOnlineState()
{
- [BsonId, BsonRepresentation(BsonType.ObjectId), JsonPropertyName("id")]
- public string? Id { get; set; }
-
- [BsonElement("insert")]
- public DateTime? Insert { get; set; }
-
- [BsonElement("update")]
- public DateTime? Update { get; set; }
-
- [BsonElement("serial"), Required]
- public string? Serial { get; set; }
-
- [BsonElement("hostname")]
- public string? Hostname { get; set; }
-
- [BsonElement("version"), BsonRepresentation(BsonType.String)]
- public Version? Version { get; set; }
-
- [BsonElement("endpoint"), BsonRepresentation(BsonType.String)]
- public string? Endpoint { get; set; }
-
- [BsonElement("connected")]
- public DateTime? Connected { get; set; }
-
- [BsonElement("activity")]
- public DateTime? Activity { get; set; }
-
- [BsonElement("bytes_sent")]
- public long SentBytes { get; set; }
-
- [BsonElement("bytes_received")]
- public long ReceivedBytes { get; set; }
-
- [BsonElement("packets_sent")]
- public long SentPackets { get; set; }
-
- [BsonElement("packets_received")]
- public long ReceivedPackets { get; set; }
-
- //[BsonElement("latency")]
- //public TimeSpan? Latency { get; set; }
-
- [BsonIgnoreIfNull, JsonIgnore]
- public List? Hosts { get; set; }
-
- public bool GetOnlineState()
- {
- if (Activity is null) return false;
- return Activity.Value.ToLocalTime().Add(TimeSpan.FromSeconds(60)).Subtract(DateTime.Now).Seconds > 0;
- }
+ if (Activity is null) return false;
+ return Activity.Value.ToLocalTime().Add(TimeSpan.FromSeconds(60)).Subtract(DateTime.Now).Seconds > 0;
}
}
\ No newline at end of file
diff --git a/src/Core/Insight.Infrastructure/Entities/AgentLog.cs b/src/Core/Insight.Infrastructure/Entities/AgentLog.cs
index 8c32884..9cbd8cb 100644
--- a/src/Core/Insight.Infrastructure/Entities/AgentLog.cs
+++ b/src/Core/Insight.Infrastructure/Entities/AgentLog.cs
@@ -2,36 +2,35 @@
using MongoDB.Bson.Serialization.Attributes;
using System.Text.Json.Serialization;
-namespace Insight.Infrastructure.Entities
+namespace Insight.Infrastructure.Entities;
+
+[BsonIgnoreExtraElements]
+public class AgentLogEntity
{
- [BsonIgnoreExtraElements]
- public class AgentLogEntity
- {
- [BsonId, BsonRepresentation(BsonType.ObjectId), JsonPropertyName("id")]
- public string? Id { get; set; }
+ [BsonId, BsonRepresentation(BsonType.ObjectId), JsonPropertyName("id")]
+ public string? Id { get; set; }
- [BsonElement("_agent"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("agent")]
- public string? Agent { get; set; }
+ [BsonElement("_agent"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("agent")]
+ public string? Agent { get; set; }
- [BsonElement("insert")]
- public DateTime? Insert { get; set; }
+ [BsonElement("insert")]
+ public DateTime? Insert { get; set; }
- [BsonElement("eventid")]
- public string? EventId { get; set; }
+ [BsonElement("eventid")]
+ public string? EventId { get; set; }
- [BsonElement("status")]
- public string? Status { get; set; }
+ [BsonElement("status")]
+ public string? Status { get; set; }
- [BsonElement("source")]
- public string? Source { get; set; }
+ [BsonElement("source")]
+ public string? Source { get; set; }
- [BsonElement("category")]
- public string? Category { get; set; }
+ [BsonElement("category")]
+ public string? Category { get; set; }
- [BsonElement("message")]
- public string? Message { get; set; }
+ [BsonElement("message")]
+ public string? Message { get; set; }
- [BsonElement("timestamp")]
- public DateTime? Timestamp { get; set; }
- }
+ [BsonElement("timestamp")]
+ public DateTime? Timestamp { get; set; }
}
\ No newline at end of file
diff --git a/src/Core/Insight.Infrastructure/Entities/Customer.cs b/src/Core/Insight.Infrastructure/Entities/Customer.cs
index 983715e..e6a23fe 100644
--- a/src/Core/Insight.Infrastructure/Entities/Customer.cs
+++ b/src/Core/Insight.Infrastructure/Entities/Customer.cs
@@ -3,27 +3,26 @@ using MongoDB.Bson.Serialization.Attributes;
using System.ComponentModel.DataAnnotations;
using System.Text.Json.Serialization;
-namespace Insight.Infrastructure.Entities
+namespace Insight.Infrastructure.Entities;
+
+[BsonIgnoreExtraElements]
+public class CustomerEntity
{
- [BsonIgnoreExtraElements]
- public class CustomerEntity
- {
- [BsonId, BsonRepresentation(BsonType.ObjectId), JsonPropertyName("id")]
- public string? Id { get; set; }
+ [BsonId, BsonRepresentation(BsonType.ObjectId), JsonPropertyName("id")]
+ public string? Id { get; set; }
- [BsonElement("insert")]
- public DateTime? Insert { get; set; }
+ [BsonElement("insert")]
+ public DateTime? Insert { get; set; }
- [BsonElement("update")]
- public DateTime? Update { get; set; }
+ [BsonElement("update")]
+ public DateTime? Update { get; set; }
- [BsonElement("name"), Required]
- public string? Name { get; set; }
+ [BsonElement("name"), Required]
+ public string? Name { get; set; }
- [BsonElement("tag")]
- public string? Tag { get; set; }
+ [BsonElement("tag")]
+ public string? Tag { get; set; }
- [BsonIgnoreIfNull, JsonIgnore]
- public List? Hosts { get; set; }
- }
+ [BsonIgnoreIfNull, JsonIgnore]
+ public List? Hosts { get; set; }
}
\ No newline at end of file
diff --git a/src/Core/Insight.Infrastructure/Entities/Host.cs b/src/Core/Insight.Infrastructure/Entities/Host.cs
index 9297e78..1766708 100644
--- a/src/Core/Insight.Infrastructure/Entities/Host.cs
+++ b/src/Core/Insight.Infrastructure/Entities/Host.cs
@@ -3,36 +3,35 @@ using MongoDB.Bson.Serialization.Attributes;
using System.ComponentModel.DataAnnotations;
using System.Text.Json.Serialization;
-namespace Insight.Infrastructure.Entities
+namespace Insight.Infrastructure.Entities;
+
+[BsonIgnoreExtraElements]
+public class HostEntity
{
- [BsonIgnoreExtraElements]
- public class HostEntity
- {
- [BsonId, BsonRepresentation(BsonType.ObjectId), JsonPropertyName("id")]
- public string? Id { get; set; }
+ [BsonId, BsonRepresentation(BsonType.ObjectId), JsonPropertyName("id")]
+ public string? Id { get; set; }
- [BsonElement("_customer"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("customer")]
- public string? Customer { get; set; }
+ [BsonElement("_customer"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("customer")]
+ public string? Customer { get; set; }
- [BsonElement("_agent"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("agent")]
- public string? Agent { get; set; }
+ [BsonElement("_agent"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("agent")]
+ public string? Agent { get; set; }
- [BsonElement("insert")]
- public DateTime? Insert { get; set; }
+ [BsonElement("insert")]
+ public DateTime? Insert { get; set; }
- [BsonElement("update")]
- public DateTime? Update { get; set; }
+ [BsonElement("update")]
+ public DateTime? Update { get; set; }
- [BsonElement("name"), Required]
- public string? Name { get; set; }
+ [BsonElement("name"), Required]
+ public string? Name { get; set; }
- [BsonElement("description")]
- public string? Description { get; set; }
+ [BsonElement("description")]
+ public string? Description { get; set; }
- [BsonIgnoreIfNull, JsonIgnore]
- public List? Customers { get; set; }
+ [BsonIgnoreIfNull, JsonIgnore]
+ public List? Customers { get; set; }
- [BsonIgnoreIfNull, JsonIgnore]
- public List? Agents { get; set; }
- }
+ [BsonIgnoreIfNull, JsonIgnore]
+ public List? Agents { get; set; }
}
\ No newline at end of file
diff --git a/src/Core/Insight.Infrastructure/Entities/HostApplication.cs b/src/Core/Insight.Infrastructure/Entities/HostApplication.cs
index 473f383..8d1b52b 100644
--- a/src/Core/Insight.Infrastructure/Entities/HostApplication.cs
+++ b/src/Core/Insight.Infrastructure/Entities/HostApplication.cs
@@ -2,39 +2,38 @@
using MongoDB.Bson.Serialization.Attributes;
using System.Text.Json.Serialization;
-namespace Insight.Infrastructure.Entities
+namespace Insight.Infrastructure.Entities;
+
+[BsonIgnoreExtraElements]
+public class HostApplicationEntity
{
- [BsonIgnoreExtraElements]
- public class HostApplicationEntity
- {
- [BsonId, BsonRepresentation(BsonType.ObjectId), JsonPropertyName("id")]
- public string? Id { get; set; }
+ [BsonId, BsonRepresentation(BsonType.ObjectId), JsonPropertyName("id")]
+ public string? Id { get; set; }
- [BsonElement("_host"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("host")]
- public string? Host { get; set; }
+ [BsonElement("_host"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("host")]
+ public string? Host { get; set; }
- [BsonElement("_batch"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("batch")]
- public string? Batch { get; set; }
+ [BsonElement("_batch"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("batch")]
+ public string? Batch { get; set; }
- [BsonElement("insert")]
- public DateTime? Insert { get; set; }
+ [BsonElement("insert")]
+ public DateTime? Insert { get; set; }
- [BsonElement("update")]
- public DateTime? Update { get; set; }
+ [BsonElement("update")]
+ public DateTime? Update { get; set; }
- [BsonElement("company")]
- public string? Company { get; set; }
+ [BsonElement("company")]
+ public string? Company { get; set; }
- [BsonElement("name")]
- public string? Name { get; set; }
+ [BsonElement("name")]
+ public string? Name { get; set; }
- [BsonElement("architecture")]
- public string? Architecture { get; set; }
+ [BsonElement("architecture")]
+ public string? Architecture { get; set; }
- [BsonElement("version")]
- public string? Version { get; set; }
+ [BsonElement("version")]
+ public string? Version { get; set; }
- [BsonElement("installdate")]
- public DateTime? InstallDate { get; set; }
- }
+ [BsonElement("installdate")]
+ public DateTime? InstallDate { get; set; }
}
\ No newline at end of file
diff --git a/src/Core/Insight.Infrastructure/Entities/HostDrive.cs b/src/Core/Insight.Infrastructure/Entities/HostDrive.cs
index f8cde99..2e77a64 100644
--- a/src/Core/Insight.Infrastructure/Entities/HostDrive.cs
+++ b/src/Core/Insight.Infrastructure/Entities/HostDrive.cs
@@ -2,51 +2,50 @@
using MongoDB.Bson.Serialization.Attributes;
using System.Text.Json.Serialization;
-namespace Insight.Infrastructure.Entities
+namespace Insight.Infrastructure.Entities;
+
+[BsonIgnoreExtraElements]
+public class HostDriveEntity
{
- [BsonIgnoreExtraElements]
- public class HostDriveEntity
- {
- [BsonId, BsonRepresentation(BsonType.ObjectId), JsonPropertyName("id")]
- public string? Id { get; set; }
+ [BsonId, BsonRepresentation(BsonType.ObjectId), JsonPropertyName("id")]
+ public string? Id { get; set; }
- [BsonElement("_host"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("host")]
- public string? Host { get; set; }
+ [BsonElement("_host"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("host")]
+ public string? Host { get; set; }
- [BsonElement("_batch"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("batch")]
- public string? Batch { get; set; }
+ [BsonElement("_batch"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("batch")]
+ public string? Batch { get; set; }
- [BsonElement("insert")]
- public DateTime? Insert { get; set; }
+ [BsonElement("insert")]
+ public DateTime? Insert { get; set; }
- [BsonElement("update")]
- public DateTime? Update { get; set; }
+ [BsonElement("update")]
+ public DateTime? Update { get; set; }
- [BsonElement("index")]
- public uint? Index { get; set; }
+ [BsonElement("index")]
+ public uint? Index { get; set; }
- [BsonElement("company")]
- public string? Company { get; set; }
+ [BsonElement("company")]
+ public string? Company { get; set; }
- [BsonElement("name")]
- public string? Name { get; set; }
+ [BsonElement("name")]
+ public string? Name { get; set; }
- [BsonElement("size")]
- public ulong? Size { get; set; }
+ [BsonElement("size")]
+ public ulong? Size { get; set; }
- [BsonElement("type")]
- public string? Type { get; set; }
+ [BsonElement("type")]
+ public string? Type { get; set; }
- [BsonElement("serial")]
- public string? Serial { get; set; }
+ [BsonElement("serial")]
+ public string? Serial { get; set; }
- [BsonElement("firmware")]
- public string? Firmware { get; set; }
+ [BsonElement("firmware")]
+ public string? Firmware { get; set; }
- [BsonElement("status")]
- public string? Status { get; set; }
+ [BsonElement("status")]
+ public string? Status { get; set; }
- [BsonElement("pnp")]
- public string? Pnp { get; set; }
- }
+ [BsonElement("pnp")]
+ public string? Pnp { get; set; }
}
\ No newline at end of file
diff --git a/src/Core/Insight.Infrastructure/Entities/HostHypervisor.cs b/src/Core/Insight.Infrastructure/Entities/HostHypervisor.cs
index a51b202..abbdf4b 100644
--- a/src/Core/Insight.Infrastructure/Entities/HostHypervisor.cs
+++ b/src/Core/Insight.Infrastructure/Entities/HostHypervisor.cs
@@ -2,187 +2,186 @@
using MongoDB.Bson.Serialization.Attributes;
using System.Text.Json.Serialization;
-namespace Insight.Infrastructure.Entities
+namespace Insight.Infrastructure.Entities;
+
+[BsonIgnoreExtraElements]
+public class HostHypervisorVirtualMaschineEntity
{
- [BsonIgnoreExtraElements]
- public class HostHypervisorVirtualMaschineEntity
- {
- [BsonId, BsonRepresentation(BsonType.ObjectId), JsonPropertyName("id")]
- public string? Id { get; set; }
+ [BsonId, BsonRepresentation(BsonType.ObjectId), JsonPropertyName("id")]
+ public string? Id { get; set; }
- [BsonElement("_host"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("host")]
- public string? Host { get; set; }
+ [BsonElement("_host"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("host")]
+ public string? Host { get; set; }
- [BsonElement("_batch"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("batch")]
- public string? Batch { get; set; }
+ [BsonElement("_batch"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("batch")]
+ public string? Batch { get; set; }
- [BsonElement("insert")]
- public DateTime? Insert { get; set; }
+ [BsonElement("insert")]
+ public DateTime? Insert { get; set; }
- [BsonElement("update")]
- public DateTime? Update { get; set; }
+ [BsonElement("update")]
+ public DateTime? Update { get; set; }
- [BsonElement("uniqueid")]
- public string? UniqueId { get; set; }
+ [BsonElement("uniqueid")]
+ public string? UniqueId { get; set; }
- [BsonElement("name")]
- public string? Name { get; set; }
+ [BsonElement("name")]
+ public string? Name { get; set; }
- [BsonElement("notes")]
- public string? Notes { get; set; }
+ [BsonElement("notes")]
+ public string? Notes { get; set; }
- [BsonElement("enabled")]
- public string? Enabled { get; set; }
+ [BsonElement("enabled")]
+ public string? Enabled { get; set; }
- [BsonElement("enabled_default")]
- public string? EnabledDefault { get; set; }
+ [BsonElement("enabled_default")]
+ public string? EnabledDefault { get; set; }
- [BsonElement("health")]
- public string? Health { get; set; }
+ [BsonElement("health")]
+ public string? Health { get; set; }
- [BsonElement("status")]
- public string? Status { get; set; }
+ [BsonElement("status")]
+ public string? Status { get; set; }
- [BsonElement("ontime")]
- public ulong? OnTime { get; set; }
+ [BsonElement("ontime")]
+ public ulong? OnTime { get; set; }
- [BsonElement("replication_state")]
- public string? ReplicationState { get; set; }
+ [BsonElement("replication_state")]
+ public string? ReplicationState { get; set; }
- [BsonElement("replication_health")]
- public string? ReplicationHealth { get; set; }
+ [BsonElement("replication_health")]
+ public string? ReplicationHealth { get; set; }
- [BsonElement("version_configuration")]
- public string? ConfigurationVersion { get; set; }
+ [BsonElement("version_configuration")]
+ public string? ConfigurationVersion { get; set; }
- [BsonElement("version_integrated_services")]
- public string? IntegrationServicesVersionState { get; set; }
+ [BsonElement("version_integrated_services")]
+ public string? IntegrationServicesVersionState { get; set; }
- [BsonElement("processid")]
- public uint? ProcessId { get; set; }
+ [BsonElement("processid")]
+ public uint? ProcessId { get; set; }
- [BsonElement("processor_count")]
- public uint? NumberOfProcessors { get; set; }
+ [BsonElement("processor_count")]
+ public uint? NumberOfProcessors { get; set; }
- [BsonElement("processor_load")]
- public uint? ProcessorLoad { get; set; }
+ [BsonElement("processor_load")]
+ public uint? ProcessorLoad { get; set; }
- [BsonElement("memory_available")]
- public int? MemoryAvailable { get; set; }
+ [BsonElement("memory_available")]
+ public int? MemoryAvailable { get; set; }
- [BsonElement("memory_usage")]
- public ulong? MemoryUsage { get; set; }
+ [BsonElement("memory_usage")]
+ public ulong? MemoryUsage { get; set; }
- [BsonElement("installdate")]
- public DateTime? InstallDate { get; set; }
+ [BsonElement("installdate")]
+ public DateTime? InstallDate { get; set; }
- [BsonElement("configuration_changed")]
- public DateTime? TimeOfLastConfigurationChange { get; set; }
+ [BsonElement("configuration_changed")]
+ public DateTime? TimeOfLastConfigurationChange { get; set; }
- [BsonElement("state_changed")]
- public DateTime? TimeOfLastStateChange { get; set; }
+ [BsonElement("state_changed")]
+ public DateTime? TimeOfLastStateChange { get; set; }
- [BsonElement("replication_last")]
- public DateTime? LastReplicationTime { get; set; }
+ [BsonElement("replication_last")]
+ public DateTime? LastReplicationTime { get; set; }
- [BsonElement("guest_os")]
- public string? Os { get; set; }
+ [BsonElement("guest_os")]
+ public string? Os { get; set; }
- [BsonIgnoreIfNull, JsonIgnore]
- public List? Configs { get; set; }
- }
+ [BsonIgnoreIfNull, JsonIgnore]
+ public List? Configs { get; set; }
+}
- [BsonIgnoreExtraElements]
- public class HostHypervisorVirtualMaschineConfigEntity
- {
- [BsonId, BsonRepresentation(BsonType.ObjectId), JsonPropertyName("id")]
- public string? Id { get; set; }
+[BsonIgnoreExtraElements]
+public class HostHypervisorVirtualMaschineConfigEntity
+{
+ [BsonId, BsonRepresentation(BsonType.ObjectId), JsonPropertyName("id")]
+ public string? Id { get; set; }
- [BsonElement("host"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("host")]
- public string? Host { get; set; }
+ [BsonElement("host"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("host")]
+ public string? Host { get; set; }
- [BsonElement("virtualmaschine"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("virtualmaschine")]
- public string? VirtualMaschine { get; set; }
+ [BsonElement("virtualmaschine"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("virtualmaschine")]
+ public string? VirtualMaschine { get; set; }
- [BsonElement("batch"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("batch")]
- public string? Batch { get; set; }
+ [BsonElement("batch"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("batch")]
+ public string? Batch { get; set; }
- [BsonElement("insert")]
- public DateTime? Insert { get; set; }
+ [BsonElement("insert")]
+ public DateTime? Insert { get; set; }
- [BsonElement("update")]
- public DateTime? Update { get; set; }
+ [BsonElement("update")]
+ public DateTime? Update { get; set; }
- [BsonElement("uniqueid")]
- public string? UniqueId { get; set; }
+ [BsonElement("uniqueid")]
+ public string? UniqueId { get; set; }
- [BsonElement("parentid")]
- public string? ParentId { get; set; }
+ [BsonElement("parentid")]
+ public string? ParentId { get; set; }
- [BsonElement("type")]
- public string? Type { get; set; }
+ [BsonElement("type")]
+ public string? Type { get; set; }
- [BsonElement("name")]
- public string? Name { get; set; }
+ [BsonElement("name")]
+ public string? Name { get; set; }
- [BsonElement("notes")]
- public string? Notes { get; set; }
+ [BsonElement("notes")]
+ public string? Notes { get; set; }
- [BsonElement("creationtime")]
- public DateTime? CreationTime { get; set; }
+ [BsonElement("creationtime")]
+ public DateTime? CreationTime { get; set; }
- [BsonElement("generation")]
- public string? Generation { get; set; }
+ [BsonElement("generation")]
+ public string? Generation { get; set; }
- [BsonElement("architecture")]
- public string? Architecture { get; set; }
+ [BsonElement("architecture")]
+ public string? Architecture { get; set; }
- [BsonElement("secureboot")]
- public bool? SecureBootEnabled { get; set; }
+ [BsonElement("secureboot")]
+ public bool? SecureBootEnabled { get; set; }
- [BsonElement("automatic_snapshot")]
- public bool? IsAutomaticSnapshot { get; set; }
+ [BsonElement("automatic_snapshot")]
+ public bool? IsAutomaticSnapshot { get; set; }
- [BsonElement("action_start")]
- public string? AutomaticStartupAction { get; set; }
+ [BsonElement("action_start")]
+ public string? AutomaticStartupAction { get; set; }
- [BsonElement("action_shutdown")]
- public string? AutomaticShutdownAction { get; set; }
+ [BsonElement("action_shutdown")]
+ public string? AutomaticShutdownAction { get; set; }
- [BsonElement("action_recovery")]
- public string? AutomaticRecoveryAction { get; set; }
+ [BsonElement("action_recovery")]
+ public string? AutomaticRecoveryAction { get; set; }
- [BsonElement("auto_snapshots")]
- public bool? AutomaticSnapshotsEnabled { get; set; }
+ [BsonElement("auto_snapshots")]
+ public bool? AutomaticSnapshotsEnabled { get; set; }
- [BsonElement("serial_mainboard")]
- public string? BaseBoardSerialNumber { get; set; }
+ [BsonElement("serial_mainboard")]
+ public string? BaseBoardSerialNumber { get; set; }
- [BsonElement("serial_bios")]
- public string? BIOSSerialNumber { get; set; }
+ [BsonElement("serial_bios")]
+ public string? BIOSSerialNumber { get; set; }
- [BsonElement("bios_guid")]
- public string? BIOSGUID { get; set; }
+ [BsonElement("bios_guid")]
+ public string? BIOSGUID { get; set; }
- [BsonElement("data_root")]
- public string? ConfigurationDataRoot { get; set; }
+ [BsonElement("data_root")]
+ public string? ConfigurationDataRoot { get; set; }
- [BsonElement("file")]
- public string? ConfigurationFile { get; set; }
+ [BsonElement("file")]
+ public string? ConfigurationFile { get; set; }
- [BsonElement("guest_data_root")]
- public string? GuestStateDataRoot { get; set; }
+ [BsonElement("guest_data_root")]
+ public string? GuestStateDataRoot { get; set; }
- [BsonElement("guest_state_file")]
- public string? GuestStateFile { get; set; }
+ [BsonElement("guest_state_file")]
+ public string? GuestStateFile { get; set; }
- [BsonElement("snapshot_data_root")]
- public string? SnapshotDataRoot { get; set; }
+ [BsonElement("snapshot_data_root")]
+ public string? SnapshotDataRoot { get; set; }
- [BsonElement("suspend_data_root")]
- public string? SuspendDataRoot { get; set; }
+ [BsonElement("suspend_data_root")]
+ public string? SuspendDataRoot { get; set; }
- [BsonElement("swap_data_root")]
- public string? SwapFileDataRoot { get; set; }
- }
+ [BsonElement("swap_data_root")]
+ public string? SwapFileDataRoot { get; set; }
}
\ No newline at end of file
diff --git a/src/Core/Insight.Infrastructure/Entities/HostInterface.cs b/src/Core/Insight.Infrastructure/Entities/HostInterface.cs
index 2b18c18..4761f12 100644
--- a/src/Core/Insight.Infrastructure/Entities/HostInterface.cs
+++ b/src/Core/Insight.Infrastructure/Entities/HostInterface.cs
@@ -2,217 +2,216 @@
using MongoDB.Bson.Serialization.Attributes;
using System.Text.Json.Serialization;
-namespace Insight.Infrastructure.Entities
+namespace Insight.Infrastructure.Entities;
+
+[BsonIgnoreExtraElements]
+public class HostInterfaceEntity
{
- [BsonIgnoreExtraElements]
- public class HostInterfaceEntity
- {
- [BsonId, BsonRepresentation(BsonType.ObjectId), JsonPropertyName("id")]
- public string? Id { get; set; }
+ [BsonId, BsonRepresentation(BsonType.ObjectId), JsonPropertyName("id")]
+ public string? Id { get; set; }
- [BsonElement("_host"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("host")]
- public string? Host { get; set; }
+ [BsonElement("_host"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("host")]
+ public string? Host { get; set; }
- [BsonElement("_batch"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("batch")]
- public string? Batch { get; set; }
+ [BsonElement("_batch"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("batch")]
+ public string? Batch { get; set; }
- [BsonElement("insert")]
- public DateTime? Insert { get; set; }
+ [BsonElement("insert")]
+ public DateTime? Insert { get; set; }
- [BsonElement("update")]
- public DateTime? Update { get; set; }
+ [BsonElement("update")]
+ public DateTime? Update { get; set; }
- [BsonElement("index")]
- public uint? Index { get; set; }
+ [BsonElement("index")]
+ public uint? Index { get; set; }
- [BsonElement("mac")]
- public string? Mac { get; set; }
+ [BsonElement("mac")]
+ public string? Mac { get; set; }
- [BsonElement("name")]
- public string? Name { get; set; }
+ [BsonElement("name")]
+ public string? Name { get; set; }
- [BsonElement("description")]
- public string? Description { get; set; }
+ [BsonElement("description")]
+ public string? Description { get; set; }
- [BsonElement("physical")]
- public bool? Physical { get; set; }
+ [BsonElement("physical")]
+ public bool? Physical { get; set; }
- [BsonElement("status")]
- public string? Status { get; set; }
+ [BsonElement("status")]
+ public string? Status { get; set; }
- [BsonElement("suffix")]
- public string? Suffix { get; set; }
+ [BsonElement("suffix")]
+ public string? Suffix { get; set; }
- [BsonElement("speed")]
- public long? Speed { get; set; }
+ [BsonElement("speed")]
+ public long? Speed { get; set; }
- [BsonElement("ipv4_mtu")]
- public long? Ipv4Mtu { get; set; }
+ [BsonElement("ipv4_mtu")]
+ public long? Ipv4Mtu { get; set; }
- [BsonElement("ipv4_dhcp")]
- public bool? Ipv4Dhcp { get; set; }
+ [BsonElement("ipv4_dhcp")]
+ public bool? Ipv4Dhcp { get; set; }
- [BsonElement("ipv4_forwarding")]
- public bool? Ipv4Forwarding { get; set; }
+ [BsonElement("ipv4_forwarding")]
+ public bool? Ipv4Forwarding { get; set; }
- [BsonElement("ipv6_mtu")]
- public long? Ipv6Mtu { get; set; }
+ [BsonElement("ipv6_mtu")]
+ public long? Ipv6Mtu { get; set; }
- [BsonElement("sent")]
- public long? Sent { get; set; }
+ [BsonElement("sent")]
+ public long? Sent { get; set; }
- [BsonElement("received")]
- public long? Received { get; set; }
+ [BsonElement("received")]
+ public long? Received { get; set; }
- [BsonElement("packets_incoming_discarded")]
- public long? IncomingPacketsDiscarded { get; set; }
+ [BsonElement("packets_incoming_discarded")]
+ public long? IncomingPacketsDiscarded { get; set; }
- [BsonElement("packets_incoming_errors")]
- public long? IncomingPacketsWithErrors { get; set; }
+ [BsonElement("packets_incoming_errors")]
+ public long? IncomingPacketsWithErrors { get; set; }
- [BsonElement("packets_incoming_unknown")]
- public long? IncomingUnknownProtocolPackets { get; set; }
+ [BsonElement("packets_incoming_unknown")]
+ public long? IncomingUnknownProtocolPackets { get; set; }
- [BsonElement("packets_outgoing_discarded")]
- public long? OutgoingPacketsDiscarded { get; set; }
+ [BsonElement("packets_outgoing_discarded")]
+ public long? OutgoingPacketsDiscarded { get; set; }
- [BsonElement("packets_outgoing_errors")]
- public long? OutgoingPacketsWithErrors { get; set; }
- }
+ [BsonElement("packets_outgoing_errors")]
+ public long? OutgoingPacketsWithErrors { get; set; }
+}
- [BsonIgnoreExtraElements]
- public class HostInterfaceAddressEntity
- {
- [BsonId, BsonRepresentation(BsonType.ObjectId), JsonPropertyName("id")]
- public string? Id { get; set; }
+[BsonIgnoreExtraElements]
+public class HostInterfaceAddressEntity
+{
+ [BsonId, BsonRepresentation(BsonType.ObjectId), JsonPropertyName("id")]
+ public string? Id { get; set; }
- [BsonElement("_host"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("host")]
- public string? Host { get; set; }
+ [BsonElement("_host"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("host")]
+ public string? Host { get; set; }
- [BsonElement("_interface"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("interface")]
- public string? Interface { get; set; }
+ [BsonElement("_interface"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("interface")]
+ public string? Interface { get; set; }
- [BsonElement("_batch"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("batch")]
- public string? Batch { get; set; }
+ [BsonElement("_batch"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("batch")]
+ public string? Batch { get; set; }
- [BsonElement("insert")]
- public DateTime? Insert { get; set; }
+ [BsonElement("insert")]
+ public DateTime? Insert { get; set; }
- [BsonElement("update")]
- public DateTime? Update { get; set; }
+ [BsonElement("update")]
+ public DateTime? Update { get; set; }
- [BsonElement("address")]
- public string? Address { get; set; }
+ [BsonElement("address")]
+ public string? Address { get; set; }
- [BsonElement("mask")]
- public string? Mask { get; set; }
+ [BsonElement("mask")]
+ public string? Mask { get; set; }
- //public string? State { get; set; }
- //public long? PreferredLifetime { get; set; }
- //public long? ValidLifetime { get; set; }
- //public long? LeaseLifetime { get; set; }
- //public int? PrefixLength { get; set; }
+ //public string? State { get; set; }
+ //public long? PreferredLifetime { get; set; }
+ //public long? ValidLifetime { get; set; }
+ //public long? LeaseLifetime { get; set; }
+ //public int? PrefixLength { get; set; }
- [BsonIgnoreIfNull, JsonIgnore]
- public List? Interfaces { get; set; }
- }
+ [BsonIgnoreIfNull, JsonIgnore]
+ public List? Interfaces { get; set; }
+}
- [BsonIgnoreExtraElements]
- public class HostInterfaceGatewayEntity
- {
- [BsonId, BsonRepresentation(BsonType.ObjectId), JsonPropertyName("id")]
- public string? Id { get; set; }
+[BsonIgnoreExtraElements]
+public class HostInterfaceGatewayEntity
+{
+ [BsonId, BsonRepresentation(BsonType.ObjectId), JsonPropertyName("id")]
+ public string? Id { get; set; }
- [BsonElement("_host"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("host")]
- public string? Host { get; set; }
+ [BsonElement("_host"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("host")]
+ public string? Host { get; set; }
- [BsonElement("_interface"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("interface")]
- public string? Interface { get; set; }
+ [BsonElement("_interface"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("interface")]
+ public string? Interface { get; set; }
- [BsonElement("_batch"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("batch")]
- public string? Batch { get; set; }
+ [BsonElement("_batch"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("batch")]
+ public string? Batch { get; set; }
- [BsonElement("insert")]
- public DateTime? Insert { get; set; }
+ [BsonElement("insert")]
+ public DateTime? Insert { get; set; }
- [BsonElement("update")]
- public DateTime? Update { get; set; }
+ [BsonElement("update")]
+ public DateTime? Update { get; set; }
- [BsonElement("address")]
- public string? Address { get; set; }
+ [BsonElement("address")]
+ public string? Address { get; set; }
- [BsonElement("mask")]
- public string? Mask { get; set; }
+ [BsonElement("mask")]
+ public string? Mask { get; set; }
- [BsonIgnoreIfNull, JsonIgnore]
- public List? Interfaces { get; set; }
- }
+ [BsonIgnoreIfNull, JsonIgnore]
+ public List? Interfaces { get; set; }
+}
- [BsonIgnoreExtraElements]
- public class HostInterfaceNameserverEntity
- {
- [BsonId, BsonRepresentation(BsonType.ObjectId), JsonPropertyName("id")]
- public string? Id { get; set; }
+[BsonIgnoreExtraElements]
+public class HostInterfaceNameserverEntity
+{
+ [BsonId, BsonRepresentation(BsonType.ObjectId), JsonPropertyName("id")]
+ public string? Id { get; set; }
- [BsonElement("_host"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("host")]
- public string? Host { get; set; }
+ [BsonElement("_host"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("host")]
+ public string? Host { get; set; }
- [BsonElement("_interface"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("interface")]
- public string? Interface { get; set; }
+ [BsonElement("_interface"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("interface")]
+ public string? Interface { get; set; }
- [BsonElement("_batch"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("batch")]
- public string? Batch { get; set; }
+ [BsonElement("_batch"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("batch")]
+ public string? Batch { get; set; }
- [BsonElement("insert")]
- public DateTime? Insert { get; set; }
+ [BsonElement("insert")]
+ public DateTime? Insert { get; set; }
- [BsonElement("update")]
- public DateTime? Update { get; set; }
+ [BsonElement("update")]
+ public DateTime? Update { get; set; }
- [BsonElement("address")]
- public string? Address { get; set; }
+ [BsonElement("address")]
+ public string? Address { get; set; }
- [BsonElement("mask")]
- public string? Mask { get; set; }
+ [BsonElement("mask")]
+ public string? Mask { get; set; }
- [BsonIgnoreIfNull, JsonIgnore]
- public List? Interfaces { get; set; }
- }
+ [BsonIgnoreIfNull, JsonIgnore]
+ public List? Interfaces { get; set; }
+}
- [BsonIgnoreExtraElements]
- public class HostInterfaceRouteEntity
- {
- [BsonId, BsonRepresentation(BsonType.ObjectId), JsonPropertyName("id")]
- public string? Id { get; set; }
+[BsonIgnoreExtraElements]
+public class HostInterfaceRouteEntity
+{
+ [BsonId, BsonRepresentation(BsonType.ObjectId), JsonPropertyName("id")]
+ public string? Id { get; set; }
- [BsonElement("_host"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("host")]
- public string? Host { get; set; }
+ [BsonElement("_host"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("host")]
+ public string? Host { get; set; }
- [BsonElement("_interface"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("interface")]
- public string? Interface { get; set; }
+ [BsonElement("_interface"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("interface")]
+ public string? Interface { get; set; }
- [BsonElement("_batch"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("batch")]
- public string? Batch { get; set; }
+ [BsonElement("_batch"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("batch")]
+ public string? Batch { get; set; }
- [BsonElement("insert")]
- public DateTime? Insert { get; set; }
+ [BsonElement("insert")]
+ public DateTime? Insert { get; set; }
- [BsonElement("update")]
- public DateTime? Update { get; set; }
+ [BsonElement("update")]
+ public DateTime? Update { get; set; }
- [BsonElement("destination")]
- public string? Destination { get; set; }
+ [BsonElement("destination")]
+ public string? Destination { get; set; }
- [BsonElement("mask")]
- public string? Mask { get; set; }
+ [BsonElement("mask")]
+ public string? Mask { get; set; }
- [BsonElement("gateway")]
- public string? Gateway { get; set; }
+ [BsonElement("gateway")]
+ public string? Gateway { get; set; }
- [BsonElement("metric")]
- public int? Metric { get; set; }
+ [BsonElement("metric")]
+ public int? Metric { get; set; }
- [BsonIgnoreIfNull, JsonIgnore]
- public List? Interfaces { get; set; }
- }
+ [BsonIgnoreIfNull, JsonIgnore]
+ public List? Interfaces { get; set; }
}
\ No newline at end of file
diff --git a/src/Core/Insight.Infrastructure/Entities/HostLog.cs b/src/Core/Insight.Infrastructure/Entities/HostLog.cs
index c6d4ae4..da1e86a 100644
--- a/src/Core/Insight.Infrastructure/Entities/HostLog.cs
+++ b/src/Core/Insight.Infrastructure/Entities/HostLog.cs
@@ -2,36 +2,35 @@
using MongoDB.Bson.Serialization.Attributes;
using System.Text.Json.Serialization;
-namespace Insight.Infrastructure.Entities
+namespace Insight.Infrastructure.Entities;
+
+[BsonIgnoreExtraElements]
+public class HostLogEntity
{
- [BsonIgnoreExtraElements]
- public class HostLogEntity
- {
- [BsonId, BsonRepresentation(BsonType.ObjectId), JsonPropertyName("id")]
- public string? Id { get; set; }
+ [BsonId, BsonRepresentation(BsonType.ObjectId), JsonPropertyName("id")]
+ public string? Id { get; set; }
- [BsonElement("_host"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("host")]
- public string? Host { get; set; }
+ [BsonElement("_host"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("host")]
+ public string? Host { get; set; }
- [BsonElement("insert")]
- public DateTime? Insert { get; set; }
+ [BsonElement("insert")]
+ public DateTime? Insert { get; set; }
- [BsonElement("eventid")]
- public string? EventId { get; set; }
+ [BsonElement("eventid")]
+ public string? EventId { get; set; }
- [BsonElement("status")]
- public string? Status { get; set; }
+ [BsonElement("status")]
+ public string? Status { get; set; }
- [BsonElement("source")]
- public string? Source { get; set; }
+ [BsonElement("source")]
+ public string? Source { get; set; }
- [BsonElement("category")]
- public string? Category { get; set; }
+ [BsonElement("category")]
+ public string? Category { get; set; }
- [BsonElement("message")]
- public string? Message { get; set; }
+ [BsonElement("message")]
+ public string? Message { get; set; }
- [BsonElement("timestamp")]
- public DateTime? Timestamp { get; set; }
- }
+ [BsonElement("timestamp")]
+ public DateTime? Timestamp { get; set; }
}
\ No newline at end of file
diff --git a/src/Core/Insight.Infrastructure/Entities/HostLogMonitoring.cs b/src/Core/Insight.Infrastructure/Entities/HostLogMonitoring.cs
index 67bf429..6b8a14f 100644
--- a/src/Core/Insight.Infrastructure/Entities/HostLogMonitoring.cs
+++ b/src/Core/Insight.Infrastructure/Entities/HostLogMonitoring.cs
@@ -2,42 +2,41 @@
using MongoDB.Bson.Serialization.Attributes;
using System.Text.Json.Serialization;
-namespace Insight.Infrastructure.Entities
+namespace Insight.Infrastructure.Entities;
+
+[BsonIgnoreExtraElements]
+public class HostLogMonitoringEntity
{
- [BsonIgnoreExtraElements]
- public class HostLogMonitoringEntity
- {
- [BsonId, BsonRepresentation(BsonType.ObjectId), JsonPropertyName("id")]
- public string? Id { get; set; }
+ [BsonId, BsonRepresentation(BsonType.ObjectId), JsonPropertyName("id")]
+ public string? Id { get; set; }
- [BsonElement("_host"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("host")]
- public string? Host { get; set; }
+ [BsonElement("_host"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("host")]
+ public string? Host { get; set; }
- [BsonElement("insert")]
- public DateTime? Insert { get; set; }
+ [BsonElement("insert")]
+ public DateTime? Insert { get; set; }
- [BsonElement("update")]
- public DateTime? Update { get; set; }
+ [BsonElement("update")]
+ public DateTime? Update { get; set; }
- [BsonElement("hostname")]
- public string? Hostname { get; set; }
+ [BsonElement("hostname")]
+ public string? Hostname { get; set; }
- [BsonElement("category")]
- public string? Category { get; set; }
+ [BsonElement("category")]
+ public string? Category { get; set; }
- [BsonElement("status")]
- public string? Status { get; set; }
+ [BsonElement("status")]
+ public string? Status { get; set; }
- [BsonElement("task")]
- public string? Task { get; set; }
+ [BsonElement("task")]
+ public string? Task { get; set; }
- [BsonElement("message")]
- public string? Message { get; set; }
+ [BsonElement("message")]
+ public string? Message { get; set; }
- [BsonElement("dispatch")]
- public string? Dispatch { get; set; }
+ [BsonElement("dispatch")]
+ public string? Dispatch { get; set; }
- [BsonElement("timestamp")]
- public DateTime? Timestamp { get; set; }
- }
+ [BsonElement("timestamp")]
+ public DateTime? Timestamp { get; set; }
}
\ No newline at end of file
diff --git a/src/Core/Insight.Infrastructure/Entities/HostMainboard.cs b/src/Core/Insight.Infrastructure/Entities/HostMainboard.cs
index f4fd655..4cd6d1a 100644
--- a/src/Core/Insight.Infrastructure/Entities/HostMainboard.cs
+++ b/src/Core/Insight.Infrastructure/Entities/HostMainboard.cs
@@ -2,39 +2,38 @@
using MongoDB.Bson.Serialization.Attributes;
using System.Text.Json.Serialization;
-namespace Insight.Infrastructure.Entities
+namespace Insight.Infrastructure.Entities;
+
+[BsonIgnoreExtraElements]
+public class HostMainboardEntity
{
- [BsonIgnoreExtraElements]
- public class HostMainboardEntity
- {
- [BsonId, BsonRepresentation(BsonType.ObjectId), JsonPropertyName("id")]
- public string? Id { get; set; }
+ [BsonId, BsonRepresentation(BsonType.ObjectId), JsonPropertyName("id")]
+ public string? Id { get; set; }
- [BsonElement("_host"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("host")]
- public string? Host { get; set; }
+ [BsonElement("_host"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("host")]
+ public string? Host { get; set; }
- [BsonElement("insert")]
- public DateTime? Insert { get; set; }
+ [BsonElement("insert")]
+ public DateTime? Insert { get; set; }
- [BsonElement("update")]
- public DateTime? Update { get; set; }
+ [BsonElement("update")]
+ public DateTime? Update { get; set; }
- [BsonElement("company")]
- public string? Company { get; set; }
+ [BsonElement("company")]
+ public string? Company { get; set; }
- [BsonElement("name")]
- public string? Name { get; set; }
+ [BsonElement("name")]
+ public string? Name { get; set; }
- [BsonElement("serial")]
- public string? Serial { get; set; }
+ [BsonElement("serial")]
+ public string? Serial { get; set; }
- [BsonElement("bios")]
- public string? Bios { get; set; }
+ [BsonElement("bios")]
+ public string? Bios { get; set; }
- [BsonElement("version")]
- public string? Version { get; set; }
+ [BsonElement("version")]
+ public string? Version { get; set; }
- [BsonElement("Date")]
- public DateTime? Date { get; set; }
- }
+ [BsonElement("Date")]
+ public DateTime? Date { get; set; }
}
\ No newline at end of file
diff --git a/src/Core/Insight.Infrastructure/Entities/HostMemory.cs b/src/Core/Insight.Infrastructure/Entities/HostMemory.cs
index 1442941..8b65ca6 100644
--- a/src/Core/Insight.Infrastructure/Entities/HostMemory.cs
+++ b/src/Core/Insight.Infrastructure/Entities/HostMemory.cs
@@ -2,57 +2,56 @@
using MongoDB.Bson.Serialization.Attributes;
using System.Text.Json.Serialization;
-namespace Insight.Infrastructure.Entities
+namespace Insight.Infrastructure.Entities;
+
+[BsonIgnoreExtraElements]
+public class HostMemoryEntity
{
- [BsonIgnoreExtraElements]
- public class HostMemoryEntity
- {
- [BsonId, BsonRepresentation(BsonType.ObjectId), JsonPropertyName("id")]
- public string? Id { get; set; }
+ [BsonId, BsonRepresentation(BsonType.ObjectId), JsonPropertyName("id")]
+ public string? Id { get; set; }
- [BsonElement("_host"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("host")]
- public string? Host { get; set; }
+ [BsonElement("_host"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("host")]
+ public string? Host { get; set; }
- [BsonElement("_batch"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("batch")]
- public string? Batch { get; set; }
+ [BsonElement("_batch"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("batch")]
+ public string? Batch { get; set; }
- [BsonElement("insert")]
- public DateTime? Insert { get; set; }
+ [BsonElement("insert")]
+ public DateTime? Insert { get; set; }
- [BsonElement("update")]
- public DateTime? Update { get; set; }
+ [BsonElement("update")]
+ public DateTime? Update { get; set; }
- [BsonElement("index")]
- public uint? Index { get; set; }
+ [BsonElement("index")]
+ public uint? Index { get; set; }
- [BsonElement("company")]
- public string? Company { get; set; }
+ [BsonElement("company")]
+ public string? Company { get; set; }
- [BsonElement("name")]
- public string? Name { get; set; }
+ [BsonElement("name")]
+ public string? Name { get; set; }
- [BsonElement("tag")]
- public string? Tag { get; set; }
+ [BsonElement("tag")]
+ public string? Tag { get; set; }
- [BsonElement("location")]
- public string? Location { get; set; }
+ [BsonElement("location")]
+ public string? Location { get; set; }
- [BsonElement("serial")]
- public string? Serial { get; set; }
+ [BsonElement("serial")]
+ public string? Serial { get; set; }
- [BsonElement("capacity")]
- public ulong? Capacity { get; set; }
+ [BsonElement("capacity")]
+ public ulong? Capacity { get; set; }
- [BsonElement("clock")]
- public uint? Clock { get; set; }
+ [BsonElement("clock")]
+ public uint? Clock { get; set; }
- [BsonElement("clock_current")]
- public uint? CurrentClock { get; set; }
+ [BsonElement("clock_current")]
+ public uint? CurrentClock { get; set; }
- [BsonElement("voltage")]
- public uint? Voltage { get; set; }
+ [BsonElement("voltage")]
+ public uint? Voltage { get; set; }
- [BsonElement("voltage_current")]
- public uint? CurrentVoltage { get; set; }
- }
+ [BsonElement("voltage_current")]
+ public uint? CurrentVoltage { get; set; }
}
\ No newline at end of file
diff --git a/src/Core/Insight.Infrastructure/Entities/HostOs.cs b/src/Core/Insight.Infrastructure/Entities/HostOs.cs
index b0e0d8f..2e37f3b 100644
--- a/src/Core/Insight.Infrastructure/Entities/HostOs.cs
+++ b/src/Core/Insight.Infrastructure/Entities/HostOs.cs
@@ -2,39 +2,38 @@
using MongoDB.Bson.Serialization.Attributes;
using System.Text.Json.Serialization;
-namespace Insight.Infrastructure.Entities
+namespace Insight.Infrastructure.Entities;
+
+[BsonIgnoreExtraElements]
+public class HostOsEntity
{
- [BsonIgnoreExtraElements]
- public class HostOsEntity
- {
- [BsonId, BsonRepresentation(BsonType.ObjectId), JsonPropertyName("id")]
- public string? Id { get; set; }
+ [BsonId, BsonRepresentation(BsonType.ObjectId), JsonPropertyName("id")]
+ public string? Id { get; set; }
- [BsonElement("_host"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("host")]
- public string? Host { get; set; }
+ [BsonElement("_host"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("host")]
+ public string? Host { get; set; }
- [BsonElement("insert")]
- public DateTime? Insert { get; set; }
+ [BsonElement("insert")]
+ public DateTime? Insert { get; set; }
- [BsonElement("update")]
- public DateTime? Update { get; set; }
+ [BsonElement("update")]
+ public DateTime? Update { get; set; }
- [BsonElement("name")]
- public string? Name { get; set; }
+ [BsonElement("name")]
+ public string? Name { get; set; }
- [BsonElement("version")]
- public string? Version { get; set; }
+ [BsonElement("version")]
+ public string? Version { get; set; }
- [BsonElement("architecture")]
- public string? Architecture { get; set; }
+ [BsonElement("architecture")]
+ public string? Architecture { get; set; }
- [BsonElement("serialnumber")]
- public string? SerialNumber { get; set; }
+ [BsonElement("serialnumber")]
+ public string? SerialNumber { get; set; }
- [BsonElement("virtual")]
- public bool? Virtual { get; set; }
+ [BsonElement("virtual")]
+ public bool? Virtual { get; set; }
- [BsonElement("installed")]
- public DateTime? Installed { get; set; }
- }
+ [BsonElement("installed")]
+ public DateTime? Installed { get; set; }
}
\ No newline at end of file
diff --git a/src/Core/Insight.Infrastructure/Entities/HostPrinter.cs b/src/Core/Insight.Infrastructure/Entities/HostPrinter.cs
index 7131499..e3b1653 100644
--- a/src/Core/Insight.Infrastructure/Entities/HostPrinter.cs
+++ b/src/Core/Insight.Infrastructure/Entities/HostPrinter.cs
@@ -2,39 +2,38 @@
using MongoDB.Bson.Serialization.Attributes;
using System.Text.Json.Serialization;
-namespace Insight.Infrastructure.Entities
+namespace Insight.Infrastructure.Entities;
+
+[BsonIgnoreExtraElements]
+public class HostPrinterEntity
{
- [BsonIgnoreExtraElements]
- public class HostPrinterEntity
- {
- [BsonId, BsonRepresentation(BsonType.ObjectId), JsonPropertyName("id")]
- public string? Id { get; set; }
+ [BsonId, BsonRepresentation(BsonType.ObjectId), JsonPropertyName("id")]
+ public string? Id { get; set; }
- [BsonElement("_host"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("host")]
- public string? Host { get; set; }
+ [BsonElement("_host"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("host")]
+ public string? Host { get; set; }
- [BsonElement("_batch"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("batch")]
- public string? Batch { get; set; }
+ [BsonElement("_batch"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("batch")]
+ public string? Batch { get; set; }
- [BsonElement("insert")]
- public DateTime? Insert { get; set; }
+ [BsonElement("insert")]
+ public DateTime? Insert { get; set; }
- [BsonElement("update")]
- public DateTime? Update { get; set; }
+ [BsonElement("update")]
+ public DateTime? Update { get; set; }
- [BsonElement("company")]
- public string? Company { get; set; }
+ [BsonElement("company")]
+ public string? Company { get; set; }
- [BsonElement("name")]
- public string? Name { get; set; }
+ [BsonElement("name")]
+ public string? Name { get; set; }
- [BsonElement("port")]
- public string? Port { get; set; }
+ [BsonElement("port")]
+ public string? Port { get; set; }
- [BsonElement("location")]
- public string? Location { get; set; }
+ [BsonElement("location")]
+ public string? Location { get; set; }
- [BsonElement("comment")]
- public string? Comment { get; set; }
- }
+ [BsonElement("comment")]
+ public string? Comment { get; set; }
}
\ No newline at end of file
diff --git a/src/Core/Insight.Infrastructure/Entities/HostProcessor.cs b/src/Core/Insight.Infrastructure/Entities/HostProcessor.cs
index 1a81ceb..8d4a7ea 100644
--- a/src/Core/Insight.Infrastructure/Entities/HostProcessor.cs
+++ b/src/Core/Insight.Infrastructure/Entities/HostProcessor.cs
@@ -2,69 +2,68 @@
using MongoDB.Bson.Serialization.Attributes;
using System.Text.Json.Serialization;
-namespace Insight.Infrastructure.Entities
+namespace Insight.Infrastructure.Entities;
+
+[BsonIgnoreExtraElements]
+public class HostProcessorEntity
{
- [BsonIgnoreExtraElements]
- public class HostProcessorEntity
- {
- [BsonId, BsonRepresentation(BsonType.ObjectId), JsonPropertyName("id")]
- public string? Id { get; set; }
+ [BsonId, BsonRepresentation(BsonType.ObjectId), JsonPropertyName("id")]
+ public string? Id { get; set; }
- [BsonElement("_host"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("host")]
- public string? Host { get; set; }
+ [BsonElement("_host"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("host")]
+ public string? Host { get; set; }
- [BsonElement("_batch"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("batch")]
- public string? Batch { get; set; }
+ [BsonElement("_batch"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("batch")]
+ public string? Batch { get; set; }
- [BsonElement("insert")]
- public DateTime? Insert { get; set; }
+ [BsonElement("insert")]
+ public DateTime? Insert { get; set; }
- [BsonElement("update")]
- public DateTime? Update { get; set; }
+ [BsonElement("update")]
+ public DateTime? Update { get; set; }
- [BsonElement("index")]
- public uint? Index { get; set; }
+ [BsonElement("index")]
+ public uint? Index { get; set; }
- [BsonElement("company")]
- public string? Company { get; set; }
+ [BsonElement("company")]
+ public string? Company { get; set; }
- [BsonElement("name")]
- public string? Name { get; set; }
+ [BsonElement("name")]
+ public string? Name { get; set; }
- [BsonElement("socket")]
- public string? Socket { get; set; }
+ [BsonElement("socket")]
+ public string? Socket { get; set; }
- [BsonElement("serial")]
- public string? Serial { get; set; }
+ [BsonElement("serial")]
+ public string? Serial { get; set; }
- [BsonElement("version")]
- public string? Version { get; set; }
+ [BsonElement("version")]
+ public string? Version { get; set; }
- [BsonElement("cores")]
- public uint? Cores { get; set; }
+ [BsonElement("cores")]
+ public uint? Cores { get; set; }
- [BsonElement("logicalcores")]
- public uint? LogicalCores { get; set; }
+ [BsonElement("logicalcores")]
+ public uint? LogicalCores { get; set; }
- [BsonElement("clock")]
- public uint? Clock { get; set; }
+ [BsonElement("clock")]
+ public uint? Clock { get; set; }
- [BsonElement("clock_current")]
- public uint? CurrentClock { get; set; }
+ [BsonElement("clock_current")]
+ public uint? CurrentClock { get; set; }
- [BsonElement("l1")]
- public uint? L1Size { get; set; }
+ [BsonElement("l1")]
+ public uint? L1Size { get; set; }
- [BsonElement("l2")]
- public uint? L2Size { get; set; }
+ [BsonElement("l2")]
+ public uint? L2Size { get; set; }
- [BsonElement("l3")]
- public uint? L3Size { get; set; }
+ [BsonElement("l3")]
+ public uint? L3Size { get; set; }
- [BsonElement("virtualization")]
- public bool? Virtualization { get; set; }
+ [BsonElement("virtualization")]
+ public bool? Virtualization { get; set; }
- [BsonElement("pnp")]
- public string? PNP { get; set; }
- }
+ [BsonElement("pnp")]
+ public string? PNP { get; set; }
}
\ No newline at end of file
diff --git a/src/Core/Insight.Infrastructure/Entities/HostService.cs b/src/Core/Insight.Infrastructure/Entities/HostService.cs
index c2e71d7..2167e53 100644
--- a/src/Core/Insight.Infrastructure/Entities/HostService.cs
+++ b/src/Core/Insight.Infrastructure/Entities/HostService.cs
@@ -2,54 +2,53 @@
using MongoDB.Bson.Serialization.Attributes;
using System.Text.Json.Serialization;
-namespace Insight.Infrastructure.Entities
+namespace Insight.Infrastructure.Entities;
+
+[BsonIgnoreExtraElements]
+public class HostServiceEntity
{
- [BsonIgnoreExtraElements]
- public class HostServiceEntity
- {
- [BsonId, BsonRepresentation(BsonType.ObjectId), JsonPropertyName("id")]
- public string? Id { get; set; }
+ [BsonId, BsonRepresentation(BsonType.ObjectId), JsonPropertyName("id")]
+ public string? Id { get; set; }
- [BsonElement("_host"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("host")]
- public string? Host { get; set; }
+ [BsonElement("_host"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("host")]
+ public string? Host { get; set; }
- [BsonElement("_batch"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("batch")]
- public string? Batch { get; set; }
+ [BsonElement("_batch"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("batch")]
+ public string? Batch { get; set; }
- [BsonElement("insert")]
- public DateTime? Insert { get; set; }
+ [BsonElement("insert")]
+ public DateTime? Insert { get; set; }
- [BsonElement("update")]
- public DateTime? Update { get; set; }
+ [BsonElement("update")]
+ public DateTime? Update { get; set; }
- [BsonElement("company")]
- public string? Company { get; set; }
+ [BsonElement("company")]
+ public string? Company { get; set; }
- [BsonElement("name")]
- public string? Name { get; set; }
+ [BsonElement("name")]
+ public string? Name { get; set; }
- [BsonElement("displayname")]
- public string? DisplayName { get; set; }
+ [BsonElement("displayname")]
+ public string? DisplayName { get; set; }
- [BsonElement("description")]
- public string? Description { get; set; }
+ [BsonElement("description")]
+ public string? Description { get; set; }
- [BsonElement("startmode")]
- public string? StartMode { get; set; }
+ [BsonElement("startmode")]
+ public string? StartMode { get; set; }
- [BsonElement("state")]
- public string? State { get; set; }
+ [BsonElement("state")]
+ public string? State { get; set; }
- [BsonElement("processid")]
- public uint? ProcessId { get; set; }
+ [BsonElement("processid")]
+ public uint? ProcessId { get; set; }
- [BsonElement("delay")]
- public bool? Delay { get; set; }
+ [BsonElement("delay")]
+ public bool? Delay { get; set; }
- [BsonElement("path")]
- public string? Path { get; set; }
+ [BsonElement("path")]
+ public string? Path { get; set; }
- [BsonElement("account")]
- public string? Account { get; set; }
- }
+ [BsonElement("account")]
+ public string? Account { get; set; }
}
\ No newline at end of file
diff --git a/src/Core/Insight.Infrastructure/Entities/HostSession.cs b/src/Core/Insight.Infrastructure/Entities/HostSession.cs
index 7c58585..6992f95 100644
--- a/src/Core/Insight.Infrastructure/Entities/HostSession.cs
+++ b/src/Core/Insight.Infrastructure/Entities/HostSession.cs
@@ -2,39 +2,38 @@
using MongoDB.Bson.Serialization.Attributes;
using System.Text.Json.Serialization;
-namespace Insight.Infrastructure.Entities
+namespace Insight.Infrastructure.Entities;
+
+[BsonIgnoreExtraElements]
+public class HostSessionEntity
{
- [BsonIgnoreExtraElements]
- public class HostSessionEntity
- {
- [BsonId, BsonRepresentation(BsonType.ObjectId), JsonPropertyName("id")]
- public string? Id { get; set; }
+ [BsonId, BsonRepresentation(BsonType.ObjectId), JsonPropertyName("id")]
+ public string? Id { get; set; }
- [BsonElement("_host"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("host")]
- public string? Host { get; set; }
+ [BsonElement("_host"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("host")]
+ public string? Host { get; set; }
- [BsonElement("_batch"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("batch")]
- public string? Batch { get; set; }
+ [BsonElement("_batch"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("batch")]
+ public string? Batch { get; set; }
- [BsonElement("insert")]
- public DateTime? Insert { get; set; }
+ [BsonElement("insert")]
+ public DateTime? Insert { get; set; }
- [BsonElement("update")]
- public DateTime? Update { get; set; }
+ [BsonElement("update")]
+ public DateTime? Update { get; set; }
- [BsonElement("sid")]
- public string? Sid { get; set; }
+ [BsonElement("sid")]
+ public string? Sid { get; set; }
- [BsonElement("user")]
- public string? User { get; set; }
+ [BsonElement("user")]
+ public string? User { get; set; }
- [BsonElement("remote")]
- public string? Remote { get; set; }
+ [BsonElement("remote")]
+ public string? Remote { get; set; }
- [BsonElement("type")]
- public string? Type { get; set; }
+ [BsonElement("type")]
+ public string? Type { get; set; }
- [BsonElement("state")]
- public string? State { get; set; }
- }
+ [BsonElement("state")]
+ public string? State { get; set; }
}
\ No newline at end of file
diff --git a/src/Core/Insight.Infrastructure/Entities/HostStoragePool.cs b/src/Core/Insight.Infrastructure/Entities/HostStoragePool.cs
index 67dd652..3fc138d 100644
--- a/src/Core/Insight.Infrastructure/Entities/HostStoragePool.cs
+++ b/src/Core/Insight.Infrastructure/Entities/HostStoragePool.cs
@@ -2,206 +2,205 @@
using MongoDB.Bson.Serialization.Attributes;
using System.Text.Json.Serialization;
-namespace Insight.Infrastructure.Entities
+namespace Insight.Infrastructure.Entities;
+
+[BsonIgnoreExtraElements]
+public class HostStoragePoolEntity
{
- [BsonIgnoreExtraElements]
- public class HostStoragePoolEntity
- {
- [BsonId, BsonRepresentation(BsonType.ObjectId), JsonPropertyName("id")]
- public string? Id { get; set; }
+ [BsonId, BsonRepresentation(BsonType.ObjectId), JsonPropertyName("id")]
+ public string? Id { get; set; }
- [BsonElement("_host"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("host")]
- public string? Host { get; set; }
+ [BsonElement("_host"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("host")]
+ public string? Host { get; set; }
- [BsonElement("_batch"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("batch")]
- public string? Batch { get; set; }
+ [BsonElement("_batch"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("batch")]
+ public string? Batch { get; set; }
- [BsonElement("insert")]
- public DateTime? Insert { get; set; }
+ [BsonElement("insert")]
+ public DateTime? Insert { get; set; }
- [BsonElement("update")]
- public DateTime? Update { get; set; }
+ [BsonElement("update")]
+ public DateTime? Update { get; set; }
- [BsonElement("uniqueid")]
- public string? UniqueId { get; set; }
+ [BsonElement("uniqueid")]
+ public string? UniqueId { get; set; }
- [BsonElement("name")]
- public string? Name { get; set; }
+ [BsonElement("name")]
+ public string? Name { get; set; }
- [BsonElement("health")]
- public string? Health { get; set; }
+ [BsonElement("health")]
+ public string? Health { get; set; }
- [BsonElement("resiliency")]
- public string? Resiliency { get; set; }
+ [BsonElement("resiliency")]
+ public string? Resiliency { get; set; }
- [BsonElement("primordial")]
- public bool? Primordial { get; set; }
+ [BsonElement("primordial")]
+ public bool? Primordial { get; set; }
- [BsonElement("readonly")]
- public bool? ReadOnly { get; set; }
+ [BsonElement("readonly")]
+ public bool? ReadOnly { get; set; }
- [BsonElement("clustered")]
- public bool? Clustered { get; set; }
+ [BsonElement("clustered")]
+ public bool? Clustered { get; set; }
- [BsonElement("size")]
- public ulong? Size { get; set; }
+ [BsonElement("size")]
+ public ulong? Size { get; set; }
- [BsonElement("size_allocated")]
- public ulong? AllocatedSize { get; set; }
+ [BsonElement("size_allocated")]
+ public ulong? AllocatedSize { get; set; }
- [BsonElement("sectorsize")]
- public ulong? SectorSize { get; set; }
+ [BsonElement("sectorsize")]
+ public ulong? SectorSize { get; set; }
- [BsonElement("states")]
- public List? States { get; set; }
+ [BsonElement("states")]
+ public List? States { get; set; }
- [BsonIgnoreIfNull, JsonIgnore]
- public List? PhysicalDisks { get; set; }
+ [BsonIgnoreIfNull, JsonIgnore]
+ public List? PhysicalDisks { get; set; }
- [BsonIgnoreIfNull, JsonIgnore]
- public List? VirtualDisks { get; set; }
- }
+ [BsonIgnoreIfNull, JsonIgnore]
+ public List? VirtualDisks { get; set; }
+}
- [BsonIgnoreExtraElements]
- public class HostStoragePoolVirtualDiskEntity
- {
- [BsonId, BsonRepresentation(BsonType.ObjectId), JsonPropertyName("id")]
- public string? Id { get; set; }
+[BsonIgnoreExtraElements]
+public class HostStoragePoolVirtualDiskEntity
+{
+ [BsonId, BsonRepresentation(BsonType.ObjectId), JsonPropertyName("id")]
+ public string? Id { get; set; }
- [BsonElement("_host"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("host")]
- public string? Host { get; set; }
+ [BsonElement("_host"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("host")]
+ public string? Host { get; set; }
- [BsonElement("_storagepool"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("storagepool")]
- public string? StoragePool { get; set; }
+ [BsonElement("_storagepool"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("storagepool")]
+ public string? StoragePool { get; set; }
- [BsonElement("_batch"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("batch")]
- public string? Batch { get; set; }
+ [BsonElement("_batch"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("batch")]
+ public string? Batch { get; set; }
- [BsonElement("insert")]
- public DateTime? Insert { get; set; }
+ [BsonElement("insert")]
+ public DateTime? Insert { get; set; }
- [BsonElement("update")]
- public DateTime? Update { get; set; }
+ [BsonElement("update")]
+ public DateTime? Update { get; set; }
- [BsonElement("uniqueid")]
- public string? UniqueId { get; set; }
+ [BsonElement("uniqueid")]
+ public string? UniqueId { get; set; }
- [BsonElement("name")]
- public string? Name { get; set; }
+ [BsonElement("name")]
+ public string? Name { get; set; }
- [BsonElement("health")]
- public string? Health { get; set; }
+ [BsonElement("health")]
+ public string? Health { get; set; }
- [BsonElement("access")]
- public string? Access { get; set; }
+ [BsonElement("access")]
+ public string? Access { get; set; }
- [BsonElement("provisioning")]
- public string? Provisioning { get; set; }
+ [BsonElement("provisioning")]
+ public string? Provisioning { get; set; }
- [BsonElement("redundancy")]
- public uint? PhysicalRedundancy { get; set; }
+ [BsonElement("redundancy")]
+ public uint? PhysicalRedundancy { get; set; }
- [BsonElement("resiliency")]
- public string? Resiliency { get; set; }
+ [BsonElement("resiliency")]
+ public string? Resiliency { get; set; }
- [BsonElement("deduplication")]
- public bool? Deduplication { get; set; }
+ [BsonElement("deduplication")]
+ public bool? Deduplication { get; set; }
- [BsonElement("snapshot")]
- public bool? Snapshot { get; set; }
+ [BsonElement("snapshot")]
+ public bool? Snapshot { get; set; }
- [BsonElement("size")]
- public ulong? Size { get; set; }
+ [BsonElement("size")]
+ public ulong? Size { get; set; }
- [BsonElement("size_allocated")]
- public ulong? AllocatedSize { get; set; }
+ [BsonElement("size_allocated")]
+ public ulong? AllocatedSize { get; set; }
- [BsonElement("footprint")]
- public ulong? Footprint { get; set; }
+ [BsonElement("footprint")]
+ public ulong? Footprint { get; set; }
- [BsonElement("cache_read_size")]
- public ulong? ReadCacheSize { get; set; }
+ [BsonElement("cache_read_size")]
+ public ulong? ReadCacheSize { get; set; }
- [BsonElement("cache_write_size")]
- public ulong? WriteCacheSize { get; set; }
+ [BsonElement("cache_write_size")]
+ public ulong? WriteCacheSize { get; set; }
- [BsonElement("states")]
- public List? States { get; set; }
- }
+ [BsonElement("states")]
+ public List? States { get; set; }
+}
- [BsonIgnoreExtraElements]
- public class HostStoragePoolPhysicalDiskEntity
- {
- [BsonId, BsonRepresentation(BsonType.ObjectId), JsonPropertyName("id")]
- public string? Id { get; set; }
+[BsonIgnoreExtraElements]
+public class HostStoragePoolPhysicalDiskEntity
+{
+ [BsonId, BsonRepresentation(BsonType.ObjectId), JsonPropertyName("id")]
+ public string? Id { get; set; }
- [BsonElement("_host"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("host")]
- public string? Host { get; set; }
+ [BsonElement("_host"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("host")]
+ public string? Host { get; set; }
- [BsonElement("_storagepool"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("storagepool")]
- public string? StoragePool { get; set; }
+ [BsonElement("_storagepool"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("storagepool")]
+ public string? StoragePool { get; set; }
- [BsonElement("_batch"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("batch")]
- public string? Batch { get; set; }
+ [BsonElement("_batch"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("batch")]
+ public string? Batch { get; set; }
- [BsonElement("insert")]
- public DateTime? Insert { get; set; }
+ [BsonElement("insert")]
+ public DateTime? Insert { get; set; }
- [BsonElement("update")]
- public DateTime? Update { get; set; }
+ [BsonElement("update")]
+ public DateTime? Update { get; set; }
- [BsonElement("uniqueid")]
- public string? UniqueId { get; set; }
+ [BsonElement("uniqueid")]
+ public string? UniqueId { get; set; }
- [BsonElement("deviceid")]
- public string? DeviceId { get; set; }
+ [BsonElement("deviceid")]
+ public string? DeviceId { get; set; }
- [BsonElement("name")]
- public string? Name { get; set; }
+ [BsonElement("name")]
+ public string? Name { get; set; }
- [BsonElement("manufacturer")]
- public string? Manufacturer { get; set; }
+ [BsonElement("manufacturer")]
+ public string? Manufacturer { get; set; }
- [BsonElement("Model")]
- public string? Model { get; set; }
+ [BsonElement("Model")]
+ public string? Model { get; set; }
- [BsonElement("media")]
- public string? Media { get; set; }
+ [BsonElement("media")]
+ public string? Media { get; set; }
- [BsonElement("bus")]
- public string? Bus { get; set; }
+ [BsonElement("bus")]
+ public string? Bus { get; set; }
- [BsonElement("health")]
- public string? Health { get; set; }
+ [BsonElement("health")]
+ public string? Health { get; set; }
- [BsonElement("usage")]
- public ushort? Usage { get; set; }
+ [BsonElement("usage")]
+ public ushort? Usage { get; set; }
- [BsonElement("location")]
- public string? Location { get; set; }
+ [BsonElement("location")]
+ public string? Location { get; set; }
- [BsonElement("serial")]
- public string? Serial { get; set; }
+ [BsonElement("serial")]
+ public string? Serial { get; set; }
- [BsonElement("firmware")]
- public string? Firmware { get; set; }
+ [BsonElement("firmware")]
+ public string? Firmware { get; set; }
- [BsonElement("size")]
- public ulong? Size { get; set; }
+ [BsonElement("size")]
+ public ulong? Size { get; set; }
- [BsonElement("size_allocated")]
- public ulong? AllocatedSize { get; set; }
+ [BsonElement("size_allocated")]
+ public ulong? AllocatedSize { get; set; }
- [BsonElement("footprint")]
- public ulong? Footprint { get; set; }
+ [BsonElement("footprint")]
+ public ulong? Footprint { get; set; }
- [BsonElement("sector_size_physical")]
- public ulong? PhysicalSectorSize { get; set; }
+ [BsonElement("sector_size_physical")]
+ public ulong? PhysicalSectorSize { get; set; }
- [BsonElement("sector_size_logical")]
- public ulong? LogicalSectorSize { get; set; }
+ [BsonElement("sector_size_logical")]
+ public ulong? LogicalSectorSize { get; set; }
- [BsonElement("states")]
- public List? States { get; set; }
- }
+ [BsonElement("states")]
+ public List? States { get; set; }
}
\ No newline at end of file
diff --git a/src/Core/Insight.Infrastructure/Entities/HostSystem.cs b/src/Core/Insight.Infrastructure/Entities/HostSystem.cs
index 7cea81e..f6a1e0d 100644
--- a/src/Core/Insight.Infrastructure/Entities/HostSystem.cs
+++ b/src/Core/Insight.Infrastructure/Entities/HostSystem.cs
@@ -2,33 +2,32 @@
using MongoDB.Bson.Serialization.Attributes;
using System.Text.Json.Serialization;
-namespace Insight.Infrastructure.Entities
+namespace Insight.Infrastructure.Entities;
+
+[BsonIgnoreExtraElements]
+public class HostSystemEntity
{
- [BsonIgnoreExtraElements]
- public class HostSystemEntity
- {
- [BsonId, BsonRepresentation(BsonType.ObjectId), JsonPropertyName("id")]
- public string? Id { get; set; }
+ [BsonId, BsonRepresentation(BsonType.ObjectId), JsonPropertyName("id")]
+ public string? Id { get; set; }
- [BsonElement("_host"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("host")]
- public string? Host { get; set; }
+ [BsonElement("_host"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("host")]
+ public string? Host { get; set; }
- [BsonElement("insert")]
- public DateTime? Insert { get; set; }
+ [BsonElement("insert")]
+ public DateTime? Insert { get; set; }
- [BsonElement("update")]
- public DateTime? Update { get; set; }
+ [BsonElement("update")]
+ public DateTime? Update { get; set; }
- [BsonElement("localtime")]
- public DateTime? LocalTime { get; set; }
+ [BsonElement("localtime")]
+ public DateTime? LocalTime { get; set; }
- [BsonElement("bootuptime")]
- public DateTime? BootUpTime { get; set; }
+ [BsonElement("bootuptime")]
+ public DateTime? BootUpTime { get; set; }
- [BsonElement("processes")]
- public uint? Processes { get; set; }
+ [BsonElement("processes")]
+ public uint? Processes { get; set; }
- [BsonElement("license")]
- public string? License { get; set; }
- }
+ [BsonElement("license")]
+ public string? License { get; set; }
}
\ No newline at end of file
diff --git a/src/Core/Insight.Infrastructure/Entities/HostUpdate.cs b/src/Core/Insight.Infrastructure/Entities/HostUpdate.cs
index 2e2e545..4b7b243 100644
--- a/src/Core/Insight.Infrastructure/Entities/HostUpdate.cs
+++ b/src/Core/Insight.Infrastructure/Entities/HostUpdate.cs
@@ -2,60 +2,59 @@
using MongoDB.Bson.Serialization.Attributes;
using System.Text.Json.Serialization;
-namespace Insight.Infrastructure.Entities
+namespace Insight.Infrastructure.Entities;
+
+[BsonIgnoreExtraElements]
+public class HostUpdateEntity
{
- [BsonIgnoreExtraElements]
- public class HostUpdateEntity
- {
- [BsonId, BsonRepresentation(BsonType.ObjectId), JsonPropertyName("id")]
- public string? Id { get; set; }
+ [BsonId, BsonRepresentation(BsonType.ObjectId), JsonPropertyName("id")]
+ public string? Id { get; set; }
- [BsonElement("_host"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("host")]
- public string? Host { get; set; }
+ [BsonElement("_host"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("host")]
+ public string? Host { get; set; }
- [BsonElement("_batch"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("batch")]
- public string? Batch { get; set; }
+ [BsonElement("_batch"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("batch")]
+ public string? Batch { get; set; }
- [BsonElement("insert")]
- public DateTime? Insert { get; set; }
+ [BsonElement("insert")]
+ public DateTime? Insert { get; set; }
- [BsonElement("update")]
- public DateTime? Update { get; set; }
+ [BsonElement("update")]
+ public DateTime? Update { get; set; }
- [BsonElement("name")]
- public string? Name { get; set; }
+ [BsonElement("name")]
+ public string? Name { get; set; }
- [BsonElement("serial")]
- public string? Serial { get; set; } // os update id
+ [BsonElement("serial")]
+ public string? Serial { get; set; } // os update id
- [BsonElement("description")]
- public string? Description { get; set; }
+ [BsonElement("description")]
+ public string? Description { get; set; }
- [BsonElement("supporturl")]
- public string? SupportUrl { get; set; }
+ [BsonElement("supporturl")]
+ public string? SupportUrl { get; set; }
- [BsonElement("date")]
- public DateTime? Date { get; set; }
+ [BsonElement("date")]
+ public DateTime? Date { get; set; }
- [BsonElement("pending")]
- public bool? Pending { get; set; }
+ [BsonElement("pending")]
+ public bool? Pending { get; set; }
- [BsonElement("result"), BsonIgnoreIfNull] // installed only
- public string? Result { get; set; }
+ [BsonElement("result"), BsonIgnoreIfNull] // installed only
+ public string? Result { get; set; }
- [BsonElement("type"), BsonIgnoreIfNull] // pending only
- public string? Type { get; set; }
+ [BsonElement("type"), BsonIgnoreIfNull] // pending only
+ public string? Type { get; set; }
- [BsonElement("size"), BsonIgnoreIfNull] // pending only
- public decimal? Size { get; set; }
+ [BsonElement("size"), BsonIgnoreIfNull] // pending only
+ public decimal? Size { get; set; }
- [BsonElement("downloaded"), BsonIgnoreIfNull] // pending only
- public bool? IsDownloaded { get; set; }
+ [BsonElement("downloaded"), BsonIgnoreIfNull] // pending only
+ public bool? IsDownloaded { get; set; }
- [BsonElement("inputrequest"), BsonIgnoreIfNull] // pending only
- public bool? CanRequestUserInput { get; set; }
+ [BsonElement("inputrequest"), BsonIgnoreIfNull] // pending only
+ public bool? CanRequestUserInput { get; set; }
- [BsonElement("reboot"), BsonIgnoreIfNull] // pending only
- public string? RebootBehavior { get; set; }
- }
+ [BsonElement("reboot"), BsonIgnoreIfNull] // pending only
+ public string? RebootBehavior { get; set; }
}
\ No newline at end of file
diff --git a/src/Core/Insight.Infrastructure/Entities/HostUser.cs b/src/Core/Insight.Infrastructure/Entities/HostUser.cs
index 7ef4201..95670f8 100644
--- a/src/Core/Insight.Infrastructure/Entities/HostUser.cs
+++ b/src/Core/Insight.Infrastructure/Entities/HostUser.cs
@@ -2,119 +2,118 @@
using MongoDB.Bson.Serialization.Attributes;
using System.Text.Json.Serialization;
-namespace Insight.Infrastructure.Entities
+namespace Insight.Infrastructure.Entities;
+
+[BsonIgnoreExtraElements]
+public class HostUserEntity
{
- [BsonIgnoreExtraElements]
- public class HostUserEntity
- {
- [BsonId, BsonRepresentation(BsonType.ObjectId), JsonPropertyName("id")]
- public string? Id { get; set; }
+ [BsonId, BsonRepresentation(BsonType.ObjectId), JsonPropertyName("id")]
+ public string? Id { get; set; }
- [BsonElement("_host"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("host")]
- public string? Host { get; set; }
+ [BsonElement("_host"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("host")]
+ public string? Host { get; set; }
- [BsonElement("_batch"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("batch")]
- public string? Batch { get; set; }
+ [BsonElement("_batch"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("batch")]
+ public string? Batch { get; set; }
- [BsonElement("insert")]
- public DateTime? Insert { get; set; }
+ [BsonElement("insert")]
+ public DateTime? Insert { get; set; }
- [BsonElement("update")]
- public DateTime? Update { get; set; }
+ [BsonElement("update")]
+ public DateTime? Update { get; set; }
- [BsonElement("sid")]
- public string? Sid { get; set; }
+ [BsonElement("sid")]
+ public string? Sid { get; set; }
- [BsonElement("name")]
- public string? Name { get; set; }
+ [BsonElement("name")]
+ public string? Name { get; set; }
- [BsonElement("domain")]
- public string? Domain { get; set; }
+ [BsonElement("domain")]
+ public string? Domain { get; set; }
- [BsonElement("fullname")]
- public string? FullName { get; set; }
+ [BsonElement("fullname")]
+ public string? FullName { get; set; }
- [BsonElement("description")]
- public string? Description { get; set; }
+ [BsonElement("description")]
+ public string? Description { get; set; }
- [BsonElement("status")]
- public string? Status { get; set; }
+ [BsonElement("status")]
+ public string? Status { get; set; }
- [BsonElement("localaccount")]
- public bool? LocalAccount { get; set; }
+ [BsonElement("localaccount")]
+ public bool? LocalAccount { get; set; }
- [BsonElement("disabled")]
- public bool? Disabled { get; set; }
+ [BsonElement("disabled")]
+ public bool? Disabled { get; set; }
- [BsonElement("lockout")]
- public bool? Lockout { get; set; }
+ [BsonElement("lockout")]
+ public bool? Lockout { get; set; }
- [BsonElement("password_changeable")]
- public bool? PasswordChangeable { get; set; }
+ [BsonElement("password_changeable")]
+ public bool? PasswordChangeable { get; set; }
- [BsonElement("password_expires")]
- public bool? PasswordExpires { get; set; }
+ [BsonElement("password_expires")]
+ public bool? PasswordExpires { get; set; }
- [BsonElement("password_required")]
- public bool? PasswordRequired { get; set; }
- }
+ [BsonElement("password_required")]
+ public bool? PasswordRequired { get; set; }
+}
- [BsonIgnoreExtraElements]
- public class HostGroupEntity
- {
- [BsonId, BsonRepresentation(BsonType.ObjectId), JsonPropertyName("id")]
- public string? Id { get; set; }
+[BsonIgnoreExtraElements]
+public class HostGroupEntity
+{
+ [BsonId, BsonRepresentation(BsonType.ObjectId), JsonPropertyName("id")]
+ public string? Id { get; set; }
- [BsonElement("_host"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("host")]
- public string? Host { get; set; }
+ [BsonElement("_host"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("host")]
+ public string? Host { get; set; }
- [BsonElement("_batch"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("batch")]
- public string? Batch { get; set; }
+ [BsonElement("_batch"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("batch")]
+ public string? Batch { get; set; }
- [BsonElement("insert")]
- public DateTime? Insert { get; set; }
+ [BsonElement("insert")]
+ public DateTime? Insert { get; set; }
- [BsonElement("update")]
- public DateTime? Update { get; set; }
+ [BsonElement("update")]
+ public DateTime? Update { get; set; }
- [BsonElement("sid")]
- public string? Sid { get; set; }
+ [BsonElement("sid")]
+ public string? Sid { get; set; }
- [BsonElement("name")]
- public string? Name { get; set; }
+ [BsonElement("name")]
+ public string? Name { get; set; }
- [BsonElement("domain")]
- public string? Domain { get; set; }
+ [BsonElement("domain")]
+ public string? Domain { get; set; }
- [BsonElement("description")]
- public string? Description { get; set; }
+ [BsonElement("description")]
+ public string? Description { get; set; }
- [BsonElement("localaccount")]
- public bool? LocalAccount { get; set; }
- }
+ [BsonElement("localaccount")]
+ public bool? LocalAccount { get; set; }
+}
- [BsonIgnoreExtraElements]
- public class HostUserGroupEntity
- {
- [BsonId, BsonRepresentation(BsonType.ObjectId), JsonPropertyName("id")]
- public string? Id { get; set; }
+[BsonIgnoreExtraElements]
+public class HostUserGroupEntity
+{
+ [BsonId, BsonRepresentation(BsonType.ObjectId), JsonPropertyName("id")]
+ public string? Id { get; set; }
- [BsonElement("_host"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("host")]
- public string? Host { get; set; }
+ [BsonElement("_host"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("host")]
+ public string? Host { get; set; }
- [BsonElement("_user"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("user")]
- public string? User { get; set; }
+ [BsonElement("_user"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("user")]
+ public string? User { get; set; }
- [BsonElement("_group"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("group")]
- public string? Group { get; set; }
+ [BsonElement("_group"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("group")]
+ public string? Group { get; set; }
- [BsonElement("_batch"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("batch")]
- public string? Batch { get; set; }
+ [BsonElement("_batch"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("batch")]
+ public string? Batch { get; set; }
- [BsonElement("insert")]
- public DateTime? Insert { get; set; }
+ [BsonElement("insert")]
+ public DateTime? Insert { get; set; }
- [BsonElement("update")]
- public DateTime? Update { get; set; }
- }
+ [BsonElement("update")]
+ public DateTime? Update { get; set; }
}
\ No newline at end of file
diff --git a/src/Core/Insight.Infrastructure/Entities/HostVideocard.cs b/src/Core/Insight.Infrastructure/Entities/HostVideocard.cs
index a2552a9..da9fb62 100644
--- a/src/Core/Insight.Infrastructure/Entities/HostVideocard.cs
+++ b/src/Core/Insight.Infrastructure/Entities/HostVideocard.cs
@@ -2,39 +2,38 @@
using MongoDB.Bson.Serialization.Attributes;
using System.Text.Json.Serialization;
-namespace Insight.Infrastructure.Entities
+namespace Insight.Infrastructure.Entities;
+
+[BsonIgnoreExtraElements]
+public class HostVideocardEntity
{
- [BsonIgnoreExtraElements]
- public class HostVideocardEntity
- {
- [BsonId, BsonRepresentation(BsonType.ObjectId), JsonPropertyName("id")]
- public string? Id { get; set; }
+ [BsonId, BsonRepresentation(BsonType.ObjectId), JsonPropertyName("id")]
+ public string? Id { get; set; }
- [BsonElement("_host"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("host")]
- public string? Host { get; set; }
+ [BsonElement("_host"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("host")]
+ public string? Host { get; set; }
- [BsonElement("_batch"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("batch")]
- public string? Batch { get; set; }
+ [BsonElement("_batch"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("batch")]
+ public string? Batch { get; set; }
- [BsonElement("insert")]
- public DateTime? Insert { get; set; }
+ [BsonElement("insert")]
+ public DateTime? Insert { get; set; }
- [BsonElement("update")]
- public DateTime? Update { get; set; }
+ [BsonElement("update")]
+ public DateTime? Update { get; set; }
- [BsonElement("company")]
- public string? Company { get; set; }
+ [BsonElement("company")]
+ public string? Company { get; set; }
- [BsonElement("name")]
- public string? Name { get; set; }
+ [BsonElement("name")]
+ public string? Name { get; set; }
- [BsonElement("memory")]
- public ulong? Memory { get; set; }
+ [BsonElement("memory")]
+ public ulong? Memory { get; set; }
- [BsonElement("driver")]
- public string? Driver { get; set; }
+ [BsonElement("driver")]
+ public string? Driver { get; set; }
- [BsonElement("date")]
- public DateTime? Date { get; set; }
- }
+ [BsonElement("date")]
+ public DateTime? Date { get; set; }
}
\ No newline at end of file
diff --git a/src/Core/Insight.Infrastructure/Entities/HostVolume.cs b/src/Core/Insight.Infrastructure/Entities/HostVolume.cs
index 00c19df..21f5dfb 100644
--- a/src/Core/Insight.Infrastructure/Entities/HostVolume.cs
+++ b/src/Core/Insight.Infrastructure/Entities/HostVolume.cs
@@ -2,75 +2,74 @@
using MongoDB.Bson.Serialization.Attributes;
using System.Text.Json.Serialization;
-namespace Insight.Infrastructure.Entities
+namespace Insight.Infrastructure.Entities;
+
+[BsonIgnoreExtraElements]
+public class HostVolumeEntity
{
- [BsonIgnoreExtraElements]
- public class HostVolumeEntity
- {
- [BsonId, BsonRepresentation(BsonType.ObjectId), JsonPropertyName("id")]
- public string? Id { get; set; }
+ [BsonId, BsonRepresentation(BsonType.ObjectId), JsonPropertyName("id")]
+ public string? Id { get; set; }
- [BsonElement("_host"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("host")]
- public string? Host { get; set; }
+ [BsonElement("_host"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("host")]
+ public string? Host { get; set; }
- [BsonElement("_drive"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("drive")]
- public string? Drive { get; set; }
+ [BsonElement("_drive"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("drive")]
+ public string? Drive { get; set; }
- [BsonElement("_batch"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("batch")]
- public string? Batch { get; set; }
+ [BsonElement("_batch"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("batch")]
+ public string? Batch { get; set; }
- [BsonElement("insert")]
- public DateTime? Insert { get; set; }
+ [BsonElement("insert")]
+ public DateTime? Insert { get; set; }
- [BsonElement("update")]
- public DateTime? Update { get; set; }
+ [BsonElement("update")]
+ public DateTime? Update { get; set; }
- [BsonElement("index")]
- public uint? Index { get; set; }
+ [BsonElement("index")]
+ public uint? Index { get; set; }
- [BsonElement("label")]
- public string? Label { get; set; }
+ [BsonElement("label")]
+ public string? Label { get; set; }
- [BsonElement("name")]
- public string? Name { get; set; }
+ [BsonElement("name")]
+ public string? Name { get; set; }
- [BsonElement("serial")]
- public string? Serial { get; set; }
+ [BsonElement("serial")]
+ public string? Serial { get; set; }
- [BsonElement("size")]
- public ulong? Size { get; set; }
+ [BsonElement("size")]
+ public ulong? Size { get; set; }
- [BsonElement("freespace")]
- public ulong? FreeSpace { get; set; }
+ [BsonElement("freespace")]
+ public ulong? FreeSpace { get; set; }
- [BsonElement("type")]
- public string? Type { get; set; }
+ [BsonElement("type")]
+ public string? Type { get; set; }
- [BsonElement("filesystem")]
- public string? FileSystem { get; set; }
+ [BsonElement("filesystem")]
+ public string? FileSystem { get; set; }
- [BsonElement("compressed")]
- public bool? Compressed { get; set; }
+ [BsonElement("compressed")]
+ public bool? Compressed { get; set; }
- [BsonElement("bootable")]
- public bool? Bootable { get; set; }
+ [BsonElement("bootable")]
+ public bool? Bootable { get; set; }
- [BsonElement("primary")]
- public bool? Primary { get; set; }
+ [BsonElement("primary")]
+ public bool? Primary { get; set; }
- [BsonElement("boot")]
- public bool? Boot { get; set; }
+ [BsonElement("boot")]
+ public bool? Boot { get; set; }
- [BsonElement("blocksize")]
- public ulong? BlockSize { get; set; }
+ [BsonElement("blocksize")]
+ public ulong? BlockSize { get; set; }
- [BsonElement("blocks")]
- public ulong? Blocks { get; set; }
+ [BsonElement("blocks")]
+ public ulong? Blocks { get; set; }
- [BsonElement("startoffset")]
- public ulong? StartingOffset { get; set; }
+ [BsonElement("startoffset")]
+ public ulong? StartingOffset { get; set; }
- [BsonElement("provider")]
- public string? Provider { get; set; }
- }
+ [BsonElement("provider")]
+ public string? Provider { get; set; }
}
\ No newline at end of file
diff --git a/src/Core/Insight.Infrastructure/Entities/Identity.cs b/src/Core/Insight.Infrastructure/Entities/Identity.cs
index 9827a9b..732a69d 100644
--- a/src/Core/Insight.Infrastructure/Entities/Identity.cs
+++ b/src/Core/Insight.Infrastructure/Entities/Identity.cs
@@ -4,96 +4,92 @@ using MongoDB.Bson.Serialization.Attributes;
using MongoDbGenericRepository.Attributes;
using System.Text.Json.Serialization;
-namespace Insight.Infrastructure.Entities
+namespace Insight.Infrastructure.Entities;
+
+[CollectionName("user"), BsonIgnoreExtraElements]
+public class InsightUser : MongoIdentityUser
{
- [CollectionName("user"), BsonIgnoreExtraElements]
- public class InsightUser : MongoIdentityUser
- {
- public InsightUser() : base() { }
+ public InsightUser() : base() { }
- public InsightUser(string userName, string email) : base(userName, email) { }
+ public InsightUser(string userName, string email) : base(userName, email) { }
- [JsonPropertyName("refresh_tokens")]
- public List? RefreshTokens { get; set; }
- }
+ [JsonPropertyName("refresh_tokens")]
+ public List? RefreshTokens { get; set; }
+}
- [BsonIgnoreExtraElements]
- public class InsightUserLogEntity
- {
- [BsonId, BsonRepresentation(BsonType.ObjectId), JsonPropertyName("id")]
- public string? Id { get; set; }
+[BsonIgnoreExtraElements]
+public class InsightUserLogEntity
+{
+ [BsonId, BsonRepresentation(BsonType.ObjectId), JsonPropertyName("id")]
+ public string? Id { get; set; }
- [BsonElement("_user"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("user")]
- public string? User { get; set; }
+ [BsonElement("_user"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("user")]
+ public string? User { get; set; }
- [BsonElement("insert")]
- public DateTime? Insert { get; set; }
+ [BsonElement("insert")]
+ public DateTime? Insert { get; set; }
- [BsonElement("timestamp")]
- public DateTime? Timestamp { get; set; }
+ [BsonElement("timestamp")]
+ public DateTime? Timestamp { get; set; }
- [BsonElement("message")]
- public string? Message { get; set; }
- }
+ [BsonElement("message")]
+ public string? Message { get; set; }
+}
- [CollectionName("user_pref"), BsonIgnoreExtraElements]
- public class InsightUserPreferences
- {
- [BsonId, BsonRepresentation(BsonType.ObjectId), JsonPropertyName("id")]
- public string? Id { get; set; }
+[CollectionName("user_pref"), BsonIgnoreExtraElements]
+public class InsightUserPreferences
+{
+ [BsonId, BsonRepresentation(BsonType.ObjectId), JsonPropertyName("id")]
+ public string? Id { get; set; }
- [BsonElement("_user"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("user")]
- public string? User { get; set; }
+ [BsonElement("_user"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("user")]
+ public string? User { get; set; }
- [BsonElement("insert")]
- public DateTime? Insert { get; set; }
+ [BsonElement("insert")]
+ public DateTime? Insert { get; set; }
- [BsonElement("update")]
- public DateTime? Update { get; set; }
+ [BsonElement("update")]
+ public DateTime? Update { get; set; }
+ [BsonElement("darkmode")]
+ public bool DarkMode { get; set; }
+}
- [BsonElement("darkmode")]
- public bool DarkMode { get; set; }
- }
+[CollectionName("role")]
+public class InsightRole : MongoIdentityRole
+{
- [CollectionName("role")]
- public class InsightRole : MongoIdentityRole
- {
- public InsightRole() : base() { }
+}
- public InsightRole(string roleName) : base(roleName) { }
- }
+[BsonIgnoreExtraElements]
+public class RefreshToken
+{
+ [BsonElement("token")]
+ public string? Token { get; set; }
- [BsonIgnoreExtraElements]
- public class RefreshToken
- {
- [BsonElement("token")]
- public string? Token { get; set; }
+ [BsonElement("created")]
+ public DateTime Created { get; set; }
- [BsonElement("created")]
- public DateTime Created { get; set; }
+ [BsonElement("created_ip")]
+ public string? CreatedByIp { get; set; }
- [BsonElement("created_ip")]
- public string? CreatedByIp { get; set; }
+ [BsonElement("expires")]
+ public DateTime Expires { get; set; }
- [BsonElement("expires")]
- public DateTime Expires { get; set; }
+ [BsonElement("revoked")]
+ public DateTime? Revoked { get; set; }
- [BsonElement("revoked")]
- public DateTime? Revoked { get; set; }
+ [BsonElement("revoked_ip")]
+ public string? RevokedByIp { get; set; }
- [BsonElement("revoked_ip")]
- public string? RevokedByIp { get; set; }
+ [BsonElement("revoked_reason")]
+ public string? ReasonRevoked { get; set; }
- [BsonElement("revoked_reason")]
- public string? ReasonRevoked { get; set; }
+ [BsonIgnore, JsonIgnore]
+ public bool IsExpired => DateTime.Now >= Expires.ToLocalTime();
- [BsonIgnore, JsonIgnore]
- public bool IsExpired => DateTime.Now >= Expires.ToLocalTime();
+ [BsonIgnore, JsonIgnore]
+ public bool IsRevoked => Revoked != null;
- [BsonIgnore, JsonIgnore]
- public bool IsRevoked => Revoked != null;
-
- [BsonIgnore, JsonIgnore]
- public bool IsActive => !IsRevoked && !IsExpired;
- }
+ [BsonIgnore, JsonIgnore]
+ public bool IsActive => !IsRevoked && !IsExpired;
}
\ No newline at end of file
diff --git a/src/Core/Insight.Infrastructure/Extensions/HttpRequestExtensions.cs b/src/Core/Insight.Infrastructure/Extensions/HttpRequestExtensions.cs
index 27d0cb9..7d6ca72 100644
--- a/src/Core/Insight.Infrastructure/Extensions/HttpRequestExtensions.cs
+++ b/src/Core/Insight.Infrastructure/Extensions/HttpRequestExtensions.cs
@@ -2,46 +2,45 @@
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Http.Extensions;
-namespace Insight.Infrastructure
+namespace Insight.Infrastructure;
+
+public static class HttpRequestExtensions
{
- public static class HttpRequestExtensions
+ public static void AddPagination(this HttpRequest request, PagedList pagelist)
{
- public static void AddPagination(this HttpRequest request, PagedList pagelist)
+ var builder = new QueryBuilder();
+
+ foreach (var item in request.Query.Where(p => p.Key.ToLower() != "limit" || p.Key.ToLower() != "offset"))
{
- var builder = new QueryBuilder();
+ builder.Add(item.Key.ToLower(), item.Value.ToString());
+ }
- foreach (var item in request.Query.Where(p => p.Key.ToLower() != "limit" || p.Key.ToLower() != "offset"))
+ builder.Add("limit", pagelist.Meta.Limit.ToString());
+
+ if (pagelist.Meta.Offset > 0)
+ {
+ var qb = new QueryBuilder(builder);
+
+ if (pagelist.Meta.Offset > pagelist.Meta.Limit)
{
- builder.Add(item.Key.ToLower(), item.Value.ToString());
+ qb.Add("offset", (pagelist.Meta.Offset - pagelist.Meta.Limit).ToString());
+ }
+ else
+ {
+ qb.Add("offset", 0.ToString());
}
- builder.Add("limit", pagelist.Meta.Limit.ToString());
+ pagelist.Meta.Previous = $"{request.Scheme}://{request.Host}{request.PathBase}{request.Path}{qb}";
+ }
- if (pagelist.Meta.Offset > 0)
+ if ((pagelist.Meta.Offset + pagelist.Meta.Count) < pagelist.Meta.Total)
+ {
+ var qb = new QueryBuilder(builder)
{
- var qb = new QueryBuilder(builder);
+ { "offset", (pagelist.Meta.Offset + pagelist.Meta.Count).ToString() }
+ };
- if (pagelist.Meta.Offset > pagelist.Meta.Limit)
- {
- qb.Add("offset", (pagelist.Meta.Offset - pagelist.Meta.Limit).ToString());
- }
- else
- {
- qb.Add("offset", 0.ToString());
- }
-
- pagelist.Meta.Previous = $"{request.Scheme}://{request.Host}{request.PathBase}{request.Path}{qb}";
- }
-
- if ((pagelist.Meta.Offset + pagelist.Meta.Count) < pagelist.Meta.Total)
- {
- var qb = new QueryBuilder(builder)
- {
- { "offset", (pagelist.Meta.Offset + pagelist.Meta.Count).ToString() }
- };
-
- pagelist.Meta.Next = $"{request.Scheme}://{request.Host}{request.PathBase}{request.Path}{qb}";
- }
+ pagelist.Meta.Next = $"{request.Scheme}://{request.Host}{request.PathBase}{request.Path}{qb}";
}
}
}
\ No newline at end of file
diff --git a/src/Core/Insight.Infrastructure/Extensions/HttpResponseExtensions.cs b/src/Core/Insight.Infrastructure/Extensions/HttpResponseExtensions.cs
index 6bb788d..cf4d828 100644
--- a/src/Core/Insight.Infrastructure/Extensions/HttpResponseExtensions.cs
+++ b/src/Core/Insight.Infrastructure/Extensions/HttpResponseExtensions.cs
@@ -2,16 +2,15 @@
using Microsoft.AspNetCore.Http;
using System.Text.Json;
-namespace Insight.Infrastructure
+namespace Insight.Infrastructure;
+
+public static class HttpResponseExtensions
{
- public static class HttpResponseExtensions
+ public static void AddPagination(this HttpResponse response, PagedList pagelist)
{
- public static void AddPagination(this HttpResponse response, PagedList pagelist)
+ response.Headers.Add("X-Pagination", JsonSerializer.Serialize(pagelist.Meta as PagedHeaderData, new JsonSerializerOptions
{
- response.Headers.Add("X-Pagination", JsonSerializer.Serialize(pagelist.Meta as PagedHeaderData, new JsonSerializerOptions
- {
- PropertyNamingPolicy = JsonNamingPolicy.CamelCase
- }));
- }
+ PropertyNamingPolicy = JsonNamingPolicy.CamelCase
+ }));
}
}
\ No newline at end of file
diff --git a/src/Core/Insight.Infrastructure/Extensions/MongoCollectionExtensions.cs b/src/Core/Insight.Infrastructure/Extensions/MongoCollectionExtensions.cs
index bc18ab8..3fa382b 100644
--- a/src/Core/Insight.Infrastructure/Extensions/MongoCollectionExtensions.cs
+++ b/src/Core/Insight.Infrastructure/Extensions/MongoCollectionExtensions.cs
@@ -4,80 +4,79 @@ using MongoDB.Bson;
using MongoDB.Bson.Serialization;
using MongoDB.Driver;
-namespace Insight.Infrastructure
+namespace Insight.Infrastructure;
+
+public static class MongoCollectionExtensions
{
- public static class MongoCollectionExtensions
+ private const int _maximumLimit = 100;
+
+ public static async Task> GetPagedAsync(
+ this IMongoCollection collection,
+ FilterDefinition? filter = null,
+ SortDefinition? sort = null,
+ int offset = 0,
+ int limit = 10,
+ CancellationToken cancellationToken = default)
{
- private const int _maximumLimit = 100;
+ if (limit > _maximumLimit) throw new InvalidOperationException("invalid limit value > 100");
- public static async Task> GetPagedAsync(
- this IMongoCollection collection,
- FilterDefinition? filter = null,
- SortDefinition? sort = null,
- int offset = 0,
- int limit = 10,
- CancellationToken cancellationToken = default)
- {
- if (limit > _maximumLimit) throw new InvalidOperationException("invalid limit value > 100");
+ var query = collection.Find(filter ?? Builders.Filter.Empty);
- var query = collection.Find(filter ?? Builders.Filter.Empty);
+ if (sort is not null) query = query.Sort(sort);
- if (sort is not null) query = query.Sort(sort);
+ var data = await query.Skip(offset).Limit(limit).ToListAsync(cancellationToken).ConfigureAwait(false);
+ var total = await collection.EstimatedDocumentCountAsync(null, cancellationToken).ConfigureAwait(false);
- var data = await query.Skip(offset).Limit(limit).ToListAsync(cancellationToken).ConfigureAwait(false);
- var total = await collection.EstimatedDocumentCountAsync(null, cancellationToken).ConfigureAwait(false);
+ return new PagedList(data, offset, limit, total);
+ }
- return new PagedList(data, offset, limit, total);
- }
+ public static async Task> GetPagedAsync(
+ this IMongoCollection collection,
+ HttpRequest request,
+ HttpResponse response,
+ FilterDefinition? filter = null,
+ SortDefinition? sort = null,
+ int offset = 0,
+ int limit = 10,
+ CancellationToken cancellationToken = default)
+ {
+ var result = await GetPagedAsync(collection, filter, sort, offset, limit, cancellationToken).ConfigureAwait(false);
- public static async Task> GetPagedAsync(
- this IMongoCollection collection,
- HttpRequest request,
- HttpResponse response,
- FilterDefinition? filter = null,
- SortDefinition? sort = null,
- int offset = 0,
- int limit = 10,
- CancellationToken cancellationToken = default)
- {
- var result = await GetPagedAsync(collection, filter, sort, offset, limit, cancellationToken).ConfigureAwait(false);
+ request?.AddPagination(result);
+ response?.AddPagination(result);
- request?.AddPagination(result);
- response?.AddPagination(result);
+ return result;
+ }
- return result;
- }
+ public static async Task> GetPagedAsync(
+ this IMongoCollection collection,
+ IAggregateFluent query,
+ int offset = 0,
+ int limit = 10,
+ CancellationToken cancellationToken = default)
+ {
+ if (limit > _maximumLimit) throw new InvalidOperationException("invalid limit value");
- public static async Task> GetPagedAsync(
- this IMongoCollection collection,
- IAggregateFluent query,
- int offset = 0,
- int limit = 10,
- CancellationToken cancellationToken = default)
- {
- if (limit > _maximumLimit) throw new InvalidOperationException("invalid limit value");
+ var data = await query.Skip(offset).Limit(limit).ToListAsync(cancellationToken).ConfigureAwait(false);
+ var total = await collection.EstimatedDocumentCountAsync(null, cancellationToken).ConfigureAwait(false);
- var data = await query.Skip(offset).Limit(limit).ToListAsync(cancellationToken).ConfigureAwait(false);
- var total = await collection.EstimatedDocumentCountAsync(null, cancellationToken).ConfigureAwait(false);
+ return new PagedList(data.Select(x => BsonSerializer.Deserialize(x)), offset, limit, total);
+ }
- return new PagedList(data.Select(x => BsonSerializer.Deserialize(x)), offset, limit, total);
- }
+ public static async Task> GetPagedAsync(
+ this IMongoCollection collection,
+ HttpRequest request,
+ HttpResponse response,
+ IAggregateFluent query,
+ int offset = 0,
+ int limit = 10,
+ CancellationToken cancellationToken = default)
+ {
+ var result = await GetPagedAsync(collection, query, offset, limit, cancellationToken).ConfigureAwait(false);
- public static async Task> GetPagedAsync(
- this IMongoCollection collection,
- HttpRequest request,
- HttpResponse response,
- IAggregateFluent query,
- int offset = 0,
- int limit = 10,
- CancellationToken cancellationToken = default)
- {
- var result = await GetPagedAsync(collection, query, offset, limit, cancellationToken).ConfigureAwait(false);
+ request?.AddPagination(result);
+ response?.AddPagination(result);
- request?.AddPagination(result);
- response?.AddPagination(result);
-
- return result;
- }
+ return result;
}
}
\ No newline at end of file
diff --git a/src/Core/Insight.Infrastructure/Extensions/MongoDatabaseExtensions.cs b/src/Core/Insight.Infrastructure/Extensions/MongoDatabaseExtensions.cs
index 3769e1d..3a76e9b 100644
--- a/src/Core/Insight.Infrastructure/Extensions/MongoDatabaseExtensions.cs
+++ b/src/Core/Insight.Infrastructure/Extensions/MongoDatabaseExtensions.cs
@@ -1,57 +1,56 @@
using Insight.Infrastructure.Entities;
using MongoDB.Driver;
-namespace Insight.Infrastructure
+namespace Insight.Infrastructure;
+
+public static class MongoDatabaseExtensions
{
- public static class MongoDatabaseExtensions
- {
- // internal users (roles), groups...
- public static IMongoCollection User(this IMongoDatabase database) => database.GetCollection("user");
- public static IMongoCollection UserLog(this IMongoDatabase database) => database.GetCollection("user_log");
- public static IMongoCollection UserPreference(this IMongoDatabase database) => database.GetCollection("user_pref");
- public static IMongoCollection Role(this IMongoDatabase database) => database.GetCollection("role");
+ // internal users (roles), groups...
+ public static IMongoCollection User(this IMongoDatabase database) => database.GetCollection("user");
+ public static IMongoCollection UserLog(this IMongoDatabase database) => database.GetCollection("user_log");
+ public static IMongoCollection UserPreference(this IMongoDatabase database) => database.GetCollection("user_pref");
+ public static IMongoCollection Role(this IMongoDatabase database) => database.GetCollection("role");
- // customers
- public static IMongoCollection Customer(this IMongoDatabase database) => database.GetCollection("customer");
+ // customers
+ public static IMongoCollection Customer(this IMongoDatabase database) => database.GetCollection("customer");
- // agents
- public static IMongoCollection Agent(this IMongoDatabase database) => database.GetCollection("agent");
- public static IMongoCollection AgentLog(this IMongoDatabase database) => database.GetCollection("agent_log");
+ // agents
+ public static IMongoCollection Agent(this IMongoDatabase database) => database.GetCollection("agent");
+ public static IMongoCollection AgentLog(this IMongoDatabase database) => database.GetCollection("agent_log");
- // host groups
- public static IMongoCollection HostGroup(this IMongoDatabase database) => database.GetCollection("host");
+ // host groups
+ public static IMongoCollection HostGroup(this IMongoDatabase database) => database.GetCollection("host");
- // hosts
- public static IMongoCollection Host(this IMongoDatabase database) => database.GetCollection("host");
- public static IMongoCollection HostLog(this IMongoDatabase database) => database.GetCollection("host_log");
+ // hosts
+ public static IMongoCollection Host(this IMongoDatabase database) => database.GetCollection("host");
+ public static IMongoCollection HostLog(this IMongoDatabase database) => database.GetCollection("host_log");
- // hosts extensions
- public static IMongoCollection HostLogMonitoring(this IMongoDatabase database) => database.GetCollection("host_log_mon");
- public static IMongoCollection HostApplication(this IMongoDatabase database) => database.GetCollection("host_app");
- public static IMongoCollection HostDrive(this IMongoDatabase database) => database.GetCollection("host_drv");
- public static IMongoCollection HostVolume(this IMongoDatabase database) => database.GetCollection("host_vol");
- public static IMongoCollection HostOs(this IMongoDatabase database) => database.GetCollection("host_os");
- public static IMongoCollection HostUpdate(this IMongoDatabase database) => database.GetCollection("host_upd");
- public static IMongoCollection HostSession(this IMongoDatabase database) => database.GetCollection("host_session");
- public static IMongoCollection HostService(this IMongoDatabase database) => database.GetCollection("host_svc");
- public static IMongoCollection HostPrinter(this IMongoDatabase database) => database.GetCollection("host_prn");
- public static IMongoCollection HostMainboard(this IMongoDatabase database) => database.GetCollection("host_board");
- public static IMongoCollection HostProcessor(this IMongoDatabase database) => database.GetCollection("host_cpu");
- public static IMongoCollection HostMemory(this IMongoDatabase database) => database.GetCollection("host_mem");
- public static IMongoCollection HostVideocard(this IMongoDatabase database) => database.GetCollection("host_gpu");
- public static IMongoCollection HostSystemUser(this IMongoDatabase database) => database.GetCollection("host_sysusr");
- public static IMongoCollection