mirror of
https://github.com/aaronpo97/the-biergarten-app.git
synced 2026-10-15 01:54:43 +00:00
Format
This commit is contained in:
@@ -34,12 +34,14 @@ public class RegisterUserHandler(
|
||||
string hashed = passwordInfrastructure.Hash(request.Password);
|
||||
|
||||
UserAccount createdUser = await authRepo.RegisterUserAsync(
|
||||
new UserRegistrationDto(request.Username,
|
||||
request.FirstName,
|
||||
request.LastName,
|
||||
request.Email,
|
||||
request.DateOfBirth,
|
||||
hashed)
|
||||
new UserRegistrationDto(
|
||||
request.Username,
|
||||
request.FirstName,
|
||||
request.LastName,
|
||||
request.Email,
|
||||
request.DateOfBirth,
|
||||
hashed
|
||||
)
|
||||
);
|
||||
|
||||
string accessToken = tokenService.GenerateAccessToken(createdUser);
|
||||
|
||||
@@ -26,9 +26,7 @@ public class AuthRepository(ISqlConnectionFactory connectionFactory)
|
||||
/// subsequent lookup to fail.
|
||||
/// </remarks>
|
||||
/// <exception cref="Exception">Thrown when the newly registered user cannot be retrieved after registration.</exception>
|
||||
public async Task<UserAccount> RegisterUserAsync(
|
||||
UserRegistrationDto userRegistrationDto
|
||||
)
|
||||
public async Task<UserAccount> RegisterUserAsync(UserRegistrationDto userRegistrationDto)
|
||||
{
|
||||
await using DbConnection connection = await CreateConnection();
|
||||
await using DbCommand command = connection.CreateCommand();
|
||||
@@ -36,8 +34,7 @@ public class AuthRepository(ISqlConnectionFactory connectionFactory)
|
||||
command.CommandText = "USP_RegisterUser";
|
||||
command.CommandType = CommandType.StoredProcedure;
|
||||
|
||||
var (username, firstName, lastName, email, dateOfBirth, passwordHash) =
|
||||
userRegistrationDto;
|
||||
var (username, firstName, lastName, email, dateOfBirth, passwordHash) = userRegistrationDto;
|
||||
|
||||
AddParameter(command, "@Username", username);
|
||||
AddParameter(command, "@FirstName", firstName);
|
||||
|
||||
@@ -2,14 +2,13 @@ using Domain.Entities;
|
||||
using Features.Auth.Dtos;
|
||||
|
||||
namespace Features.Auth.Repository;
|
||||
|
||||
/// <summary>
|
||||
/// Repository for authentication-related database operations including user registration and credential management.
|
||||
/// </summary>
|
||||
public interface IAuthRepository
|
||||
{
|
||||
Task<UserAccount> RegisterUserAsync(
|
||||
UserRegistrationDto userRegistrationDto
|
||||
);
|
||||
Task<UserAccount> RegisterUserAsync(UserRegistrationDto userRegistrationDto);
|
||||
|
||||
Task<UserAccount?> GetUserByEmailAsync(string email);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user