Add user registration bdd tests

This commit is contained in:
Aaron Po
2026-02-10 23:09:00 -05:00
parent 656981003b
commit 8a4b833943
6 changed files with 315 additions and 282 deletions

View File

@@ -9,13 +9,13 @@ public class AuthService(
IPasswordService passwordService
) : IAuthService
{
public async Task<UserAccount?> RegisterAsync(UserAccount userAccount, string password)
public async Task<UserAccount> RegisterAsync(UserAccount userAccount, string password)
{
// Check if user already exists
var user = await authRepo.GetUserByUsernameAsync(userAccount.Username);
if (user is not null)
{
return null;
return null!;
}
// password hashing
@@ -45,9 +45,4 @@ public class AuthService(
if (activeCred is null) return null;
return !passwordService.Verify(password, activeCred.Hash) ? null : user;
}
public async Task InvalidateAsync(Guid userAccountId)
{
await authRepo.InvalidateCredentialsByUserAccountIdAsync(userAccountId);
}
}
}