refactor(core): encapsulate user and refresh token creation with factory methods
This commit is contained in:
@@ -6,4 +6,22 @@ public sealed class User : Entity
|
||||
public string HashedPassword { get; init; } = string.Empty;
|
||||
|
||||
public ICollection<RefreshToken> RefreshTokens { get; init; } = [];
|
||||
|
||||
private User()
|
||||
{
|
||||
}
|
||||
|
||||
public static User New()
|
||||
{
|
||||
return new();
|
||||
}
|
||||
|
||||
public static User From(string username, string hashedPassword)
|
||||
{
|
||||
return new()
|
||||
{
|
||||
Username = username,
|
||||
HashedPassword = hashedPassword,
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user