refactor: Admin
This commit is contained in:
parent
e8ca2c42a6
commit
17e20fee2e
@ -1,10 +0,0 @@
|
||||
namespace Mirea.Api.Endpoint.Common.Model;
|
||||
|
||||
public class Admin
|
||||
{
|
||||
public const string PathToSave = "admin.json";
|
||||
public required string Username { get; set; }
|
||||
public required string Email { get; set; }
|
||||
public required string PasswordHash { get; set; }
|
||||
public required string Salt { get; set; }
|
||||
}
|
25
Endpoint/Common/Settings/Admin.cs
Normal file
25
Endpoint/Common/Settings/Admin.cs
Normal file
@ -0,0 +1,25 @@
|
||||
using Mirea.Api.Endpoint.Common.Services;
|
||||
using System.IO;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Mirea.Api.Endpoint.Common.Settings;
|
||||
|
||||
public class Admin : ISaveSettings
|
||||
{
|
||||
[JsonIgnore] private const string FileName = "admin.json";
|
||||
|
||||
[JsonIgnore]
|
||||
public static string FilePath => PathBuilder.Combine(FileName);
|
||||
|
||||
public required string Username { get; set; }
|
||||
public required string Email { get; set; }
|
||||
public required string PasswordHash { get; set; }
|
||||
public required string Salt { get; set; }
|
||||
|
||||
|
||||
public void SaveSetting()
|
||||
{
|
||||
File.WriteAllText(FilePath, JsonSerializer.Serialize(this));
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user