From b7e39b59fd0fc7b5610ebff29035bf622079e0d8 Mon Sep 17 00:00:00 2001 From: ivarlovlie Date: Wed, 5 Oct 2022 20:45:21 +0800 Subject: refactor: Change file structure --- .../Internal/Root/GetApplicationVersionRoute.cs | 21 --------------------- server/src/Endpoints/Internal/Root/LogRoute.cs | 16 ---------------- .../Internal/Root/ReadConfigurationRoute.cs | 17 ----------------- .../Internal/Root/RefreshConfigurationRoute.cs | 15 --------------- .../Endpoints/Internal/Root/ValidSessionRoute.cs | 10 ---------- 5 files changed, 79 deletions(-) delete mode 100644 server/src/Endpoints/Internal/Root/GetApplicationVersionRoute.cs delete mode 100644 server/src/Endpoints/Internal/Root/LogRoute.cs delete mode 100644 server/src/Endpoints/Internal/Root/ReadConfigurationRoute.cs delete mode 100644 server/src/Endpoints/Internal/Root/RefreshConfigurationRoute.cs delete mode 100644 server/src/Endpoints/Internal/Root/ValidSessionRoute.cs (limited to 'server/src/Endpoints/Internal/Root') diff --git a/server/src/Endpoints/Internal/Root/GetApplicationVersionRoute.cs b/server/src/Endpoints/Internal/Root/GetApplicationVersionRoute.cs deleted file mode 100644 index 5fb8213..0000000 --- a/server/src/Endpoints/Internal/Root/GetApplicationVersionRoute.cs +++ /dev/null @@ -1,21 +0,0 @@ -namespace IOL.GreatOffice.Api.Endpoints.Internal.Root; - -public class GetApplicationVersionRoute : RouteBaseSync.WithoutRequest.WithActionResult -{ - private readonly IWebHostEnvironment _environment; - - /// - public GetApplicationVersionRoute(IWebHostEnvironment environment) { - _environment = environment; - } - - /// - /// Get the running api version number. - /// - /// - [HttpGet("~/_/version")] - public override ActionResult Handle() { - var versionFilePath = Path.Combine(_environment.WebRootPath, "version.txt"); - return Ok(System.IO.File.ReadAllText(versionFilePath)); - } -} diff --git a/server/src/Endpoints/Internal/Root/LogRoute.cs b/server/src/Endpoints/Internal/Root/LogRoute.cs deleted file mode 100644 index 48b497a..0000000 --- a/server/src/Endpoints/Internal/Root/LogRoute.cs +++ /dev/null @@ -1,16 +0,0 @@ -namespace IOL.GreatOffice.Api.Endpoints.Internal.Root; - -public class LogRoute : RouteBaseSync.WithRequest.WithoutResult -{ - private readonly ILogger _logger; - - public LogRoute(ILogger logger) { - _logger = logger; - } - - [AllowAnonymous] - [HttpPost("~/_/log")] - public override void Handle([FromBody] string request) { - _logger.LogInformation(request); - } -} diff --git a/server/src/Endpoints/Internal/Root/ReadConfigurationRoute.cs b/server/src/Endpoints/Internal/Root/ReadConfigurationRoute.cs deleted file mode 100644 index e0dcca3..0000000 --- a/server/src/Endpoints/Internal/Root/ReadConfigurationRoute.cs +++ /dev/null @@ -1,17 +0,0 @@ -namespace IOL.GreatOffice.Api.Endpoints.Internal.Root; - -public class ReadConfigurationRoute : RouteBaseSync.WithoutRequest.WithActionResult -{ - private readonly VaultService _vaultService; - - public ReadConfigurationRoute(VaultService vaultService) { - _vaultService = vaultService; - } - - [AllowAnonymous] - [HttpGet("~/_/configuration")] - public override ActionResult Handle() { - var config = _vaultService.GetCurrentAppConfiguration(); - return Content(JsonSerializer.Serialize(config.GetPublicVersion()), "application/json"); - } -} diff --git a/server/src/Endpoints/Internal/Root/RefreshConfigurationRoute.cs b/server/src/Endpoints/Internal/Root/RefreshConfigurationRoute.cs deleted file mode 100644 index 4b1beec..0000000 --- a/server/src/Endpoints/Internal/Root/RefreshConfigurationRoute.cs +++ /dev/null @@ -1,15 +0,0 @@ -namespace IOL.GreatOffice.Api.Endpoints.Internal.Root; - -public class RefreshConfigurationRoute : RouteBaseSync.WithoutRequest.WithoutResult -{ - private readonly VaultService _vaultService; - - public RefreshConfigurationRoute(VaultService vaultService) { - _vaultService = vaultService; - } - - [HttpGet("~/_/refresh-configuration")] - public override void Handle() { - _vaultService.RefreshCurrentAppConfiguration(); - } -} diff --git a/server/src/Endpoints/Internal/Root/ValidSessionRoute.cs b/server/src/Endpoints/Internal/Root/ValidSessionRoute.cs deleted file mode 100644 index f377ff6..0000000 --- a/server/src/Endpoints/Internal/Root/ValidSessionRoute.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace IOL.GreatOffice.Api.Endpoints.Internal.Root; - -public class ValidSessionRoute : RouteBaseSync.WithoutRequest.WithActionResult -{ - [Authorize] - [HttpGet("~/_/valid-session")] - public override ActionResult Handle() { - return Ok(); - } -} \ No newline at end of file -- cgit v1.3