feat: add create admin
This commit is contained in:
parent
a902d9eb81
commit
d09011d25a
@ -28,7 +28,9 @@ namespace Mirea.Api.Endpoint.Controllers.Configuration;
|
||||
[MaintenanceModeIgnore]
|
||||
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
|
||||
{
|
||||
get => cache.Get<GeneralConfig>(CacheGeneralKey) ?? new GeneralConfig();
|
||||
@ -190,6 +192,16 @@ public class SetupController(ISetupToken setupToken, IMaintenanceModeNotConfigur
|
||||
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")]
|
||||
[TokenAuthentication]
|
||||
[BadRequestResponse]
|
||||
|
Loading…
Reference in New Issue
Block a user