-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
33 changed files
with
199 additions
and
406 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
16 changes: 0 additions & 16 deletions
16
src/Application/Users/Create/CreateUserCommandValidator.cs
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
39 changes: 0 additions & 39 deletions
39
src/Application/Users/GetByEmail/GetUserByEmailQueryHandler.cs
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
39 changes: 39 additions & 0 deletions
39
src/Application/Users/GetLoggedInUser/GetLoggedInUserQueryHandler.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
using System.Data.Common; | ||
using Application.Abstractions.Authentication; | ||
using Application.Abstractions.Data; | ||
using Application.Abstractions.Messaging; | ||
using Dapper; | ||
using SharedKernel; | ||
|
||
namespace Application.Users.GetLoggedInUser; | ||
internal sealed class GetLoggedInUserQueryHandler( | ||
IDbConnectionFactory dbConnectionFactory, | ||
IUserContext userContext) | ||
: IQueryHandler<GetLoggedInUserQuery, UserResponse> | ||
{ | ||
public async Task<Result<UserResponse>> Handle( | ||
GetLoggedInUserQuery request, | ||
CancellationToken cancellationToken) | ||
{ | ||
await using DbConnection connection = await dbConnectionFactory.OpenConnectionAsync(); | ||
|
||
const string sql = """ | ||
SELECT | ||
id AS Id, | ||
first_name AS FirstName, | ||
last_name AS LastName, | ||
email AS Email | ||
FROM users | ||
WHERE identity_id = @IdentityId | ||
"""; | ||
|
||
UserResponse user = await connection.QuerySingleAsync<UserResponse>( | ||
sql, | ||
new | ||
{ | ||
userContext.IdentityId | ||
}); | ||
|
||
return user; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,2 @@ | ||
using SharedKernel; | ||
|
||
namespace Domain.Users; | ||
|
||
public sealed record Email | ||
{ | ||
private Email(string value) => Value = value; | ||
|
||
public string Value { get; } | ||
|
||
public static Result<Email> Create(string? email) | ||
{ | ||
if (string.IsNullOrEmpty(email)) | ||
{ | ||
return Result.Failure<Email>(EmailErrors.Empty); | ||
} | ||
|
||
//if (email.Split('@').Length != 2) | ||
//{ | ||
// return Result.Failure<Email>(EmailErrors.InvalidFormat); | ||
//} | ||
|
||
return new Email(email); | ||
} | ||
} | ||
namespace Domain.Users; | ||
public sealed record Email(string Value); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,4 @@ | ||
using SharedKernel; | ||
namespace Domain.Users; | ||
|
||
namespace Domain.Users; | ||
public sealed record FirstName(string Value); | ||
|
||
public sealed record FirstName | ||
{ | ||
public FirstName(string? value) | ||
{ | ||
Ensure.NotNullOrEmpty(value); | ||
|
||
Value = value; | ||
} | ||
|
||
public string Value { get; } | ||
} |
Oops, something went wrong.