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 const string Api = "api";
@ -7,4 +7,3 @@
public const string ServerPort = "server.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 Updater
@ -18,4 +18,3 @@
public static Uri GetUpdateHref(Uri api, string appName)
=> new($"{api.AbsoluteUri}/update/{appName.ToLower()}/windows");
}
}

View file

@ -1,7 +1,7 @@
using Microsoft.Extensions.Configuration;
namespace Insight.Agent.Extensions
{
namespace Insight.Agent.Extensions;
public static class ConfigurationExtensions
{
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);
}
}
}

View file

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

View file

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

View file

@ -2,8 +2,8 @@
using System.ServiceProcess;
using System.Text;
namespace Insight.Agent
{
namespace Insight.Agent;
internal class Helpers
{
internal static string? EscapeWql(string text)
@ -41,4 +41,3 @@ namespace Insight.Agent
return true;
}
}
}

View file

@ -1,7 +1,6 @@
namespace Insight.Agent.Models
{
namespace Insight.Agent.Models;
public class Config
{
public Guid? Serial { get; set; }
}
}

View file

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

View file

@ -1,7 +1,7 @@
using System.Text.Json;
namespace Insight.Agent.Services
{
namespace Insight.Agent.Services;
public static class Configurator
{
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);
}
}
}

View file

@ -1,9 +1,8 @@
using Insight.Domain.Constants;
namespace Insight.Api
{
namespace Insight.Api;
public static class Locations
{
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.Mvc;
namespace Insight.Api.Controllers
{
namespace Insight.Api.Controllers;
[ApiController, Route("api/accounts")]
public class AccountController : ControllerBase
{
@ -73,4 +73,3 @@ namespace Insight.Api.Controllers
return Ok(model.Email);
}
}
}

View file

@ -3,8 +3,8 @@ 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
{
@ -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.Mvc;
namespace Insight.Api.Controllers
{
namespace Insight.Api.Controllers;
[ApiController, Route("api/customers")]
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.Mvc;
namespace Insight.Api.Controllers
{
namespace Insight.Api.Controllers;
[ApiController, Route("api/hosts")]
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.RegularExpressions;
namespace Insight.Api.Controllers
{
namespace Insight.Api.Controllers;
[ApiController, Route("api/inventory")]
public class InventoryController : ControllerBase
{
@ -70,4 +70,3 @@ namespace Insight.Api.Controllers
public string? Name { get; set; }
}
}
}

View file

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

View file

@ -3,8 +3,8 @@ 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
{
@ -82,4 +82,3 @@ namespace Insight.Api.Controllers
}
}
}
}

View file

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

View file

@ -2,8 +2,8 @@
using Microsoft.OpenApi.Models;
using System.Reflection;
namespace Insight.Api.Hosting
{
namespace Insight.Api.Hosting;
public static class ServiceExtensions
{
internal static IServiceCollection AddSwaggerServices(this IServiceCollection services, IConfiguration configuration)
@ -56,4 +56,3 @@ namespace Insight.Api.Hosting
return services;
}
}
}

View file

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

View file

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

View file

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

View file

@ -1,8 +1,7 @@
namespace Insight.Infrastructure
{
namespace Insight.Infrastructure;
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");
}
}

View file

@ -1,7 +1,6 @@
namespace Insight.Infrastructure
{
namespace Insight.Infrastructure;
public class Settings
{
public const string Database = "insight";
}
}

View file

@ -3,8 +3,8 @@ 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
{
@ -59,4 +59,3 @@ namespace Insight.Infrastructure.Entities
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 System.Text.Json.Serialization;
namespace Insight.Infrastructure.Entities
{
namespace Insight.Infrastructure.Entities;
[BsonIgnoreExtraElements]
public class AgentLogEntity
{
@ -34,4 +34,3 @@ namespace Insight.Infrastructure.Entities
[BsonElement("timestamp")]
public DateTime? Timestamp { get; set; }
}
}

View file

@ -3,8 +3,8 @@ 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
{
@ -26,4 +26,3 @@ namespace Insight.Infrastructure.Entities
[BsonIgnoreIfNull, JsonIgnore]
public List<HostEntity>? Hosts { get; set; }
}
}

View file

@ -3,8 +3,8 @@ 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
{
@ -35,4 +35,3 @@ namespace Insight.Infrastructure.Entities
[BsonIgnoreIfNull, JsonIgnore]
public List<AgentEntity>? Agents { get; set; }
}
}

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -4,8 +4,8 @@ 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<ObjectId>
{
@ -50,7 +50,6 @@ namespace Insight.Infrastructure.Entities
[BsonElement("update")]
public DateTime? Update { get; set; }
[BsonElement("darkmode")]
public bool DarkMode { get; set; }
}
@ -58,9 +57,7 @@ namespace Insight.Infrastructure.Entities
[CollectionName("role")]
public class InsightRole : MongoIdentityRole<ObjectId>
{
public InsightRole() : base() { }
public InsightRole(string roleName) : base(roleName) { }
}
[BsonIgnoreExtraElements]
@ -96,4 +93,3 @@ namespace Insight.Infrastructure.Entities
[BsonIgnore, JsonIgnore]
public bool IsActive => !IsRevoked && !IsExpired;
}
}

View file

@ -2,8 +2,8 @@
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Http.Extensions;
namespace Insight.Infrastructure
{
namespace Insight.Infrastructure;
public static class HttpRequestExtensions
{
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 System.Text.Json;
namespace Insight.Infrastructure
{
namespace Insight.Infrastructure;
public static class HttpResponseExtensions
{
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.Driver;
namespace Insight.Infrastructure
{
namespace Insight.Infrastructure;
public static class MongoCollectionExtensions
{
private const int _maximumLimit = 100;
@ -80,4 +80,3 @@ namespace Insight.Infrastructure
return result;
}
}
}

View file

@ -1,8 +1,8 @@
using Insight.Infrastructure.Entities;
using MongoDB.Driver;
namespace Insight.Infrastructure
{
namespace Insight.Infrastructure;
public static class MongoDatabaseExtensions
{
// 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<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 System.Text;
namespace Insight.Infrastructure
{
namespace Insight.Infrastructure;
public static class ServiceExtensions
{
public static IServiceCollection AddDatabase(this IServiceCollection services, IConfiguration configuration, ILoggerFactory? loggerFactory = null)
@ -260,4 +260,3 @@ namespace Insight.Infrastructure
return services;
}
}
}

View file

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

View file

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

View file

@ -4,8 +4,8 @@ using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Logging;
using MongoDB.Driver;
namespace Insight.Infrastructure.Services
{
namespace Insight.Infrastructure.Services;
public class AccountService
{
private readonly IMongoDatabase _database;
@ -33,4 +33,3 @@ namespace Insight.Infrastructure.Services
int limit = 10,
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 MongoDB.Driver;
namespace Insight.Infrastructure.Services
{
namespace Insight.Infrastructure.Services;
public class AgentService
{
private readonly IMongoDatabase _database;
@ -33,4 +33,3 @@ namespace Insight.Infrastructure.Services
int limit = 10,
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.Encodings.Web;
namespace Insight.Infrastructure.Services
{
namespace Insight.Infrastructure.Services;
public class AuthenticatorService
{
private readonly IMongoDatabase _database;
@ -109,4 +109,3 @@ namespace Insight.Infrastructure.Services
return result.ToString().ToLowerInvariant();
}
}
}

View file

@ -4,8 +4,8 @@ using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Logging;
using MongoDB.Driver;
namespace Insight.Infrastructure.Services
{
namespace Insight.Infrastructure.Services;
public class CustomerService
{
private readonly IMongoDatabase _database;
@ -33,4 +33,3 @@ namespace Insight.Infrastructure.Services
int limit = 10,
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 MongoDB.Driver;
namespace Insight.Infrastructure.Services
{
namespace Insight.Infrastructure.Services;
public class HostService
{
private readonly IMongoDatabase _database;
@ -33,4 +33,3 @@ namespace Insight.Infrastructure.Services
int limit = 10,
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 System.Security.Claims;
namespace Insight.Infrastructure.Services
{
namespace Insight.Infrastructure.Services;
public class IdentityService
{
private readonly UserManager<InsightUser> _userManager;
@ -135,4 +135,3 @@ namespace Insight.Infrastructure.Services
return claims;
}
}
}

View file

@ -4,8 +4,8 @@ using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Logging;
using MongoDB.Driver;
namespace Insight.Infrastructure.Services
{
namespace Insight.Infrastructure.Services;
public class InventoryService
{
private readonly IMongoDatabase _database;
@ -33,4 +33,3 @@ namespace Insight.Infrastructure.Services
int limit = 10,
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.Text;
namespace Insight.Infrastructure.Services
{
namespace Insight.Infrastructure.Services;
public class TokenService
{
private readonly TokenOptions _options;
@ -146,4 +146,3 @@ namespace Insight.Infrastructure.Services
return (refreshToken, (int)TimeSpan.FromMinutes(30).TotalSeconds);
}
}
}

View file

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

View file

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

View file

@ -1,7 +1,7 @@
using Microsoft.Extensions.Configuration;
namespace Insight.Server.Extensions
{
namespace Insight.Server.Extensions;
public static class ConfigurationExtensions
{
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);
}
}
}

View file

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

View file

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

View file

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

View file

@ -5,8 +5,8 @@ using Microsoft.Extensions.Logging;
using System.Diagnostics;
using System.Runtime.Versioning;
namespace Insight.Setup.Services
{
namespace Insight.Setup.Services;
[SupportedOSPlatform("windows")]
internal class SetupService : BackgroundService
{
@ -244,4 +244,3 @@ namespace Insight.Setup.Services
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 Agent
@ -18,4 +18,3 @@
public static Uri GetUpdateHref(Uri api, string appName)
=> new($"{api.AbsoluteUri}/update/{appName.ToLower()}/windows");
}
}

View file

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

View file

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

View file

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