mirror of
https://github.com/aaronpo97/the-biergarten-app.git
synced 2026-02-16 02:39:03 +00:00
Update namespaces
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
using API.Core.Contracts.Auth;
|
||||
using API.Core.Contracts.Common;
|
||||
using Domain.Core.Entities;
|
||||
using Domain.Entities;
|
||||
using Infrastructure.Jwt;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Service.Core.Auth;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Domain.Core.Entities;
|
||||
using Domain.Entities;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Service.Core.User;
|
||||
|
||||
|
||||
@@ -13,8 +13,8 @@
|
||||
<Folder Name="/Infrastructure/">
|
||||
<Project Path="Infrastructure/Infrastructure.Jwt/Infrastructure.Jwt.csproj" />
|
||||
<Project Path="Infrastructure/Infrastructure.PasswordHashing/Infrastructure.PasswordHashing.csproj" />
|
||||
<Project Path="Infrastructure/Infrastructure.Repository.Tests/Repository.Tests.csproj" />
|
||||
<Project Path="Infrastructure/Infrastructure.Repository/Infrastructure.Repository.csproj" />
|
||||
<Project Path="Infrastructure\Infrastructure.Repository.Tests\Infrastructure.Repository.Tests.csproj" />
|
||||
</Folder>
|
||||
<Folder Name="/Service/">
|
||||
<Project Path="Service/Service.Core/Service.Core.csproj" />
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
using Microsoft.Data.SqlClient;
|
||||
|
||||
namespace DBSeed
|
||||
{
|
||||
internal interface ISeeder
|
||||
{
|
||||
Task SeedAsync(SqlConnection connection);
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,7 @@
|
||||
using System.Data;
|
||||
using Microsoft.Data.SqlClient;
|
||||
|
||||
namespace DBSeed
|
||||
{
|
||||
namespace Database.Seed;
|
||||
|
||||
internal class LocationSeeder : ISeeder
|
||||
{
|
||||
@@ -325,4 +324,3 @@ namespace DBSeed
|
||||
await command.ExecuteNonQueryAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
using DBSeed;
|
||||
using Microsoft.Data.SqlClient;
|
||||
using Microsoft.Data.SqlClient;
|
||||
using DbUp;
|
||||
using System.Reflection;
|
||||
using Database.Seed;
|
||||
|
||||
string BuildConnectionString()
|
||||
{
|
||||
@@ -33,6 +33,7 @@ string BuildConnectionString()
|
||||
return builder.ConnectionString;
|
||||
}
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
var connectionString = BuildConnectionString();
|
||||
@@ -72,7 +73,6 @@ try
|
||||
|
||||
using (connection)
|
||||
{
|
||||
|
||||
ISeeder[] seeders =
|
||||
[
|
||||
new LocationSeeder(),
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
using System.Data;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using Domain.Core.Entities;
|
||||
using idunno.Password;
|
||||
using Konscious.Security.Cryptography;
|
||||
using Microsoft.Data.SqlClient;
|
||||
|
||||
namespace DBSeed
|
||||
{
|
||||
namespace Database.Seed;
|
||||
|
||||
internal class UserSeeder : ISeeder
|
||||
{
|
||||
private static readonly IReadOnlyList<(
|
||||
@@ -172,8 +171,6 @@ namespace DBSeed
|
||||
createdCredentials++;
|
||||
|
||||
|
||||
|
||||
|
||||
// add user verification
|
||||
if (await HasUserVerificationAsync(connection, id)) continue;
|
||||
|
||||
@@ -211,7 +208,6 @@ namespace DBSeed
|
||||
|
||||
|
||||
return (Guid)result!;
|
||||
|
||||
}
|
||||
|
||||
private static string GeneratePasswordHash(string pwd)
|
||||
@@ -269,4 +265,3 @@ namespace DBSeed
|
||||
return baseDate.AddDays(-offsetDays);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace Domain.Core.Entities;
|
||||
namespace Domain.Entities;
|
||||
|
||||
public class UserAccount
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace Domain.Core.Entities;
|
||||
namespace Domain.Entities;
|
||||
|
||||
public class UserCredential
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace Domain.Core.Entities;
|
||||
namespace Domain.Entities;
|
||||
|
||||
public class UserVerification
|
||||
{
|
||||
|
||||
@@ -1,18 +1,15 @@
|
||||
using System.Data;
|
||||
using System.Data.Common;
|
||||
using Domain.Core.Entities;
|
||||
using Domain.Entities;
|
||||
using Infrastructure.Repository.Sql;
|
||||
|
||||
namespace Infrastructure.Repository.Auth;
|
||||
|
||||
public class AuthRepository
|
||||
: Repository<Domain.Core.Entities.UserAccount>,
|
||||
public class AuthRepository(ISqlConnectionFactory connectionFactory)
|
||||
: Repository<Domain.Entities.UserAccount>(connectionFactory),
|
||||
IAuthRepository
|
||||
{
|
||||
public AuthRepository(ISqlConnectionFactory connectionFactory)
|
||||
: base(connectionFactory) { }
|
||||
|
||||
public async Task<Domain.Core.Entities.UserAccount> RegisterUserAsync(
|
||||
public async Task<Domain.Entities.UserAccount> RegisterUserAsync(
|
||||
string username,
|
||||
string firstName,
|
||||
string lastName,
|
||||
@@ -37,7 +34,7 @@ public class AuthRepository
|
||||
var result = await command.ExecuteScalarAsync();
|
||||
var userAccountId = result != null ? (Guid)result : Guid.Empty;
|
||||
|
||||
return new Domain.Core.Entities.UserAccount
|
||||
return new Domain.Entities.UserAccount
|
||||
{
|
||||
UserAccountId = userAccountId,
|
||||
Username = username,
|
||||
@@ -49,7 +46,7 @@ public class AuthRepository
|
||||
};
|
||||
}
|
||||
|
||||
public async Task<Domain.Core.Entities.UserAccount?> GetUserByEmailAsync(
|
||||
public async Task<Domain.Entities.UserAccount?> GetUserByEmailAsync(
|
||||
string email
|
||||
)
|
||||
{
|
||||
@@ -64,7 +61,7 @@ public class AuthRepository
|
||||
return await reader.ReadAsync() ? MapToEntity(reader) : null;
|
||||
}
|
||||
|
||||
public async Task<Domain.Core.Entities.UserAccount?> GetUserByUsernameAsync(
|
||||
public async Task<Domain.Entities.UserAccount?> GetUserByUsernameAsync(
|
||||
string username
|
||||
)
|
||||
{
|
||||
@@ -115,11 +112,11 @@ public class AuthRepository
|
||||
/// <summary>
|
||||
/// Maps a data reader row to a UserAccount entity.
|
||||
/// </summary>
|
||||
protected override Domain.Core.Entities.UserAccount MapToEntity(
|
||||
protected override Domain.Entities.UserAccount MapToEntity(
|
||||
DbDataReader reader
|
||||
)
|
||||
{
|
||||
return new Domain.Core.Entities.UserAccount
|
||||
return new Domain.Entities.UserAccount
|
||||
{
|
||||
UserAccountId = reader.GetGuid(
|
||||
reader.GetOrdinal("UserAccountId")
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Domain.Core.Entities;
|
||||
using Domain.Entities;
|
||||
|
||||
namespace Infrastructure.Repository.Auth;
|
||||
|
||||
@@ -18,7 +18,7 @@ public interface IAuthRepository
|
||||
/// <param name="dateOfBirth">User's date of birth</param>
|
||||
/// <param name="passwordHash">Hashed password</param>
|
||||
/// <returns>The newly created UserAccount with generated ID</returns>
|
||||
Task<Domain.Core.Entities.UserAccount> RegisterUserAsync(
|
||||
Task<Domain.Entities.UserAccount> RegisterUserAsync(
|
||||
string username,
|
||||
string firstName,
|
||||
string lastName,
|
||||
@@ -33,7 +33,7 @@ public interface IAuthRepository
|
||||
/// </summary>
|
||||
/// <param name="email">Email address to search for</param>
|
||||
/// <returns>UserAccount if found, null otherwise</returns>
|
||||
Task<Domain.Core.Entities.UserAccount?> GetUserByEmailAsync(
|
||||
Task<Domain.Entities.UserAccount?> GetUserByEmailAsync(
|
||||
string email
|
||||
);
|
||||
|
||||
@@ -43,7 +43,7 @@ public interface IAuthRepository
|
||||
/// </summary>
|
||||
/// <param name="username">Username to search for</param>
|
||||
/// <returns>UserAccount if found, null otherwise</returns>
|
||||
Task<Domain.Core.Entities.UserAccount?> GetUserByUsernameAsync(
|
||||
Task<Domain.Entities.UserAccount?> GetUserByUsernameAsync(
|
||||
string username
|
||||
);
|
||||
|
||||
|
||||
@@ -2,15 +2,15 @@ namespace Infrastructure.Repository.UserAccount;
|
||||
|
||||
public interface IUserAccountRepository
|
||||
{
|
||||
Task<Domain.Core.Entities.UserAccount?> GetByIdAsync(Guid id);
|
||||
Task<IEnumerable<Domain.Core.Entities.UserAccount>> GetAllAsync(
|
||||
Task<Domain.Entities.UserAccount?> GetByIdAsync(Guid id);
|
||||
Task<IEnumerable<Domain.Entities.UserAccount>> GetAllAsync(
|
||||
int? limit,
|
||||
int? offset
|
||||
);
|
||||
Task UpdateAsync(Domain.Core.Entities.UserAccount userAccount);
|
||||
Task UpdateAsync(Domain.Entities.UserAccount userAccount);
|
||||
Task DeleteAsync(Guid id);
|
||||
Task<Domain.Core.Entities.UserAccount?> GetByUsernameAsync(
|
||||
Task<Domain.Entities.UserAccount?> GetByUsernameAsync(
|
||||
string username
|
||||
);
|
||||
Task<Domain.Core.Entities.UserAccount?> GetByEmailAsync(string email);
|
||||
Task<Domain.Entities.UserAccount?> GetByEmailAsync(string email);
|
||||
}
|
||||
@@ -5,10 +5,10 @@ using Infrastructure.Repository.Sql;
|
||||
namespace Infrastructure.Repository.UserAccount;
|
||||
|
||||
public class UserAccountRepository(ISqlConnectionFactory connectionFactory)
|
||||
: Repository<Domain.Core.Entities.UserAccount>(connectionFactory),
|
||||
: Repository<Domain.Entities.UserAccount>(connectionFactory),
|
||||
IUserAccountRepository
|
||||
{
|
||||
public async Task<Domain.Core.Entities.UserAccount?> GetByIdAsync(
|
||||
public async Task<Domain.Entities.UserAccount?> GetByIdAsync(
|
||||
Guid id
|
||||
)
|
||||
{
|
||||
@@ -24,7 +24,7 @@ public class UserAccountRepository(ISqlConnectionFactory connectionFactory)
|
||||
}
|
||||
|
||||
public async Task<
|
||||
IEnumerable<Domain.Core.Entities.UserAccount>
|
||||
IEnumerable<Domain.Entities.UserAccount>
|
||||
> GetAllAsync(int? limit, int? offset)
|
||||
{
|
||||
await using var connection = await CreateConnection();
|
||||
@@ -39,7 +39,7 @@ public class UserAccountRepository(ISqlConnectionFactory connectionFactory)
|
||||
AddParameter(command, "@Offset", offset.Value);
|
||||
|
||||
await using var reader = await command.ExecuteReaderAsync();
|
||||
var users = new List<Domain.Core.Entities.UserAccount>();
|
||||
var users = new List<Domain.Entities.UserAccount>();
|
||||
|
||||
while (await reader.ReadAsync())
|
||||
{
|
||||
@@ -50,7 +50,7 @@ public class UserAccountRepository(ISqlConnectionFactory connectionFactory)
|
||||
}
|
||||
|
||||
public async Task UpdateAsync(
|
||||
Domain.Core.Entities.UserAccount userAccount
|
||||
Domain.Entities.UserAccount userAccount
|
||||
)
|
||||
{
|
||||
await using var connection = await CreateConnection();
|
||||
@@ -79,7 +79,7 @@ public class UserAccountRepository(ISqlConnectionFactory connectionFactory)
|
||||
await command.ExecuteNonQueryAsync();
|
||||
}
|
||||
|
||||
public async Task<Domain.Core.Entities.UserAccount?> GetByUsernameAsync(
|
||||
public async Task<Domain.Entities.UserAccount?> GetByUsernameAsync(
|
||||
string username
|
||||
)
|
||||
{
|
||||
@@ -94,7 +94,7 @@ public class UserAccountRepository(ISqlConnectionFactory connectionFactory)
|
||||
return await reader.ReadAsync() ? MapToEntity(reader) : null;
|
||||
}
|
||||
|
||||
public async Task<Domain.Core.Entities.UserAccount?> GetByEmailAsync(
|
||||
public async Task<Domain.Entities.UserAccount?> GetByEmailAsync(
|
||||
string email
|
||||
)
|
||||
{
|
||||
@@ -109,11 +109,11 @@ public class UserAccountRepository(ISqlConnectionFactory connectionFactory)
|
||||
return await reader.ReadAsync() ? MapToEntity(reader) : null;
|
||||
}
|
||||
|
||||
protected override Domain.Core.Entities.UserAccount MapToEntity(
|
||||
protected override Domain.Entities.UserAccount MapToEntity(
|
||||
DbDataReader reader
|
||||
)
|
||||
{
|
||||
return new Domain.Core.Entities.UserAccount
|
||||
return new Domain.Entities.UserAccount
|
||||
{
|
||||
UserAccountId = reader.GetGuid(
|
||||
reader.GetOrdinal("UserAccountId")
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Domain.Core.Entities;
|
||||
using Domain.Entities;
|
||||
using Infrastructure.PasswordHashing;
|
||||
using Infrastructure.Repository.Auth;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Domain.Core.Entities;
|
||||
using Domain.Entities;
|
||||
|
||||
namespace Service.Core.Auth;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Domain.Core.Entities;
|
||||
using Domain.Entities;
|
||||
|
||||
namespace Service.Core.User;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Domain.Core.Entities;
|
||||
using Domain.Entities;
|
||||
using Infrastructure.Repository.UserAccount;
|
||||
|
||||
namespace Service.Core.User;
|
||||
|
||||
Reference in New Issue
Block a user