Add Application configuration #11

Merged
Wesser merged 128 commits from feat/add-setup into release/v1.0.0 2024-06-01 07:35:30 +03:00
Showing only changes of commit d09011d25a - Show all commits

View File

@ -28,7 +28,9 @@ namespace Mirea.Api.Endpoint.Controllers.Configuration;
[MaintenanceModeIgnore] [MaintenanceModeIgnore]
public class SetupController(ISetupToken setupToken, IMaintenanceModeNotConfigureService notConfigureService, IMemoryCache cache) : BaseController public class SetupController(ISetupToken setupToken, IMaintenanceModeNotConfigureService notConfigureService, IMemoryCache cache) : BaseController
{ {
private const string CacheGeneralKey = "config_part"; private const string CacheGeneralKey = "config_general";
private const string CacheAdminKey = "config_admin";
private GeneralConfig GeneralConfig private GeneralConfig GeneralConfig
{ {
get => cache.Get<GeneralConfig>(CacheGeneralKey) ?? new GeneralConfig(); get => cache.Get<GeneralConfig>(CacheGeneralKey) ?? new GeneralConfig();
@ -190,6 +192,16 @@ public class SetupController(ISetupToken setupToken, IMaintenanceModeNotConfigur
return Ok(true); return Ok(true);
} }
[HttpPost("CreateAdmin")]
[TokenAuthentication]
[BadRequestResponse]
public ActionResult<string> CreateAdmin([FromBody] CreateUserRequest user)
{
// todo: change CreateUserRequest to Domain entity
cache.Set(CacheAdminKey, user);
return Ok(true);
}
[HttpPost("SetLogging")] [HttpPost("SetLogging")]
[TokenAuthentication] [TokenAuthentication]
[BadRequestResponse] [BadRequestResponse]