diff --git a/TIAM.Database/DataLayers/Users/UserDal.cs b/TIAM.Database/DataLayers/Users/UserDal.cs index 4be3bee7..483b2d26 100644 --- a/TIAM.Database/DataLayers/Users/UserDal.cs +++ b/TIAM.Database/DataLayers/Users/UserDal.cs @@ -11,11 +11,20 @@ namespace TIAM.Database.DataLayers.Users { public class UserDal : TiamDalBase { - private DbSet Users { get; set; } + public UserDal() : base() { } - //public User + public Task> GetUsersAsync() + { + return Ctx.Users.ToListAsync(); + } + + public Task GetUserByEmailAsync(string email) + { + var emailLower = email.ToLower(); + return Ctx.Users.SingleOrDefaultAsync(x=>x.Email.ToLower() == emailLower); + } } } diff --git a/TIAM.Database/DbContexts/UserDbContext.cs b/TIAM.Database/DbContexts/UserDbContext.cs index 91102201..7ea71de0 100644 --- a/TIAM.Database/DbContexts/UserDbContext.cs +++ b/TIAM.Database/DbContexts/UserDbContext.cs @@ -6,12 +6,13 @@ using System.Threading.Tasks; using AyCode.Database.DbContexts; using Microsoft.EntityFrameworkCore; using TIAM.Entities.TransferDestinations; +using TIAM.Entities.Users; namespace TIAM.Database.DbContexts { public class UserDbContext : TiamDbContextBase { - public DbSet TransferDestinations { get; set; } + public DbSet Users { get; set; } public UserDbContext() //: this(string.Empty) { diff --git a/TIAM.Entities/Users/User.cs b/TIAM.Entities/Users/User.cs index c1cfb776..71bdac29 100644 --- a/TIAM.Entities/Users/User.cs +++ b/TIAM.Entities/Users/User.cs @@ -9,5 +9,9 @@ namespace TIAM.Entities.Users { public class User : UserBase { + public User() { } + public User(string email, string password) : this(Guid.NewGuid(), email, password) { } + public User(Guid id, string email, string password) : base(id, email, password) + { } } } diff --git a/TIAMMobileApp/Platforms/Windows/Package.appxmanifest b/TIAMMobileApp/Platforms/Windows/Package.appxmanifest index 136840a6..caf73dba 100644 --- a/TIAMMobileApp/Platforms/Windows/Package.appxmanifest +++ b/TIAMMobileApp/Platforms/Windows/Package.appxmanifest @@ -6,13 +6,13 @@ xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities" IgnorableNamespaces="uap rescap"> - + $placeholder$ - User Name + UserModel Name $placeholder$.png diff --git a/TIAMMobileApp/Services/UserDataService.cs b/TIAMMobileApp/Services/UserDataService.cs index f4f62064..d2d11669 100644 --- a/TIAMMobileApp/Services/UserDataService.cs +++ b/TIAMMobileApp/Services/UserDataService.cs @@ -2,6 +2,7 @@ using Newtonsoft.Json; using System.Net.Http.Json; using System.Text; +using TIAM.Entities.Users; using TIAMWebApp.Shared.Application.Interfaces; using TIAMWebApp.Shared.Application.Models; using TIAMWebApp.Shared.Application.Models.ClientSide; @@ -14,7 +15,7 @@ namespace TIAMMobilApp.Services { private readonly HttpClient http; private readonly ISecureStorageHandler secureStorageHandler; - public User? User { get; set; } = new User("", "", ""); + public UserModel? User { get; set; } = new UserModel("", "", ""); public Dictionary userRoleTypes { get => throw new NotImplementedException(); set => throw new NotImplementedException(); } public UserDataService(HttpClient http, ISecureStorageHandler secureStorageHandler) @@ -39,11 +40,11 @@ namespace TIAMMobilApp.Services }; - public async Task IsLoggedInAsync() + public async Task IsLoggedInAsync() { if (User == null) { - User = new User("", "", ""); + User = new UserModel("", "", ""); User.IsLoggedIn = false; User.UserType = UserType.User; return User; @@ -57,11 +58,11 @@ namespace TIAMMobilApp.Services } //Mock method for now - public async Task AuthorizeUserAsync(int userType) + public async Task AuthorizeUserAsync(int userType) { if (User == null) { - User = new User("", "", ""); + User = new UserModel("", "", ""); } //simply return true for now User.IsLoggedIn = true; @@ -126,6 +127,16 @@ namespace TIAMMobilApp.Services return (isSuccess, result); } + public Task> GetUsersAsync() + { + throw new NotImplementedException(); + } + + public Task GetUserByEmailAsync(string email) + { + throw new NotImplementedException(); + } + public async Task RefreshToken() { bool isTokenRefreshed = false; @@ -169,10 +180,10 @@ namespace TIAMMobilApp.Services } - public Task> GetUserRolesAsync(User user) + public Task> GetUserRolesAsync(UserModel userModel) { - //get the user's roles + //get the userModel's roles int role = User.UserRoles; foreach (var roleType in roleTypes) diff --git a/TIAMMobileApp/TIAMMobileApp.csproj b/TIAMMobileApp/TIAMMobileApp.csproj index 3943c374..36180c33 100644 --- a/TIAMMobileApp/TIAMMobileApp.csproj +++ b/TIAMMobileApp/TIAMMobileApp.csproj @@ -59,4 +59,16 @@ + + + ..\..\AyCode.Core\AyCode.Database\bin\Debug\net7.0\AyCode.Core.dll + + + ..\..\AyCode.Core\AyCode.Database\bin\Debug\net7.0\AyCode.Entities.dll + + + ..\..\AyCode.Core\AyCode.Database\bin\Debug\net7.0\AyCode.Interfaces.dll + + + diff --git a/TIAMSharedUI/Pages/DbTestComponent.razor b/TIAMSharedUI/Pages/DbTestComponent.razor new file mode 100644 index 00000000..1007e469 --- /dev/null +++ b/TIAMSharedUI/Pages/DbTestComponent.razor @@ -0,0 +1,20 @@ +@if (Users == null) +{ +

+ Loading ... +

+} +else +{ + +
+ + @foreach (var dest in Users) + { +

@dest.Email

+ } +
+ + +} + diff --git a/TIAMSharedUI/Pages/DbTestComponent.razor.cs b/TIAMSharedUI/Pages/DbTestComponent.razor.cs new file mode 100644 index 00000000..12f84567 --- /dev/null +++ b/TIAMSharedUI/Pages/DbTestComponent.razor.cs @@ -0,0 +1,63 @@ +using Microsoft.AspNetCore.Components; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using TIAM.Entities.Users; +using TIAMWebApp.Shared.Application.Interfaces; +using TIAMWebApp.Shared.Application.Models; + +namespace TIAMSharedUI.Pages +{ + public partial class DbTestComponent: ComponentBase + { + [Parameter] + public string EmailAddress + { + get; + set; + } + public List? Users + { + get; + set; + } + [Inject] + public IUserDataService UserDataService + { + get; + set; + } + [Parameter] + public string Value + { + get; + set; + } + [Parameter] + public EventCallback ValueChanged + { + get; + set; + } + protected override async Task OnInitializedAsync() + { + Users = (await UserDataService.GetUsersAsync())?.ToList(); + } + + private Task OnValueChanged(ChangeEventArgs e) + { + Value = e.Value.ToString(); + DisplayCard(); + return ValueChanged.InvokeAsync(Value); + } + + private void DisplayCard() + { + + } + } +} + + diff --git a/TIAMSharedUI/Pages/Login.razor b/TIAMSharedUI/Pages/Login.razor index 120cdf82..4093d6c5 100644 --- a/TIAMSharedUI/Pages/Login.razor +++ b/TIAMSharedUI/Pages/Login.razor @@ -35,7 +35,7 @@ - + diff --git a/TIAMSharedUI/Pages/TestPage.razor b/TIAMSharedUI/Pages/TestPage.razor new file mode 100644 index 00000000..da7e5f6e --- /dev/null +++ b/TIAMSharedUI/Pages/TestPage.razor @@ -0,0 +1,11 @@ +@page "/dbtest" +

TestPage

+ + +
+ + +@code { + + +} diff --git a/TIAMSharedUI/Shared/AdminLayout.razor b/TIAMSharedUI/Shared/AdminLayout.razor index e549aea1..0da560fd 100644 --- a/TIAMSharedUI/Shared/AdminLayout.razor +++ b/TIAMSharedUI/Shared/AdminLayout.razor @@ -1,5 +1,5 @@ @inherits LayoutComponentBase -@using TIAMSharedUI.Shared.User +@using TIAMSharedUI.Shared.Users @using TIAMWebApp.Shared.Application.Interfaces @using TIAMWebApp.Shared.Application.Models; @inject NavigationManager NavigationManager diff --git a/TIAMSharedUI/Shared/MainLayout.razor b/TIAMSharedUI/Shared/MainLayout.razor index d84847e3..f5d6d31f 100644 --- a/TIAMSharedUI/Shared/MainLayout.razor +++ b/TIAMSharedUI/Shared/MainLayout.razor @@ -14,8 +14,6 @@
- -
@{ if(isUserLoggedIn) diff --git a/TIAMSharedUI/Shared/User/AdminNavMenu.Razor.css b/TIAMSharedUI/Shared/Users/AdminNavMenu.Razor.css similarity index 100% rename from TIAMSharedUI/Shared/User/AdminNavMenu.Razor.css rename to TIAMSharedUI/Shared/Users/AdminNavMenu.Razor.css diff --git a/TIAMSharedUI/Shared/User/AdminNavMenu.razor b/TIAMSharedUI/Shared/Users/AdminNavMenu.razor similarity index 100% rename from TIAMSharedUI/Shared/User/AdminNavMenu.razor rename to TIAMSharedUI/Shared/Users/AdminNavMenu.razor diff --git a/TIAMSharedUI/TIAMSharedUI.csproj b/TIAMSharedUI/TIAMSharedUI.csproj index cc04291c..35275e49 100644 --- a/TIAMSharedUI/TIAMSharedUI.csproj +++ b/TIAMSharedUI/TIAMSharedUI.csproj @@ -20,4 +20,16 @@ + + + ..\..\AyCode.Core\AyCode.Database\bin\Debug\net7.0\AyCode.Core.dll + + + ..\..\AyCode.Core\AyCode.Database\bin\Debug\net7.0\AyCode.Entities.dll + + + ..\..\AyCode.Core\AyCode.Database\bin\Debug\net7.0\AyCode.Interfaces.dll + + + diff --git a/TIAMWebApp/Client/Services/UserDataService.cs b/TIAMWebApp/Client/Services/UserDataService.cs index 8ee2ee97..441c9eae 100644 --- a/TIAMWebApp/Client/Services/UserDataService.cs +++ b/TIAMWebApp/Client/Services/UserDataService.cs @@ -2,6 +2,8 @@ using Newtonsoft.Json; using System.Net.Http.Json; using System.Text; +using TIAM.Entities.TransferDestinations; +using TIAM.Entities.Users; using TIAMWebApp.Shared.Application.Interfaces; using TIAMWebApp.Shared.Application.Models; using TIAMWebApp.Shared.Application.Models.ClientSide; @@ -14,7 +16,7 @@ namespace TIAMWebApp.Client.Services { private readonly HttpClient http; private readonly ISecureStorageHandler secureStorageHandler; - public User? User { get; set; } = new User("", "", ""); + public UserModel? User { get; set; } = new UserModel("", "", ""); public Dictionary userRoleTypes { get => throw new NotImplementedException(); set => throw new NotImplementedException(); } public UserDataService(HttpClient http, ISecureStorageHandler secureStorageHandler) @@ -39,11 +41,11 @@ namespace TIAMWebApp.Client.Services }; - public async Task IsLoggedInAsync() + public async Task IsLoggedInAsync() { if (User == null) { - User = new User("", "", ""); + User = new UserModel("", "", ""); User.IsLoggedIn = false; User.UserType = UserType.User; return User; @@ -57,11 +59,11 @@ namespace TIAMWebApp.Client.Services } //Mock method for now - public async Task AuthorizeUserAsync(int userType) + public async Task AuthorizeUserAsync(int userType) { if (User == null) { - User = new User("", "", ""); + User = new UserModel("", "", ""); } //simply return true for now User.IsLoggedIn = true; @@ -126,6 +128,16 @@ namespace TIAMWebApp.Client.Services return (isSuccess, result); } + public async Task?> GetUsersAsync() + { + return await http.GetFromJsonAsync>(APIUrls.GetUsers); + } + + public async Task GetUserByEmailAsync(string email) + { + return await http.GetFromJsonAsync(APIUrls.GetUserByEmail); + } + public async Task RefreshToken() { bool isTokenRefreshed = false; @@ -169,10 +181,10 @@ namespace TIAMWebApp.Client.Services } - public Task> GetUserRolesAsync(User user) + public Task> GetUserRolesAsync(UserModel userModel) { - //get the user's roles + //get the userModel's roles int role = User.UserRoles; foreach (var roleType in roleTypes) diff --git a/TIAMWebApp/Client/TIAMWebApp.Client.csproj b/TIAMWebApp/Client/TIAMWebApp.Client.csproj index 80219aeb..5fe4e044 100644 --- a/TIAMWebApp/Client/TIAMWebApp.Client.csproj +++ b/TIAMWebApp/Client/TIAMWebApp.Client.csproj @@ -17,4 +17,16 @@ + + + ..\..\..\AyCode.Core\AyCode.Database\bin\Debug\net7.0\AyCode.Core.dll + + + ..\..\..\AyCode.Core\AyCode.Database\bin\Debug\net7.0\AyCode.Entities.dll + + + ..\..\..\AyCode.Core\AyCode.Database\bin\Debug\net7.0\AyCode.Interfaces.dll + + + diff --git a/TIAMWebApp/Server/Controllers/TransferDataAPIController.cs b/TIAMWebApp/Server/Controllers/TransferDataAPIController.cs index e8f798b5..cf4ad85c 100644 --- a/TIAMWebApp/Server/Controllers/TransferDataAPIController.cs +++ b/TIAMWebApp/Server/Controllers/TransferDataAPIController.cs @@ -27,22 +27,19 @@ namespace TIAMWebApp.Server.Controllers //}; - private readonly UserDal _userDal; + private readonly TransferDestinationDal _transferDestinationDal; private readonly ILogger _logger; - public TransferDataAPIController(ILogger logger, UserDal userDal) + public TransferDataAPIController(ILogger logger, TransferDestinationDal transferDestinationDal) { _logger = logger; - _userDal = userDal; + _transferDestinationDal = transferDestinationDal; } [HttpGet] public async Task> Get() { - //return new JsonResult(await _transferDestinationDbContext.TransferDestinations.ToListAsync()); - - var result = await _userDal.Ctx.TransferDestinations.ToListAsync(); - return result; + return await _transferDestinationDal.Ctx.TransferDestinations.ToListAsync(); } } } \ No newline at end of file diff --git a/TIAMWebApp/Server/Controllers/UserAPIController.cs b/TIAMWebApp/Server/Controllers/UserAPIController.cs index 4e5fad33..e72785f1 100644 --- a/TIAMWebApp/Server/Controllers/UserAPIController.cs +++ b/TIAMWebApp/Server/Controllers/UserAPIController.cs @@ -15,34 +15,39 @@ using TIAMWebApp.Shared.Application.Models.PageModels; using TIAMWebApp.Server.Models; using System.Text; using Microsoft.AspNetCore.Hosting; +using Microsoft.EntityFrameworkCore; +using TIAM.Database.DataLayers.Users; +using TIAM.Entities.Users; using TIAMWebApp.Server.ModelsTIAMWebApp.Shared.Application.Models; namespace TIAMWebApp.Server.Controllers { - [Authorize] + //[Authorize] [ApiController] [Route("api/[controller]")] public class UserAPIController : ControllerBase { + private UserDal _userDal; private readonly IConfiguration _configuration; private readonly IWebHostEnvironment _webHostEnvironment; PasswordHasher hasher = new PasswordHasher(); - private User[] users = new User[] + private UserModel[] users = new UserModel[] { - new User(new Guid("540271f6-c604-4c16-8160-d5a7cafedf00"), "test@tiam.hu", "+36701234567", "Asdasd123456"), - new User(new Guid("4cbaed43-2465-4d99-84f1-c8bc6b7025f7"), "adam@tiam.hu", "+36701234567", "Asdasd987654") + new UserModel(new Guid("540271f6-c604-4c16-8160-d5a7cafedf00"), "test@tiam.hu", "+36701234567", "Asdasd123456"), + new UserModel(new Guid("4cbaed43-2465-4d99-84f1-c8bc6b7025f7"), "adam@tiam.hu", "+36701234567", "Asdasd987654") }; private readonly ILogger _logger; - public UserAPIController(ILogger logger, IConfiguration configuration, IWebHostEnvironment webHostEnvironment) + public UserAPIController(ILogger logger, IConfiguration configuration, IWebHostEnvironment webHostEnvironment, UserDal userDal) { _logger = logger; _configuration = configuration; _webHostEnvironment = webHostEnvironment; + _userDal = userDal; } @@ -58,19 +63,19 @@ namespace TIAMWebApp.Server.Controllers } else { - var user = JObject.Parse(SerializedLoginModel.GetRawText()).ToObject(); + var userModel = JObject.Parse(SerializedLoginModel.GetRawText()).ToObject(); - Console.WriteLine(user.Email); - Console.WriteLine(user.Password); + Console.WriteLine(userModel.Email); + Console.WriteLine(userModel.Password); - if (user.Email == "test@tiam.hu" && user.Password == "Asdasd123456") + if (userModel.Email == "test@tiam.hu" && userModel.Password == "Asdasd123456") { - Console.WriteLine("User authenticated"); + Console.WriteLine("UserModel authenticated"); return Ok("yes"); } else { - Console.WriteLine("User NOT authenticated"); + Console.WriteLine("UserModel NOT authenticated"); return Ok("no"); } } @@ -84,15 +89,15 @@ namespace TIAMWebApp.Server.Controllers var authenticateUser = JObject.Parse(SerializedLoginModel.GetRawText()).ToObject(); - //check if user exists - //var user = await _userManager.FindByNameAsync(authenticateUser.UserName); - //if (user == null) return Unauthorized(); + //check if userModel exists + //var userModel = await _userManager.FindByNameAsync(authenticateUser.UserName); + //if (userModel == null) return Unauthorized(); //mocking var user = users.FirstOrDefault(x => x.Email == authenticateUser.Email); //check if password is valid - //bool isValidUser = await _userManager.CheckPasswordAsync(user, authenticateUser.Password); + //bool isValidUser = await _userManager.CheckPasswordAsync(userModel, authenticateUser.Password); //mocking bool isValidUser = false; @@ -105,13 +110,13 @@ namespace TIAMWebApp.Server.Controllers if (isValidUser) { - Console.WriteLine("User authenticated, let's start JWT"); + Console.WriteLine("UserModel authenticated, let's start JWT"); string accessToken = GenerateAccessToken(user); Console.WriteLine("Generate refresh token"); var refreshToken = GenerateRefreshToken(); user.RefreshToken = refreshToken; - //Update user with refreshToken!! - //await _userManager.UpdateAsync(user); + //Update userModel with refreshToken!! + //await _userManager.UpdateAsync(userModel); var response = new MainResponse { @@ -132,7 +137,7 @@ namespace TIAMWebApp.Server.Controllers } - private string GenerateAccessToken(User user) + private string GenerateAccessToken(UserModel userModel) { var tokenHandler = new JwtSecurityTokenHandler(); var token = new JwtSecurityToken(); @@ -142,8 +147,8 @@ namespace TIAMWebApp.Server.Controllers var claims = new List { - new Claim(ClaimTypes.NameIdentifier, user.Id.ToString()), - new Claim(ClaimTypes.Email, user.Email) + new Claim(ClaimTypes.NameIdentifier, userModel.Id.ToString()), + new Claim(ClaimTypes.Email, userModel.Email) }; var tokenDescriptor = new SecurityTokenDescriptor @@ -177,7 +182,7 @@ namespace TIAMWebApp.Server.Controllers { var email = principal.Claims.FirstOrDefault(f => f.Type == ClaimTypes.Email); - //var user = await _userManager.FindByEmailAsync(email?.Value); + //var userModel = await _userManager.FindByEmailAsync(email?.Value); var user = users.FirstOrDefault(x => x.Email == email?.Value); @@ -190,9 +195,9 @@ namespace TIAMWebApp.Server.Controllers string newAccessToken = GenerateAccessToken(user); string refreshToken = GenerateRefreshToken(); - //mocking - update user with new refreshToken + //mocking - update userModel with new refreshToken user.RefreshToken = refreshToken; - //await _userManager.UpdateAsync(user); + //await _userManager.UpdateAsync(userModel); response.IsSuccess = true; response.Content = new AuthenticationResponse @@ -261,9 +266,9 @@ namespace TIAMWebApp.Server.Controllers if (users != null) { - //add user to users array + //add userModel to users array Array.Resize(ref users, users.Length + 1); - users[users.Length - 1] = new User(user.Email, user.PhoneNumber, user.Password); + users[users.Length - 1] = new UserModel(user.Email, user.PhoneNumber, user.Password); return Ok("yes"); } else @@ -294,9 +299,18 @@ namespace TIAMWebApp.Server.Controllers [HttpGet] [Route("GetUsers")] - public IEnumerable GetUsers() + public Task> GetUsers() { - throw new NotImplementedException(); + //var users = await _userDal.Ctx.Users.ToListAsync();//.GetUsersAsync(); + //return users; + return _userDal.GetUsersAsync(); + } + + [HttpGet] + [Route("GetUserByEmail")] + public Task GetUserByEmail(string email) + { + return _userDal.GetUserByEmailAsync(email); } private bool VerifyPassword(string password, string hashedPassword) diff --git a/TIAMWebApp/Server/Program.cs b/TIAMWebApp/Server/Program.cs index 3bf7664c..2904725c 100644 --- a/TIAMWebApp/Server/Program.cs +++ b/TIAMWebApp/Server/Program.cs @@ -11,6 +11,8 @@ using System.Text; using Microsoft.IdentityModel.Tokens; using Microsoft.OpenApi.Models; using TIAMWebApp.Shared.Application.Models; +using TIAM.Database.DataLayers.Users; +using TIAM.Database.DataLayers.TransferDestinations; var builder = WebApplication.CreateBuilder(args); @@ -18,7 +20,9 @@ var builder = WebApplication.CreateBuilder(args); builder.Services.AddControllersWithViews(); builder.Services.AddRazorPages(); -builder.Services.AddDbContext(options => options.UseSqlServer(builder.Configuration.GetConnectionString("DeveloperDbConnection")));; +//builder.Services.AddDbContext(options => options.UseSqlServer(builder.Configuration.GetConnectionString("DeveloperDbConnection")));; +builder.Services.AddScoped(); +builder.Services.AddScoped(); builder.Services.AddSwaggerGen(swagger => { diff --git a/TIAMWebApp/Shared/Interfaces/IUserDataService.cs b/TIAMWebApp/Shared/Interfaces/IUserDataService.cs index 81cbad46..eb4d9673 100644 --- a/TIAMWebApp/Shared/Interfaces/IUserDataService.cs +++ b/TIAMWebApp/Shared/Interfaces/IUserDataService.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using TIAM.Entities.Users; using TIAMWebApp.Shared.Application.Models; using TIAMWebApp.Shared.Application.Models.PageModels; @@ -10,20 +11,22 @@ namespace TIAMWebApp.Shared.Application.Interfaces { public interface IUserDataService { - public User? User { get; set; } + public UserModel? User { get; set; } public Dictionary userRoleTypes { get; set; } - public Task IsLoggedInAsync(); + public Task IsLoggedInAsync(); //mock method for now - public Task AuthorizeUserAsync(int userType); + public Task AuthorizeUserAsync(int userType); public Task AuthenticateUser(LoginModel loginModel); public Task<(bool isSuccess, string ErrorMessage)> CreateUser(RegistrationModel regModel); public Task TestUserApi(int Param); - public Task> GetUserRolesAsync(User user); + public Task> GetUserRolesAsync(UserModel userModel); + public Task?> GetUsersAsync(); + public Task GetUserByEmailAsync(string email); Task RefreshToken(); } } \ No newline at end of file diff --git a/TIAMWebApp/Shared/Models/APIUrls.cs b/TIAMWebApp/Shared/Models/APIUrls.cs index ec39ddf3..d446ec3e 100644 --- a/TIAMWebApp/Shared/Models/APIUrls.cs +++ b/TIAMWebApp/Shared/Models/APIUrls.cs @@ -9,6 +9,8 @@ namespace TIAMWebApp.Shared.Application.Models public class APIUrls { public const string UserTest = "api/UserAPI/test1"; + public const string GetUserByEmail = "api/UserAPI/GetUserByEmail"; + public const string GetUsers = "api/UserAPI/GetUsers"; public const string AuthenticateUser = "api/UserAPI/AuthenticateUser"; public const string CreateUser = "api/UserAPI/CreateUser"; public const string RefreshToken = "api/UserAPI/RefreshToken"; diff --git a/TIAMWebApp/Shared/Models/User.cs b/TIAMWebApp/Shared/Models/UserModel.cs similarity index 50% rename from TIAMWebApp/Shared/Models/User.cs rename to TIAMWebApp/Shared/Models/UserModel.cs index 99329e5d..33a4db0b 100644 --- a/TIAMWebApp/Shared/Models/User.cs +++ b/TIAMWebApp/Shared/Models/UserModel.cs @@ -1,10 +1,9 @@ -namespace TIAMWebApp.Shared.Application.Models +using TIAM.Entities.Users; + +namespace TIAMWebApp.Shared.Application.Models { - public class User + public class UserModel : User { - public Guid Id { get; set; } - public string? Email { get; set; } - public string? Password { get; set; } public string? PhoneNumber { get; set; } public bool IsLoggedIn { get; set; } public UserType UserType { get; set; } @@ -12,20 +11,12 @@ public string? RefreshToken { get; set; } public Dictionary UserRolesDictionary { get; set; } - public User(string email, string phonenumber, string password) + public UserModel(string email, string phonenumber, string password) : this(Guid.NewGuid(), email, phonenumber, password) { - Id = new Guid(); - Email = email; - Password = password; - PhoneNumber = phonenumber; - UserRolesDictionary = new Dictionary(); } - public User(Guid id, string email, string phonenumber, string password) + public UserModel(Guid id, string email, string phonenumber, string password) : base(id, email, password) { - Id = id; - Email = email; - Password = password; PhoneNumber = phonenumber; UserRolesDictionary = new Dictionary(); } diff --git a/TourIAmProject.sln b/TourIAmProject.sln index ed213675..5ff2ba6c 100644 --- a/TourIAmProject.sln +++ b/TourIAmProject.sln @@ -21,7 +21,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TIAM.Entities", "TIAM.Entit EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TIAM.Entities.Server", "TIAM.Entities.Server\TIAM.Entities.Server.csproj", "{BDDF5F32-D275-4BBB-9C81-8DCB1025A935}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TIAM.Core", "TIAM.Core\TIAM.Core.csproj", "{4FDE0CD3-5914-4919-933B-6B0E04275313}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TIAM.Core", "TIAM.Core\TIAM.Core.csproj", "{4FDE0CD3-5914-4919-933B-6B0E04275313}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution