-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: update route naming conventions & delete logout
- Loading branch information
Showing
26 changed files
with
461 additions
and
535 deletions.
There are no files selected for viewing
12 changes: 6 additions & 6 deletions
12
.../Identity/ChangeRole/ChangeRoleRequest.cs → ...DTOs/User/ChangeRole/ChangeRoleRequest.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,7 +1,7 @@ | ||
namespace Application.DTOs.Identity.ChangeRole; | ||
|
||
public class ChangeRoleRequest | ||
{ | ||
public string UserName { get; set; } = string.Empty; | ||
public string Role { get; set; } = string.Empty; | ||
namespace Application.DTOs.Identity.ChangeRole; | ||
|
||
public class ChangeRoleRequest | ||
{ | ||
public string UserName { get; set; } = string.Empty; | ||
public string Role { get; set; } = string.Empty; | ||
} |
20 changes: 10 additions & 10 deletions
20
.../Identity/CreateUser/CreateUserRequest.cs → ...DTOs/User/CreateUser/CreateUserRequest.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,11 +1,11 @@ | ||
namespace Application.DTOs.Identity.CreateUser; | ||
|
||
public class CreateUserRequest | ||
{ | ||
public string FirstName { get; set; } = String.Empty; | ||
public string LastName { get; set; } = String.Empty; | ||
public string Email { get; set; } = String.Empty; | ||
public string UserName { get; set; } = String.Empty; | ||
public string Password { get; set; } = String.Empty; | ||
public string Role { get; set; } = String.Empty; | ||
namespace Application.DTOs.Identity.CreateUser; | ||
|
||
public class CreateUserRequest | ||
{ | ||
public string FirstName { get; set; } = String.Empty; | ||
public string LastName { get; set; } = String.Empty; | ||
public string Email { get; set; } = String.Empty; | ||
public string UserName { get; set; } = String.Empty; | ||
public string Password { get; set; } = String.Empty; | ||
public string Role { get; set; } = String.Empty; | ||
} |
18 changes: 9 additions & 9 deletions
18
...Identity/CreateUser/CreateUserResponse.cs → ...TOs/User/CreateUser/CreateUserResponse.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,10 +1,10 @@ | ||
namespace Application.DTOs.Identity.CreateUser; | ||
|
||
public class CreateUserResponse | ||
{ | ||
public string FirstName { get; set; } = String.Empty; | ||
public string LastName { get; set; } = String.Empty; | ||
public string Email { get; set; } = String.Empty; | ||
public string UserName { get; set; } = String.Empty; | ||
public string Role { get; set; } = String.Empty; | ||
namespace Application.DTOs.Identity.CreateUser; | ||
|
||
public class CreateUserResponse | ||
{ | ||
public string FirstName { get; set; } = String.Empty; | ||
public string LastName { get; set; } = String.Empty; | ||
public string Email { get; set; } = String.Empty; | ||
public string UserName { get; set; } = String.Empty; | ||
public string Role { get; set; } = String.Empty; | ||
} |
File renamed without changes.
14 changes: 7 additions & 7 deletions
14
...Os/Identity/LoginUser/LoginUserRequest.cs → ...n/DTOs/User/LoginUser/LoginUserRequest.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,8 +1,8 @@ | ||
namespace Application.DTOs.Identity.LoginUser; | ||
|
||
public class LoginUserRequest | ||
{ | ||
public string? UserName { get; set; } | ||
public string? Email { get; set; } | ||
public string Password { get; set; } = String.Empty; | ||
namespace Application.DTOs.Identity.LoginUser; | ||
|
||
public class LoginUserRequest | ||
{ | ||
public string? UserName { get; set; } | ||
public string? Email { get; set; } | ||
public string Password { get; set; } = String.Empty; | ||
} |
20 changes: 10 additions & 10 deletions
20
...s/Identity/LoginUser/LoginUserResponse.cs → .../DTOs/User/LoginUser/LoginUserResponse.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,11 +1,11 @@ | ||
namespace Application.DTOs.Identity.LoginUser; | ||
|
||
public class LoginUserResponse | ||
{ | ||
public string FirstName { get; set; } = String.Empty; | ||
public string LastName { get; set; } = String.Empty; | ||
public string Email { get; set; } = String.Empty; | ||
public string UserName { get; set; } = String.Empty; | ||
public string Role { get; set; } = String.Empty; | ||
public string Token { get; set; } = String.Empty; | ||
namespace Application.DTOs.Identity.LoginUser; | ||
|
||
public class LoginUserResponse | ||
{ | ||
public string FirstName { get; set; } = String.Empty; | ||
public string LastName { get; set; } = String.Empty; | ||
public string Email { get; set; } = String.Empty; | ||
public string UserName { get; set; } = String.Empty; | ||
public string Role { get; set; } = String.Empty; | ||
public string Token { 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
29 changes: 14 additions & 15 deletions
29
...n/Interfaces/Services/IIdentityService.cs → ...ation/Interfaces/Services/IUserService.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,16 +1,15 @@ | ||
using Application.DTOs; | ||
using Application.DTOs.Identity.ChangeRole; | ||
using Application.DTOs.Identity.CreateUser; | ||
using Application.DTOs.Identity.GetUser; | ||
using Application.DTOs.Identity.LoginUser; | ||
|
||
namespace Application.Interfaces.Services; | ||
|
||
public interface IIdentityService | ||
{ | ||
Task<Result<CreateUserResponse>> SignUpUser(CreateUserRequest createIdentityDto); | ||
Task<Result<LoginUserResponse>> Login(LoginUserRequest loginDto); | ||
Task<Result> ChangeRole(ChangeRoleRequest changeRoleRequest); | ||
Task<List<GetUserResponse>> GetUsersAsync(); | ||
Task<Result> Logout(string token); | ||
using Application.DTOs; | ||
using Application.DTOs.Identity.ChangeRole; | ||
using Application.DTOs.Identity.CreateUser; | ||
using Application.DTOs.Identity.GetUser; | ||
using Application.DTOs.Identity.LoginUser; | ||
|
||
namespace Application.Interfaces.Services; | ||
|
||
public interface IUserService | ||
{ | ||
Task<Result<CreateUserResponse>> SignUpUser(CreateUserRequest createIdentityDto); | ||
Task<Result<LoginUserResponse>> Login(LoginUserRequest loginDto); | ||
Task<Result> ChangeRole(ChangeRoleRequest changeRoleRequest); | ||
Task<List<GetUserResponse>> GetUsersAsync(); | ||
} |
112 changes: 56 additions & 56 deletions
112
src/Application/Mappers/IdentityMapper.cs → src/Application/Mappers/UserMapper.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,57 +1,57 @@ | ||
using Application.DTOs.Identity.CreateUser; | ||
using Application.DTOs.Identity.GetUser; | ||
using Application.DTOs.Identity.LoginUser; | ||
using Domain.Entities; | ||
|
||
namespace Application.Mappers; | ||
|
||
public static class IdentityMapper | ||
{ | ||
public static AppUser ToAppUser(this CreateUserRequest createUserRequest) | ||
{ | ||
return new AppUser | ||
{ | ||
FirstName = createUserRequest.FirstName, | ||
LastName = createUserRequest.LastName, | ||
Email = createUserRequest.Email, | ||
UserName = createUserRequest.UserName | ||
}; | ||
} | ||
|
||
public static CreateUserResponse ToCreateUserResponse(this AppUser appUser, string role) | ||
{ | ||
return new CreateUserResponse | ||
{ | ||
FirstName = appUser.FirstName, | ||
LastName = appUser.LastName, | ||
Email = appUser.Email, | ||
UserName = appUser.UserName, | ||
Role = role | ||
}; | ||
} | ||
|
||
public static LoginUserResponse ToLoginUserResponse(this AppUser appUser, string role, string token) | ||
{ | ||
return new LoginUserResponse | ||
{ | ||
FirstName = appUser.FirstName, | ||
LastName = appUser.LastName, | ||
Email = appUser.Email, | ||
UserName = appUser.UserName, | ||
Role = role, | ||
Token = token | ||
}; | ||
} | ||
|
||
public static GetUserResponse ToGetUserResponse(this AppUser appUser, string role) | ||
{ | ||
return new GetUserResponse | ||
{ | ||
FirstName = appUser.FirstName, | ||
LastName = appUser.LastName, | ||
Email = appUser.Email, | ||
UserName = appUser.UserName, | ||
Role = role | ||
}; | ||
} | ||
using Application.DTOs.Identity.CreateUser; | ||
using Application.DTOs.Identity.GetUser; | ||
using Application.DTOs.Identity.LoginUser; | ||
using Domain.Entities; | ||
|
||
namespace Application.Mappers; | ||
|
||
public static class UserMapper | ||
{ | ||
public static AppUser ToAppUser(this CreateUserRequest createUserRequest) | ||
{ | ||
return new AppUser | ||
{ | ||
FirstName = createUserRequest.FirstName, | ||
LastName = createUserRequest.LastName, | ||
Email = createUserRequest.Email, | ||
UserName = createUserRequest.UserName | ||
}; | ||
} | ||
|
||
public static CreateUserResponse ToCreateUserResponse(this AppUser appUser, string role) | ||
{ | ||
return new CreateUserResponse | ||
{ | ||
FirstName = appUser.FirstName, | ||
LastName = appUser.LastName, | ||
Email = appUser.Email, | ||
UserName = appUser.UserName, | ||
Role = role | ||
}; | ||
} | ||
|
||
public static LoginUserResponse ToLoginUserResponse(this AppUser appUser, string role, string token) | ||
{ | ||
return new LoginUserResponse | ||
{ | ||
FirstName = appUser.FirstName, | ||
LastName = appUser.LastName, | ||
Email = appUser.Email, | ||
UserName = appUser.UserName, | ||
Role = role, | ||
Token = token | ||
}; | ||
} | ||
|
||
public static GetUserResponse ToGetUserResponse(this AppUser appUser, string role) | ||
{ | ||
return new GetUserResponse | ||
{ | ||
FirstName = appUser.FirstName, | ||
LastName = appUser.LastName, | ||
Email = appUser.Email, | ||
UserName = appUser.UserName, | ||
Role = role | ||
}; | ||
} | ||
} |
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
Oops, something went wrong.