syntax updates

This commit is contained in:
Kevin Kai Berthold 2023-09-22 22:16:56 +02:00
parent 283fa1abc2
commit 1e05d4576d
75 changed files with 3821 additions and 3905 deletions

View file

@ -1,8 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
</PropertyGroup>
</Project>

View file

@ -1,5 +1,5 @@
namespace Insight.Agent namespace Insight.Agent;
{
public static class Appsettings public static class Appsettings
{ {
public const string Api = "api"; public const string Api = "api";
@ -7,4 +7,3 @@
public const string ServerPort = "server.port"; public const string ServerPort = "server.port";
public const string TrapPort = "trap.port"; public const string TrapPort = "trap.port";
} }
}

View file

@ -1,5 +1,5 @@
namespace Insight.Agent.Constants namespace Insight.Agent.Constants;
{
public static class Deploy public static class Deploy
{ {
public static class Updater public static class Updater
@ -18,4 +18,3 @@
public static Uri GetUpdateHref(Uri api, string appName) public static Uri GetUpdateHref(Uri api, string appName)
=> new($"{api.AbsoluteUri}/update/{appName.ToLower()}/windows"); => new($"{api.AbsoluteUri}/update/{appName.ToLower()}/windows");
} }
}

View file

@ -1,7 +1,7 @@
using Microsoft.Extensions.Configuration; 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)
@ -11,4 +11,3 @@ namespace Insight.Agent.Extensions
return configuration.AddJsonFile($"appsettings.{Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT")}.json", optional: true, reloadOnChange: true); return configuration.AddJsonFile($"appsettings.{Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT")}.json", optional: true, reloadOnChange: true);
} }
} }
}

View file

@ -1,8 +1,8 @@
using System.Diagnostics; using System.Diagnostics;
using System.Runtime.Versioning; using System.Runtime.Versioning;
namespace Insight.Agent.Extensions namespace Insight.Agent.Extensions;
{
public static class Linux public static class Linux
{ {
[SupportedOSPlatform("linux")] [SupportedOSPlatform("linux")]
@ -29,4 +29,3 @@ namespace Insight.Agent.Extensions
return result; return result;
} }
} }
}

View file

@ -1,8 +1,8 @@
using System.Management; using System.Management;
using System.Runtime.Versioning; using System.Runtime.Versioning;
namespace Insight.Agent namespace Insight.Agent;
{
public static class ManagmentExtensions public static class ManagmentExtensions
{ {
[SupportedOSPlatform("windows")] [SupportedOSPlatform("windows")]
@ -66,4 +66,3 @@ namespace Insight.Agent
return true; return true;
} }
} }
}

View file

@ -2,8 +2,8 @@
using System.ServiceProcess; using System.ServiceProcess;
using System.Text; 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)
@ -41,4 +41,3 @@ namespace Insight.Agent
return true; return true;
} }
} }
}

View file

@ -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; }
} }
}

View file

@ -2,8 +2,8 @@
using Microsoft.Extensions.Logging.Abstractions; using Microsoft.Extensions.Logging.Abstractions;
using System.Runtime.Versioning; using System.Runtime.Versioning;
namespace Insight.Agent.Services namespace Insight.Agent.Services;
{
[SupportedOSPlatform("linux")] [SupportedOSPlatform("linux")]
public partial class CollectorService public partial class CollectorService
{ {
@ -14,4 +14,3 @@ namespace Insight.Agent.Services
Logger = logger ?? NullLogger<CollectorService>.Instance; Logger = logger ?? NullLogger<CollectorService>.Instance;
} }
} }
}

View file

@ -1,7 +1,7 @@
using System.Text.Json; using System.Text.Json;
namespace Insight.Agent.Services namespace Insight.Agent.Services;
{
public static class Configurator public static class Configurator
{ {
public static async ValueTask<TConfig> ReadAsync<TConfig>(string file, CancellationToken cancellationToken = default) public static async ValueTask<TConfig> ReadAsync<TConfig>(string file, CancellationToken cancellationToken = default)
@ -94,4 +94,3 @@ namespace Insight.Agent.Services
await File.WriteAllTextAsync(file, json, cancellationToken); await File.WriteAllTextAsync(file, json, cancellationToken);
} }
} }
}

View file

@ -1,9 +1,8 @@
using Insight.Domain.Constants; 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");
} }
}

View file

@ -4,8 +4,8 @@ using Insight.Infrastructure.Services;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
namespace Insight.Api.Controllers namespace Insight.Api.Controllers;
{
[ApiController, Route("api/accounts")] [ApiController, Route("api/accounts")]
public class AccountController : ControllerBase public class AccountController : ControllerBase
{ {
@ -73,4 +73,3 @@ namespace Insight.Api.Controllers
return Ok(model.Email); return Ok(model.Email);
} }
} }
}

View file

@ -3,8 +3,8 @@ using Insight.Infrastructure.Services;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
namespace Insight.Api.Controllers namespace Insight.Api.Controllers;
{
[ApiController, Route("api/agents")] [ApiController, Route("api/agents")]
public class AgentController : ControllerBase public class AgentController : ControllerBase
{ {
@ -41,4 +41,3 @@ namespace Insight.Api.Controllers
} }
} }
} }
}

View file

@ -3,8 +3,8 @@ using Insight.Infrastructure.Services;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
namespace Insight.Api.Controllers namespace Insight.Api.Controllers;
{
[ApiController, Route("api/customers")] [ApiController, Route("api/customers")]
public class CustomerController : ControllerBase public class CustomerController : ControllerBase
{ {
@ -41,4 +41,3 @@ namespace Insight.Api.Controllers
} }
} }
} }
}

View file

@ -3,8 +3,8 @@ using Insight.Infrastructure.Services;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
namespace Insight.Api.Controllers namespace Insight.Api.Controllers;
{
[ApiController, Route("api/hosts")] [ApiController, Route("api/hosts")]
public class HostController : ControllerBase public class HostController : ControllerBase
{ {
@ -41,4 +41,3 @@ namespace Insight.Api.Controllers
} }
} }
} }
}

View file

@ -8,8 +8,8 @@ using MongoDB.Driver;
using System.Text.Json.Serialization; using System.Text.Json.Serialization;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
namespace Insight.Api.Controllers namespace Insight.Api.Controllers;
{
[ApiController, Route("api/inventory")] [ApiController, Route("api/inventory")]
public class InventoryController : ControllerBase public class InventoryController : ControllerBase
{ {
@ -70,4 +70,3 @@ namespace Insight.Api.Controllers
public string? Name { get; set; } public string? Name { get; set; }
} }
} }
}

View file

@ -1,7 +1,7 @@
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
namespace Insight.Server.Controllers namespace Insight.Server.Controllers;
{
[ApiController, Route("api/setup")] [ApiController, Route("api/setup")]
public class SetupController : ControllerBase public class SetupController : ControllerBase
{ {
@ -27,4 +27,3 @@ namespace Insight.Server.Controllers
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");
} }
} }
}

View file

@ -3,8 +3,8 @@ using Insight.Infrastructure.Services;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
namespace Insight.Api.Controllers namespace Insight.Api.Controllers;
{
[ApiController, Route("api/token", Order = 0)] [ApiController, Route("api/token", Order = 0)]
public class TokenController : ControllerBase public class TokenController : ControllerBase
{ {
@ -82,4 +82,3 @@ namespace Insight.Api.Controllers
} }
} }
} }
}

View file

@ -2,8 +2,8 @@
using Insight.Domain.Models; using Insight.Domain.Models;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
namespace Insight.Server.Controllers namespace Insight.Server.Controllers;
{
[ApiController, Route("api/update")] [ApiController, Route("api/update")]
public class UpdateController : ControllerBase public class UpdateController : ControllerBase
{ {
@ -90,4 +90,3 @@ namespace Insight.Server.Controllers
}); });
} }
} }
}

View file

@ -2,8 +2,8 @@
using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Models;
using System.Reflection; 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)
@ -56,4 +56,3 @@ namespace Insight.Api.Hosting
return services; return services;
} }
} }
}

View file

@ -1,7 +1,7 @@
using System.ComponentModel.DataAnnotations; 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? FirstName { get; set; }
@ -20,4 +20,3 @@ namespace Insight.Api.Models
[Compare("Password", ErrorMessage = "The password and confirmation password do not match.")] [Compare("Password", ErrorMessage = "The password and confirmation password do not match.")]
public string? ConfirmPassword { get; set; } public string? ConfirmPassword { get; set; }
} }
}

View file

@ -3,9 +3,9 @@ using Insight.Domain.Constants;
using Insight.Infrastructure; using Insight.Infrastructure;
using Microsoft.Extensions.FileProviders; using Microsoft.Extensions.FileProviders;
namespace Insight.Api namespace Insight.Api;
{
public class Program internal class Program
{ {
public static async Task Main(string[] args) public static async Task Main(string[] args)
{ {
@ -96,4 +96,3 @@ namespace Insight.Api
await app.RunAsync(); await app.RunAsync();
} }
} }
}

View file

@ -1,5 +1,5 @@
namespace Insight.Infrastructure namespace Insight.Infrastructure;
{
public class Appsettings public class Appsettings
{ {
public const string Database = "database"; public const string Database = "database";
@ -11,4 +11,3 @@
public const string ServerHost = "server.host"; public const string ServerHost = "server.host";
public const string ServerPort = "server.port"; public const string ServerPort = "server.port";
} }
}

View file

@ -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 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 LogUri = new("https://admin.webmatic.de/monitoring/computer/send/log");
} }
}

View file

@ -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";
} }
}

View file

@ -3,8 +3,8 @@ using MongoDB.Bson.Serialization.Attributes;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.Text.Json.Serialization; using System.Text.Json.Serialization;
namespace Insight.Infrastructure.Entities namespace Insight.Infrastructure.Entities;
{
[BsonIgnoreExtraElements] [BsonIgnoreExtraElements]
public class AgentEntity public class AgentEntity
{ {
@ -59,4 +59,3 @@ namespace Insight.Infrastructure.Entities
return Activity.Value.ToLocalTime().Add(TimeSpan.FromSeconds(60)).Subtract(DateTime.Now).Seconds > 0; return Activity.Value.ToLocalTime().Add(TimeSpan.FromSeconds(60)).Subtract(DateTime.Now).Seconds > 0;
} }
} }
}

View file

@ -2,8 +2,8 @@
using MongoDB.Bson.Serialization.Attributes; using MongoDB.Bson.Serialization.Attributes;
using System.Text.Json.Serialization; using System.Text.Json.Serialization;
namespace Insight.Infrastructure.Entities namespace Insight.Infrastructure.Entities;
{
[BsonIgnoreExtraElements] [BsonIgnoreExtraElements]
public class AgentLogEntity public class AgentLogEntity
{ {
@ -34,4 +34,3 @@ namespace Insight.Infrastructure.Entities
[BsonElement("timestamp")] [BsonElement("timestamp")]
public DateTime? Timestamp { get; set; } public DateTime? Timestamp { get; set; }
} }
}

View file

@ -3,8 +3,8 @@ using MongoDB.Bson.Serialization.Attributes;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.Text.Json.Serialization; using System.Text.Json.Serialization;
namespace Insight.Infrastructure.Entities namespace Insight.Infrastructure.Entities;
{
[BsonIgnoreExtraElements] [BsonIgnoreExtraElements]
public class CustomerEntity public class CustomerEntity
{ {
@ -26,4 +26,3 @@ namespace Insight.Infrastructure.Entities
[BsonIgnoreIfNull, JsonIgnore] [BsonIgnoreIfNull, JsonIgnore]
public List<HostEntity>? Hosts { get; set; } public List<HostEntity>? Hosts { get; set; }
} }
}

View file

@ -3,8 +3,8 @@ using MongoDB.Bson.Serialization.Attributes;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.Text.Json.Serialization; using System.Text.Json.Serialization;
namespace Insight.Infrastructure.Entities namespace Insight.Infrastructure.Entities;
{
[BsonIgnoreExtraElements] [BsonIgnoreExtraElements]
public class HostEntity public class HostEntity
{ {
@ -35,4 +35,3 @@ namespace Insight.Infrastructure.Entities
[BsonIgnoreIfNull, JsonIgnore] [BsonIgnoreIfNull, JsonIgnore]
public List<AgentEntity>? Agents { get; set; } public List<AgentEntity>? Agents { get; set; }
} }
}

View file

@ -2,8 +2,8 @@
using MongoDB.Bson.Serialization.Attributes; using MongoDB.Bson.Serialization.Attributes;
using System.Text.Json.Serialization; using System.Text.Json.Serialization;
namespace Insight.Infrastructure.Entities namespace Insight.Infrastructure.Entities;
{
[BsonIgnoreExtraElements] [BsonIgnoreExtraElements]
public class HostApplicationEntity public class HostApplicationEntity
{ {
@ -37,4 +37,3 @@ namespace Insight.Infrastructure.Entities
[BsonElement("installdate")] [BsonElement("installdate")]
public DateTime? InstallDate { get; set; } public DateTime? InstallDate { get; set; }
} }
}

View file

@ -2,8 +2,8 @@
using MongoDB.Bson.Serialization.Attributes; using MongoDB.Bson.Serialization.Attributes;
using System.Text.Json.Serialization; using System.Text.Json.Serialization;
namespace Insight.Infrastructure.Entities namespace Insight.Infrastructure.Entities;
{
[BsonIgnoreExtraElements] [BsonIgnoreExtraElements]
public class HostDriveEntity public class HostDriveEntity
{ {
@ -49,4 +49,3 @@ namespace Insight.Infrastructure.Entities
[BsonElement("pnp")] [BsonElement("pnp")]
public string? Pnp { get; set; } public string? Pnp { get; set; }
} }
}

View file

@ -2,8 +2,8 @@
using MongoDB.Bson.Serialization.Attributes; using MongoDB.Bson.Serialization.Attributes;
using System.Text.Json.Serialization; using System.Text.Json.Serialization;
namespace Insight.Infrastructure.Entities namespace Insight.Infrastructure.Entities;
{
[BsonIgnoreExtraElements] [BsonIgnoreExtraElements]
public class HostHypervisorVirtualMaschineEntity public class HostHypervisorVirtualMaschineEntity
{ {
@ -185,4 +185,3 @@ namespace Insight.Infrastructure.Entities
[BsonElement("swap_data_root")] [BsonElement("swap_data_root")]
public string? SwapFileDataRoot { get; set; } public string? SwapFileDataRoot { get; set; }
} }
}

View file

@ -2,8 +2,8 @@
using MongoDB.Bson.Serialization.Attributes; using MongoDB.Bson.Serialization.Attributes;
using System.Text.Json.Serialization; using System.Text.Json.Serialization;
namespace Insight.Infrastructure.Entities namespace Insight.Infrastructure.Entities;
{
[BsonIgnoreExtraElements] [BsonIgnoreExtraElements]
public class HostInterfaceEntity public class HostInterfaceEntity
{ {
@ -215,4 +215,3 @@ namespace Insight.Infrastructure.Entities
[BsonIgnoreIfNull, JsonIgnore] [BsonIgnoreIfNull, JsonIgnore]
public List<HostInterfaceEntity>? Interfaces { get; set; } public List<HostInterfaceEntity>? Interfaces { get; set; }
} }
}

View file

@ -2,8 +2,8 @@
using MongoDB.Bson.Serialization.Attributes; using MongoDB.Bson.Serialization.Attributes;
using System.Text.Json.Serialization; using System.Text.Json.Serialization;
namespace Insight.Infrastructure.Entities namespace Insight.Infrastructure.Entities;
{
[BsonIgnoreExtraElements] [BsonIgnoreExtraElements]
public class HostLogEntity public class HostLogEntity
{ {
@ -34,4 +34,3 @@ namespace Insight.Infrastructure.Entities
[BsonElement("timestamp")] [BsonElement("timestamp")]
public DateTime? Timestamp { get; set; } public DateTime? Timestamp { get; set; }
} }
}

View file

@ -2,8 +2,8 @@
using MongoDB.Bson.Serialization.Attributes; using MongoDB.Bson.Serialization.Attributes;
using System.Text.Json.Serialization; using System.Text.Json.Serialization;
namespace Insight.Infrastructure.Entities namespace Insight.Infrastructure.Entities;
{
[BsonIgnoreExtraElements] [BsonIgnoreExtraElements]
public class HostLogMonitoringEntity public class HostLogMonitoringEntity
{ {
@ -40,4 +40,3 @@ namespace Insight.Infrastructure.Entities
[BsonElement("timestamp")] [BsonElement("timestamp")]
public DateTime? Timestamp { get; set; } public DateTime? Timestamp { get; set; }
} }
}

View file

@ -2,8 +2,8 @@
using MongoDB.Bson.Serialization.Attributes; using MongoDB.Bson.Serialization.Attributes;
using System.Text.Json.Serialization; using System.Text.Json.Serialization;
namespace Insight.Infrastructure.Entities namespace Insight.Infrastructure.Entities;
{
[BsonIgnoreExtraElements] [BsonIgnoreExtraElements]
public class HostMainboardEntity public class HostMainboardEntity
{ {
@ -37,4 +37,3 @@ namespace Insight.Infrastructure.Entities
[BsonElement("Date")] [BsonElement("Date")]
public DateTime? Date { get; set; } public DateTime? Date { get; set; }
} }
}

View file

@ -2,8 +2,8 @@
using MongoDB.Bson.Serialization.Attributes; using MongoDB.Bson.Serialization.Attributes;
using System.Text.Json.Serialization; using System.Text.Json.Serialization;
namespace Insight.Infrastructure.Entities namespace Insight.Infrastructure.Entities;
{
[BsonIgnoreExtraElements] [BsonIgnoreExtraElements]
public class HostMemoryEntity public class HostMemoryEntity
{ {
@ -55,4 +55,3 @@ namespace Insight.Infrastructure.Entities
[BsonElement("voltage_current")] [BsonElement("voltage_current")]
public uint? CurrentVoltage { get; set; } public uint? CurrentVoltage { get; set; }
} }
}

View file

@ -2,8 +2,8 @@
using MongoDB.Bson.Serialization.Attributes; using MongoDB.Bson.Serialization.Attributes;
using System.Text.Json.Serialization; using System.Text.Json.Serialization;
namespace Insight.Infrastructure.Entities namespace Insight.Infrastructure.Entities;
{
[BsonIgnoreExtraElements] [BsonIgnoreExtraElements]
public class HostOsEntity public class HostOsEntity
{ {
@ -37,4 +37,3 @@ namespace Insight.Infrastructure.Entities
[BsonElement("installed")] [BsonElement("installed")]
public DateTime? Installed { get; set; } public DateTime? Installed { get; set; }
} }
}

View file

@ -2,8 +2,8 @@
using MongoDB.Bson.Serialization.Attributes; using MongoDB.Bson.Serialization.Attributes;
using System.Text.Json.Serialization; using System.Text.Json.Serialization;
namespace Insight.Infrastructure.Entities namespace Insight.Infrastructure.Entities;
{
[BsonIgnoreExtraElements] [BsonIgnoreExtraElements]
public class HostPrinterEntity public class HostPrinterEntity
{ {
@ -37,4 +37,3 @@ namespace Insight.Infrastructure.Entities
[BsonElement("comment")] [BsonElement("comment")]
public string? Comment { get; set; } public string? Comment { get; set; }
} }
}

View file

@ -2,8 +2,8 @@
using MongoDB.Bson.Serialization.Attributes; using MongoDB.Bson.Serialization.Attributes;
using System.Text.Json.Serialization; using System.Text.Json.Serialization;
namespace Insight.Infrastructure.Entities namespace Insight.Infrastructure.Entities;
{
[BsonIgnoreExtraElements] [BsonIgnoreExtraElements]
public class HostProcessorEntity public class HostProcessorEntity
{ {
@ -67,4 +67,3 @@ namespace Insight.Infrastructure.Entities
[BsonElement("pnp")] [BsonElement("pnp")]
public string? PNP { get; set; } public string? PNP { get; set; }
} }
}

View file

@ -2,8 +2,8 @@
using MongoDB.Bson.Serialization.Attributes; using MongoDB.Bson.Serialization.Attributes;
using System.Text.Json.Serialization; using System.Text.Json.Serialization;
namespace Insight.Infrastructure.Entities namespace Insight.Infrastructure.Entities;
{
[BsonIgnoreExtraElements] [BsonIgnoreExtraElements]
public class HostServiceEntity public class HostServiceEntity
{ {
@ -52,4 +52,3 @@ namespace Insight.Infrastructure.Entities
[BsonElement("account")] [BsonElement("account")]
public string? Account { get; set; } public string? Account { get; set; }
} }
}

View file

@ -2,8 +2,8 @@
using MongoDB.Bson.Serialization.Attributes; using MongoDB.Bson.Serialization.Attributes;
using System.Text.Json.Serialization; using System.Text.Json.Serialization;
namespace Insight.Infrastructure.Entities namespace Insight.Infrastructure.Entities;
{
[BsonIgnoreExtraElements] [BsonIgnoreExtraElements]
public class HostSessionEntity public class HostSessionEntity
{ {
@ -37,4 +37,3 @@ namespace Insight.Infrastructure.Entities
[BsonElement("state")] [BsonElement("state")]
public string? State { get; set; } public string? State { get; set; }
} }
}

View file

@ -2,8 +2,8 @@
using MongoDB.Bson.Serialization.Attributes; using MongoDB.Bson.Serialization.Attributes;
using System.Text.Json.Serialization; using System.Text.Json.Serialization;
namespace Insight.Infrastructure.Entities namespace Insight.Infrastructure.Entities;
{
[BsonIgnoreExtraElements] [BsonIgnoreExtraElements]
public class HostStoragePoolEntity public class HostStoragePoolEntity
{ {
@ -204,4 +204,3 @@ namespace Insight.Infrastructure.Entities
[BsonElement("states")] [BsonElement("states")]
public List<string>? States { get; set; } public List<string>? States { get; set; }
} }
}

View file

@ -2,8 +2,8 @@
using MongoDB.Bson.Serialization.Attributes; using MongoDB.Bson.Serialization.Attributes;
using System.Text.Json.Serialization; using System.Text.Json.Serialization;
namespace Insight.Infrastructure.Entities namespace Insight.Infrastructure.Entities;
{
[BsonIgnoreExtraElements] [BsonIgnoreExtraElements]
public class HostSystemEntity public class HostSystemEntity
{ {
@ -31,4 +31,3 @@ namespace Insight.Infrastructure.Entities
[BsonElement("license")] [BsonElement("license")]
public string? License { get; set; } public string? License { get; set; }
} }
}

View file

@ -2,8 +2,8 @@
using MongoDB.Bson.Serialization.Attributes; using MongoDB.Bson.Serialization.Attributes;
using System.Text.Json.Serialization; using System.Text.Json.Serialization;
namespace Insight.Infrastructure.Entities namespace Insight.Infrastructure.Entities;
{
[BsonIgnoreExtraElements] [BsonIgnoreExtraElements]
public class HostUpdateEntity public class HostUpdateEntity
{ {
@ -58,4 +58,3 @@ namespace Insight.Infrastructure.Entities
[BsonElement("reboot"), BsonIgnoreIfNull] // pending only [BsonElement("reboot"), BsonIgnoreIfNull] // pending only
public string? RebootBehavior { get; set; } public string? RebootBehavior { get; set; }
} }
}

View file

@ -2,8 +2,8 @@
using MongoDB.Bson.Serialization.Attributes; using MongoDB.Bson.Serialization.Attributes;
using System.Text.Json.Serialization; using System.Text.Json.Serialization;
namespace Insight.Infrastructure.Entities namespace Insight.Infrastructure.Entities;
{
[BsonIgnoreExtraElements] [BsonIgnoreExtraElements]
public class HostUserEntity public class HostUserEntity
{ {
@ -117,4 +117,3 @@ namespace Insight.Infrastructure.Entities
[BsonElement("update")] [BsonElement("update")]
public DateTime? Update { get; set; } public DateTime? Update { get; set; }
} }
}

View file

@ -2,8 +2,8 @@
using MongoDB.Bson.Serialization.Attributes; using MongoDB.Bson.Serialization.Attributes;
using System.Text.Json.Serialization; using System.Text.Json.Serialization;
namespace Insight.Infrastructure.Entities namespace Insight.Infrastructure.Entities;
{
[BsonIgnoreExtraElements] [BsonIgnoreExtraElements]
public class HostVideocardEntity public class HostVideocardEntity
{ {
@ -37,4 +37,3 @@ namespace Insight.Infrastructure.Entities
[BsonElement("date")] [BsonElement("date")]
public DateTime? Date { get; set; } public DateTime? Date { get; set; }
} }
}

View file

@ -2,8 +2,8 @@
using MongoDB.Bson.Serialization.Attributes; using MongoDB.Bson.Serialization.Attributes;
using System.Text.Json.Serialization; using System.Text.Json.Serialization;
namespace Insight.Infrastructure.Entities namespace Insight.Infrastructure.Entities;
{
[BsonIgnoreExtraElements] [BsonIgnoreExtraElements]
public class HostVolumeEntity public class HostVolumeEntity
{ {
@ -73,4 +73,3 @@ namespace Insight.Infrastructure.Entities
[BsonElement("provider")] [BsonElement("provider")]
public string? Provider { get; set; } public string? Provider { get; set; }
} }
}

View file

@ -4,8 +4,8 @@ using MongoDB.Bson.Serialization.Attributes;
using MongoDbGenericRepository.Attributes; using MongoDbGenericRepository.Attributes;
using System.Text.Json.Serialization; using System.Text.Json.Serialization;
namespace Insight.Infrastructure.Entities namespace Insight.Infrastructure.Entities;
{
[CollectionName("user"), BsonIgnoreExtraElements] [CollectionName("user"), BsonIgnoreExtraElements]
public class InsightUser : MongoIdentityUser<ObjectId> public class InsightUser : MongoIdentityUser<ObjectId>
{ {
@ -50,7 +50,6 @@ namespace Insight.Infrastructure.Entities
[BsonElement("update")] [BsonElement("update")]
public DateTime? Update { get; set; } public DateTime? Update { get; set; }
[BsonElement("darkmode")] [BsonElement("darkmode")]
public bool DarkMode { get; set; } public bool DarkMode { get; set; }
} }
@ -58,9 +57,7 @@ namespace Insight.Infrastructure.Entities
[CollectionName("role")] [CollectionName("role")]
public class InsightRole : MongoIdentityRole<ObjectId> public class InsightRole : MongoIdentityRole<ObjectId>
{ {
public InsightRole() : base() { }
public InsightRole(string roleName) : base(roleName) { }
} }
[BsonIgnoreExtraElements] [BsonIgnoreExtraElements]
@ -96,4 +93,3 @@ namespace Insight.Infrastructure.Entities
[BsonIgnore, JsonIgnore] [BsonIgnore, JsonIgnore]
public bool IsActive => !IsRevoked && !IsExpired; public bool IsActive => !IsRevoked && !IsExpired;
} }
}

View file

@ -2,8 +2,8 @@
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Http.Extensions; using Microsoft.AspNetCore.Http.Extensions;
namespace Insight.Infrastructure namespace Insight.Infrastructure;
{
public static class HttpRequestExtensions public static class HttpRequestExtensions
{ {
public static void AddPagination<TData>(this HttpRequest request, PagedList<TData> pagelist) public static void AddPagination<TData>(this HttpRequest request, PagedList<TData> pagelist)
@ -44,4 +44,3 @@ namespace Insight.Infrastructure
} }
} }
} }
}

View file

@ -2,8 +2,8 @@
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using System.Text.Json; using System.Text.Json;
namespace Insight.Infrastructure namespace Insight.Infrastructure;
{
public static class HttpResponseExtensions public static class HttpResponseExtensions
{ {
public static void AddPagination<TData>(this HttpResponse response, PagedList<TData> pagelist) public static void AddPagination<TData>(this HttpResponse response, PagedList<TData> pagelist)
@ -14,4 +14,3 @@ namespace Insight.Infrastructure
})); }));
} }
} }
}

View file

@ -4,8 +4,8 @@ using MongoDB.Bson;
using MongoDB.Bson.Serialization; using MongoDB.Bson.Serialization;
using MongoDB.Driver; using MongoDB.Driver;
namespace Insight.Infrastructure namespace Insight.Infrastructure;
{
public static class MongoCollectionExtensions public static class MongoCollectionExtensions
{ {
private const int _maximumLimit = 100; private const int _maximumLimit = 100;
@ -80,4 +80,3 @@ namespace Insight.Infrastructure
return result; return result;
} }
} }
}

View file

@ -1,8 +1,8 @@
using Insight.Infrastructure.Entities; using Insight.Infrastructure.Entities;
using MongoDB.Driver; using MongoDB.Driver;
namespace Insight.Infrastructure namespace Insight.Infrastructure;
{
public static class MongoDatabaseExtensions public static class MongoDatabaseExtensions
{ {
// internal users (roles), groups... // internal users (roles), groups...
@ -54,4 +54,3 @@ namespace Insight.Infrastructure
public static IMongoCollection<HostInterfaceNameserverEntity> HostInterfaceNameserver(this IMongoDatabase database) => database.GetCollection<HostInterfaceNameserverEntity>("host_if_ns"); public static IMongoCollection<HostInterfaceNameserverEntity> HostInterfaceNameserver(this IMongoDatabase database) => database.GetCollection<HostInterfaceNameserverEntity>("host_if_ns");
public static IMongoCollection<HostInterfaceRouteEntity> HostInterfaceRoute(this IMongoDatabase database) => database.GetCollection<HostInterfaceRouteEntity>("host_if_rt"); public static IMongoCollection<HostInterfaceRouteEntity> HostInterfaceRoute(this IMongoDatabase database) => database.GetCollection<HostInterfaceRouteEntity>("host_if_rt");
} }
}

View file

@ -16,8 +16,8 @@ using MongoDB.Driver;
using MongoDB.Driver.Core.Configuration; using MongoDB.Driver.Core.Configuration;
using System.Text; using System.Text;
namespace Insight.Infrastructure namespace Insight.Infrastructure;
{
public static class ServiceExtensions public static class ServiceExtensions
{ {
public static IServiceCollection AddDatabase(this IServiceCollection services, IConfiguration configuration, ILoggerFactory? loggerFactory = null) public static IServiceCollection AddDatabase(this IServiceCollection services, IConfiguration configuration, ILoggerFactory? loggerFactory = null)
@ -260,4 +260,3 @@ namespace Insight.Infrastructure
return services; return services;
} }
} }
}

View file

@ -1,7 +1,7 @@
using System.Text.Json.Serialization; using System.Text.Json.Serialization;
namespace Insight.Infrastructure.Models namespace Insight.Infrastructure.Models;
{
public class PagedList<T> public class PagedList<T>
{ {
public PagedMetaData Meta { get; } = new(); public PagedMetaData Meta { get; } = new();
@ -46,4 +46,3 @@ namespace Insight.Infrastructure.Models
[JsonPropertyName("previous")] [JsonPropertyName("previous")]
public string? Previous { get; set; } public string? Previous { get; set; }
} }
}

View file

@ -1,5 +1,5 @@
namespace Insight.Infrastructure.Models namespace Insight.Infrastructure.Models;
{
public class TokenOptions public class TokenOptions
{ {
public string Key { get; set; } public string Key { get; set; }
@ -15,4 +15,3 @@
Issuer = issuer; Issuer = issuer;
} }
} }
}

View file

@ -4,8 +4,8 @@ using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using MongoDB.Driver; using MongoDB.Driver;
namespace Insight.Infrastructure.Services namespace Insight.Infrastructure.Services;
{
public class AccountService public class AccountService
{ {
private readonly IMongoDatabase _database; private readonly IMongoDatabase _database;
@ -33,4 +33,3 @@ namespace Insight.Infrastructure.Services
int limit = 10, int limit = 10,
CancellationToken cancellationToken = default) => _database.User().GetPagedAsync(request, response, filter, sort, offset, limit, cancellationToken); CancellationToken cancellationToken = default) => _database.User().GetPagedAsync(request, response, filter, sort, offset, limit, cancellationToken);
} }
}

View file

@ -4,8 +4,8 @@ using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using MongoDB.Driver; using MongoDB.Driver;
namespace Insight.Infrastructure.Services namespace Insight.Infrastructure.Services;
{
public class AgentService public class AgentService
{ {
private readonly IMongoDatabase _database; private readonly IMongoDatabase _database;
@ -33,4 +33,3 @@ namespace Insight.Infrastructure.Services
int limit = 10, int limit = 10,
CancellationToken cancellationToken = default) => _database.Agent().GetPagedAsync(request, response, filter, sort, offset, limit, cancellationToken); CancellationToken cancellationToken = default) => _database.Agent().GetPagedAsync(request, response, filter, sort, offset, limit, cancellationToken);
} }
}

View file

@ -5,8 +5,8 @@ using System.Globalization;
using System.Text; using System.Text;
using System.Text.Encodings.Web; using System.Text.Encodings.Web;
namespace Insight.Infrastructure.Services namespace Insight.Infrastructure.Services;
{
public class AuthenticatorService public class AuthenticatorService
{ {
private readonly IMongoDatabase _database; private readonly IMongoDatabase _database;
@ -109,4 +109,3 @@ namespace Insight.Infrastructure.Services
return result.ToString().ToLowerInvariant(); return result.ToString().ToLowerInvariant();
} }
} }
}

View file

@ -4,8 +4,8 @@ using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using MongoDB.Driver; using MongoDB.Driver;
namespace Insight.Infrastructure.Services namespace Insight.Infrastructure.Services;
{
public class CustomerService public class CustomerService
{ {
private readonly IMongoDatabase _database; private readonly IMongoDatabase _database;
@ -33,4 +33,3 @@ namespace Insight.Infrastructure.Services
int limit = 10, int limit = 10,
CancellationToken cancellationToken = default) => _database.Customer().GetPagedAsync(request, response, filter, sort, offset, limit, cancellationToken); CancellationToken cancellationToken = default) => _database.Customer().GetPagedAsync(request, response, filter, sort, offset, limit, cancellationToken);
} }
}

View file

@ -4,8 +4,8 @@ using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using MongoDB.Driver; using MongoDB.Driver;
namespace Insight.Infrastructure.Services namespace Insight.Infrastructure.Services;
{
public class HostService public class HostService
{ {
private readonly IMongoDatabase _database; private readonly IMongoDatabase _database;
@ -33,4 +33,3 @@ namespace Insight.Infrastructure.Services
int limit = 10, int limit = 10,
CancellationToken cancellationToken = default) => _database.Host().GetPagedAsync(request, response, filter, sort, offset, limit, cancellationToken); CancellationToken cancellationToken = default) => _database.Host().GetPagedAsync(request, response, filter, sort, offset, limit, cancellationToken);
} }
}

View file

@ -3,8 +3,8 @@ using Microsoft.AspNetCore.Identity;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using System.Security.Claims; using System.Security.Claims;
namespace Insight.Infrastructure.Services namespace Insight.Infrastructure.Services;
{
public class IdentityService public class IdentityService
{ {
private readonly UserManager<InsightUser> _userManager; private readonly UserManager<InsightUser> _userManager;
@ -135,4 +135,3 @@ namespace Insight.Infrastructure.Services
return claims; return claims;
} }
} }
}

View file

@ -4,8 +4,8 @@ using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using MongoDB.Driver; using MongoDB.Driver;
namespace Insight.Infrastructure.Services namespace Insight.Infrastructure.Services;
{
public class InventoryService public class InventoryService
{ {
private readonly IMongoDatabase _database; private readonly IMongoDatabase _database;
@ -33,4 +33,3 @@ namespace Insight.Infrastructure.Services
int limit = 10, int limit = 10,
CancellationToken cancellationToken = default) => _database.HostApplication().GetPagedAsync(request, response, filter, sort, offset, limit, cancellationToken); CancellationToken cancellationToken = default) => _database.HostApplication().GetPagedAsync(request, response, filter, sort, offset, limit, cancellationToken);
} }
}

View file

@ -8,8 +8,8 @@ using System.Net;
using System.Security.Cryptography; using System.Security.Cryptography;
using System.Text; using System.Text;
namespace Insight.Infrastructure.Services namespace Insight.Infrastructure.Services;
{
public class TokenService public class TokenService
{ {
private readonly TokenOptions _options; private readonly TokenOptions _options;
@ -146,4 +146,3 @@ namespace Insight.Infrastructure.Services
return (refreshToken, (int)TimeSpan.FromMinutes(30).TotalSeconds); return (refreshToken, (int)TimeSpan.FromMinutes(30).TotalSeconds);
} }
} }
}

View file

@ -1,5 +1,5 @@
namespace Insight.Server namespace Insight.Server;
{
internal static class Appsettings internal static class Appsettings
{ {
internal const string AgentServerPort = "agent.server.port"; internal const string AgentServerPort = "agent.server.port";
@ -11,4 +11,3 @@
internal const string WebServerCertificate = "web.server.certificate"; internal const string WebServerCertificate = "web.server.certificate";
internal const string WebServerCertificatePassword = "web.server.certificate.password"; internal const string WebServerCertificatePassword = "web.server.certificate.password";
} }
}

View file

@ -1,7 +1,7 @@
using System.Threading.Tasks.Dataflow; using System.Threading.Tasks.Dataflow;
namespace Insight.Server.Extensions namespace Insight.Server.Extensions;
{
public static class Async public static class Async
{ {
public static async Task ParallelForEach<T>( public static async Task ParallelForEach<T>(
@ -50,4 +50,3 @@ namespace Insight.Server.Extensions
await block.Completion; await block.Completion;
} }
} }
}

View file

@ -1,7 +1,7 @@
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
namespace Insight.Server.Extensions namespace Insight.Server.Extensions;
{
public static class ConfigurationExtensions public static class ConfigurationExtensions
{ {
public static IConfigurationBuilder Defaults(this IConfigurationBuilder configuration) public static IConfigurationBuilder Defaults(this IConfigurationBuilder configuration)
@ -11,4 +11,3 @@ namespace Insight.Server.Extensions
return configuration.AddJsonFile($"appsettings.{Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT")}.json", optional: true, reloadOnChange: true); return configuration.AddJsonFile($"appsettings.{Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT")}.json", optional: true, reloadOnChange: true);
} }
} }
}

View file

@ -1,5 +1,5 @@
namespace Insight.Setup.Constants namespace Insight.Setup.Constants;
{
public static class Deploy public static class Deploy
{ {
public static class Runtime public static class Runtime
@ -46,4 +46,3 @@
public static Uri GetUpdateHref(Uri api, string appName) public static Uri GetUpdateHref(Uri api, string appName)
=> new($"{api.AbsoluteUri}/update/{appName.ToLower()}/windows"); => new($"{api.AbsoluteUri}/update/{appName.ToLower()}/windows");
} }
}

View file

@ -5,10 +5,10 @@ using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using System.Runtime.Versioning; using System.Runtime.Versioning;
namespace Insight.Setup.Windows namespace Insight.Setup.Windows;
{
[SupportedOSPlatform("windows")] [SupportedOSPlatform("windows")]
public class Program internal class Program
{ {
public static async Task Main(string[] args) public static async Task Main(string[] args)
{ {
@ -55,4 +55,3 @@ namespace Insight.Setup.Windows
.RunAsync(); .RunAsync();
} }
} }
}

View file

@ -6,8 +6,8 @@ using System.Runtime.Versioning;
using System.ServiceProcess; using System.ServiceProcess;
using System.Text.Json; using System.Text.Json;
namespace Insight.Setup.Services namespace Insight.Setup.Services;
{
public static class Deployment public static class Deployment
{ {
[SupportedOSPlatform("windows")] [SupportedOSPlatform("windows")]
@ -474,4 +474,3 @@ namespace Insight.Setup.Services
public List<string> Errors { get; } = new(); public List<string> Errors { get; } = new();
} }
} }
}

View file

@ -5,8 +5,8 @@ using Microsoft.Extensions.Logging;
using System.Diagnostics; using System.Diagnostics;
using System.Runtime.Versioning; using System.Runtime.Versioning;
namespace Insight.Setup.Services namespace Insight.Setup.Services;
{
[SupportedOSPlatform("windows")] [SupportedOSPlatform("windows")]
internal class SetupService : BackgroundService internal class SetupService : BackgroundService
{ {
@ -244,4 +244,3 @@ namespace Insight.Setup.Services
if (runtimeFile.Exists) runtimeFile.Delete(); if (runtimeFile.Exists) runtimeFile.Delete();
} }
} }
}

View file

@ -1,5 +1,5 @@
namespace Insight.Updater.Constants namespace Insight.Updater.Constants;
{
public static class Deploy public static class Deploy
{ {
public static class Agent public static class Agent
@ -18,4 +18,3 @@
public static Uri GetUpdateHref(Uri api, string appName) public static Uri GetUpdateHref(Uri api, string appName)
=> new($"{api.AbsoluteUri}/update/{appName.ToLower()}/windows"); => new($"{api.AbsoluteUri}/update/{appName.ToLower()}/windows");
} }
}

View file

@ -5,8 +5,8 @@ using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
namespace Insight.Updater.Windows namespace Insight.Updater.Windows;
{
internal class Program internal class Program
{ {
public static async Task Main(string[] args) public static async Task Main(string[] args)
@ -54,4 +54,3 @@ namespace Insight.Updater.Windows
await host.RunAsync().ConfigureAwait(false); await host.RunAsync().ConfigureAwait(false);
} }
} }
}

View file

@ -10,8 +10,8 @@ using System.Runtime.Versioning;
using System.ServiceProcess; using System.ServiceProcess;
using System.Text.Json; using System.Text.Json;
namespace Insight.Updater.Services namespace Insight.Updater.Services;
{
public class UpdateService : BackgroundService public class UpdateService : BackgroundService
{ {
private readonly Uri _uri; private readonly Uri _uri;
@ -357,4 +357,3 @@ namespace Insight.Updater.Services
public List<string> UpdateErrors { get; } = new(); public List<string> UpdateErrors { get; } = new();
} }
} }
}

View file

@ -12,7 +12,7 @@ using Vaitr.Network.Hosting;
namespace Insight.Web; namespace Insight.Web;
public class Program internal class Program
{ {
public static async Task Main(string[] args) public static async Task Main(string[] args)
{ {