forked from github/codespaces-blank
-
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.
Feat: Added the IUserRepo and InMem implementation, refactered some u…
…ser stuff in the JWT Generator, finished episode 3 of the DDD REST API with .NET
1 parent
616bce7
commit 0888e25
Showing
12 changed files
with
117 additions
and
77 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 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
15 changes: 15 additions & 0 deletions
15
TodoistClone.Application/Common/Interfaces/Persistence/IUserRepository.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,15 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using TodoistClone.Domain.Entities; | ||
|
||
namespace TodoistClone.Application.Common.Interfaces.Persistence | ||
{ | ||
public interface IUserRepository | ||
{ | ||
void Add(User user); | ||
User? GetUserByEmail(string email); | ||
} | ||
} |
9 changes: 4 additions & 5 deletions
9
TodoistClone.Application/Services/Authentication/AuthenticationResult.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 |
---|---|---|
@@ -1,9 +1,8 @@ | ||
namespace TodoistClone.Application.Services.Authentication | ||
using TodoistClone.Domain.Entities; | ||
|
||
namespace TodoistClone.Application.Services.Authentication | ||
{ | ||
public record AuthenticationResult( | ||
Guid Id, | ||
string FirstName, | ||
string LastName, | ||
string Email, | ||
User user, | ||
string Token); | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace TodoistClone.Domain.Entities | ||
{ | ||
public class User | ||
{ | ||
public Guid Id { get; set; } = Guid.NewGuid(); | ||
public string FirstName { get; set; } = string.Empty; | ||
public string LastName { get; set; } = string.Empty; | ||
public string Email { get; set; } = string.Empty; | ||
public string Password { get; set; } = string.Empty; | ||
} | ||
} |
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
24 changes: 24 additions & 0 deletions
24
TodoistClone.Infrastructure/Persistence/UserRepositoryInMemory.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,24 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using TodoistClone.Application.Common.Interfaces.Persistence; | ||
using TodoistClone.Domain.Entities; | ||
|
||
namespace TodoistClone.Infrastructure.Persistence | ||
{ | ||
public class UserRepositoryInMemory : IUserRepository | ||
{ | ||
private static List<User> _users = new List<User>(); | ||
public void Add(User user) | ||
{ | ||
_users.Add(user); | ||
} | ||
|
||
public User? GetUserByEmail(string email) | ||
{ | ||
return _users.SingleOrDefault(x => x.Email == email); | ||
} | ||
} | ||
} |