add xmldoc comments

This commit is contained in:
Aaron Po
2026-06-18 23:25:50 -04:00
parent 6a66619c70
commit 254b2afb9f
52 changed files with 1681 additions and 7 deletions

View File

@@ -9,6 +9,14 @@ using Service.Emails;
namespace Service.Auth;
/// <summary>
/// Handles registration of new user accounts, including uniqueness validation, password hashing,
/// token issuance, and sending the registration confirmation email.
/// </summary>
/// <param name="authRepo">Repository used to check for existing users and persist the new account.</param>
/// <param name="passwordInfrastructure">Infrastructure component used to hash the user's plain-text password.</param>
/// <param name="tokenService">Service used to generate access, refresh, and confirmation tokens.</param>
/// <param name="emailService">Service used to send the registration confirmation email.</param>
public class RegisterService(
IAuthRepository authRepo,
IPasswordInfrastructure passwordInfrastructure,
@@ -16,6 +24,13 @@ public class RegisterService(
IEmailService emailService
) : IRegisterService
{
/// <summary>
/// Verifies that no existing user account has the same username or email as the given account.
/// </summary>
/// <param name="userAccount">The candidate user account whose username and email should be checked for uniqueness.</param>
/// <exception cref="Domain.Exceptions.ConflictException">
/// Thrown when an existing account already has the same username or email address.
/// </exception>
private async Task ValidateUserDoesNotExist(UserAccount userAccount)
{
// Check if user already exists
@@ -32,6 +47,21 @@ public class RegisterService(
}
}
/// <summary>
/// Registers a new user account: validates uniqueness, hashes the password, persists the account,
/// issues access/refresh/confirmation tokens, and attempts to send the registration confirmation email.
/// </summary>
/// <param name="userAccount">The user account details to register.</param>
/// <param name="password">The plain-text password to hash and store for the new account.</param>
/// <returns>
/// A <see cref="RegisterServiceReturn"/> describing the outcome. If token generation fails, the
/// returned value has <see cref="RegisterServiceReturn.IsAuthenticated"/> set to <c>false</c> and no tokens.
/// Otherwise tokens are populated and <see cref="RegisterServiceReturn.EmailSent"/> reflects whether the
/// confirmation email was sent successfully (failures to send the email are swallowed and do not fail registration).
/// </returns>
/// <exception cref="Domain.Exceptions.ConflictException">
/// Thrown when an existing account already has the same username or email address.
/// </exception>
public async Task<RegisterServiceReturn> RegisterAsync(
UserAccount userAccount,
string password