Validate login request and refactor login handling

This commit is contained in:
Holden
2026-06-19 14:58:02 -05:00
parent 63730dbba0
commit 076fed09f2
10 changed files with 32 additions and 7 deletions

View File

@@ -0,0 +1,24 @@
using RecNet.Domain.Exceptions;
namespace RecNet.Domain.Entities.Configuration;
public class ServerConfig
{
private ServerConfig(string key, string value)
{
Key = RequireValue(key, nameof(key));
Value = value;
}
public string Key { get; private set; }
public string Value { get; private set; }
public static ServerConfig Create(string key, string value)
=> new(key, value);
public void SetValue(string value)
=> Value = value;
private static string RequireValue(string value, string parameterName)
=> !string.IsNullOrWhiteSpace(value) ? value : throw new DomainException($"{parameterName} is required.");
}