Migrate from User to Account domain concept

Renames core domain entities and services from "User" to "Account"

Refactors project-wide namespaces, classes, and database tables to use "Account" terminology
Updates related components, services, and database schema to reflect new domain naming
Standardizes naming conventions across authentication and organization setup features
This commit is contained in:
Janus C. H. Knudsen 2026-01-09 22:14:46 +01:00
parent e5e7c1c19f
commit 88812177a9
29 changed files with 288 additions and 298 deletions

View file

@ -5,28 +5,29 @@ using PlanTempus.X.Services;
using Shouldly;
namespace PlanTempus.X.BDD.FeatureFixtures;
[TestClass]
[FeatureDescription(@"As a system administrator
I want to ensure account security is maintained
So users' data remains protected")]
[TestClass]
[FeatureDescription(@"As a system administrator
I want to ensure account security is maintained
So users' data remains protected")]
public partial class AccountSecuritySpecs : FeatureFixture
{
IUserService _userService;
IAccountService _accountService;
IEmailService _emailService;
IOrganizationService _organizationService;
IAuthService _authService;
protected User _currentUser;
protected Account _currentAccount;
protected DateTime? _lockoutEnd;
protected bool _isLocked;
protected bool _loginSuccessful;
public async Task Given_user_exists(string email)
public async Task Given_account_exists(string email)
{
_currentUser = await _userService.GetUserByEmailAsync(email);
if (_currentUser == null)
_currentAccount = await _accountService.GetAccountByEmailAsync(email);
if (_currentAccount == null)
{
_currentUser = await _userService.CreateUserAsync(email, "Test User");
_currentAccount = await _accountService.CreateAccountAsync(email, "TestPassword123!");
}
}
@ -36,7 +37,7 @@ public partial class AccountSecuritySpecs : FeatureFixture
{
try
{
await _authService.AttemptLoginAsync(_currentUser.Email, "WrongPassword");
await _authService.AttemptLoginAsync(_currentAccount.Email, "WrongPassword");
}
catch
{
@ -47,29 +48,27 @@ public partial class AccountSecuritySpecs : FeatureFixture
public async Task Then_the_account_should_be_locked()
{
_currentUser = _userService.GetUserByEmail(_currentUser.Email);
_isLocked = _currentUser.IsLocked;
_currentAccount = _accountService.GetAccountByEmail(_currentAccount.Email);
_isLocked = _currentAccount.IsLocked;
_isLocked.ShouldBeTrue();
await Task.CompletedTask;
}
public async Task And_lockout_end_should_be_set()
{
_lockoutEnd = _currentUser.LockoutEnd;
_lockoutEnd = _currentAccount.LockoutEnd;
_lockoutEnd.ShouldNotBeNull();
_lockoutEnd.Value.ShouldBeGreaterThan(DateTime.UtcNow);
await Task.CompletedTask;
}
public async Task And_subsequent_login_attempts_should_fail_until_lockout_end()
{
try
{
_loginSuccessful = await _authService.AttemptLoginAsync(_currentUser.Email, _currentUser.Password);
_loginSuccessful = await _authService.AttemptLoginAsync(_currentAccount.Email, _currentAccount.Password);
}
catch
{
@ -78,4 +77,4 @@ public partial class AccountSecuritySpecs : FeatureFixture
_loginSuccessful.ShouldBeFalse();
}
}
}