MireaBackend/Endpoint/Configuration/Model/Admin.cs

26 lines
718 B
C#
Raw Normal View History

2024-10-07 02:13:35 +03:00
using Mirea.Api.Endpoint.Common.Interfaces;
using Mirea.Api.Endpoint.Common.Services;
2024-07-04 23:52:25 +03:00
using System.IO;
using System.Text.Json;
using System.Text.Json.Serialization;
2024-10-07 02:13:35 +03:00
namespace Mirea.Api.Endpoint.Configuration.Model;
2024-07-04 23:52:25 +03:00
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));
}
}