diff --git a/Wonky.Client/HttpInterfaces/ISystemUserRepositoryGen1.cs b/Wonky.Client/HttpInterfaces/ISystemUserRepositoryGen1.cs deleted file mode 100644 index 4d9be479..00000000 --- a/Wonky.Client/HttpInterfaces/ISystemUserRepositoryGen1.cs +++ /dev/null @@ -1,77 +0,0 @@ - -// Copyright (C) 2022 FCS Frede's Computer Services. -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html] -// - -using Wonky.Entity.DTO; -using Wonky.Entity.Views; - -namespace Wonky.Client.HttpInterfaces; - -/// -/// Interface for User handling over http -/// -public interface ISystemUserRepositoryGen1 -{ - /// - /// Get Advisors (Office) - /// - /// - Task> GetUsers(); - - /// - /// Get Advisor Info for given userId - /// - /// - /// - Task GetAdvisorInfo(string userId); - - /// - /// Update Advisor using userId and updated data - /// - /// - /// - /// - Task UpdateAdvisor(string userId, X_UserUpdateDto model); - - /// - /// Get Administrative Users - /// - /// - Task> GetAdminUsers(); - - /// - /// Get Admin Info for giver userId - /// - /// - /// - Task GetAdminUserInfo(string userId); - - /// - /// Update Admin user using userId and updated data - /// - /// - /// - /// - Task UpdateAdminUser(string userId, X_UserUpdateDto model); - - /// - /// Set new user password - /// - /// - /// - /// - /// - Task ResetUserPassword(string userId, string newPasswd, string confirmPasswd); -} \ No newline at end of file diff --git a/Wonky.Client/HttpRepository/SystemUserRepositoryGen1.cs b/Wonky.Client/HttpRepository/SystemUserRepositoryGen1.cs deleted file mode 100644 index 34f8f3fb..00000000 --- a/Wonky.Client/HttpRepository/SystemUserRepositoryGen1.cs +++ /dev/null @@ -1,122 +0,0 @@ - -// Copyright (C) 2022 FCS Frede's Computer Services. -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html] -// - -using System.Net.Http.Json; -using System.Text.Json; -using Microsoft.AspNetCore.Components; -using Microsoft.Extensions.Options; -using Wonky.Client.HttpInterfaces; -using Wonky.Entity.Configuration; -using Wonky.Entity.DTO; -using Wonky.Entity.Views; - -namespace Wonky.Client.HttpRepository; - -public class SystemUserRepositoryGen1 : ISystemUserRepositoryGen1 -{ - private readonly JsonSerializerOptions? _options = new JsonSerializerOptions - { - PropertyNameCaseInsensitive = true - }; - - private readonly NavigationManager _navigation; - private ILogger _logger; - private readonly HttpClient _client; - private readonly ApiConfig _api; - - public SystemUserRepositoryGen1(HttpClient client, ILogger logger, - NavigationManager navigation, IOptions configuration) - { - _client = client; - _logger = logger; - _navigation = navigation; - _api = configuration.Value; - } - - /// - /// Get Advisors (Office) - /// - /// - public async Task> GetUsers() - { - return await _client.GetFromJsonAsync>(_api.OfficeAdvisors); - } - - /// - /// Get Advisor Info for given userId - /// - /// - /// - public async Task GetAdvisorInfo(string userId) - { - return await _client.GetFromJsonAsync($"{_api.OfficeAdvisors}/{userId}"); - } - - /// - /// Update Advisor using userId and updated data - /// - /// - /// - /// - public async Task UpdateAdvisor(string userId, X_UserUpdateDto model) - { - await _client.PutAsJsonAsync($"{_api.OfficeAdvisors}/{userId}", model, _options); - } - - /// - /// Get Administrative Users - /// - /// - public async Task> GetAdminUsers() - { - return await _client.GetFromJsonAsync>(_api.OfficeUsers); - } - - /// - /// Get Admin Info for giver userId - /// - /// - /// - public async Task GetAdminUserInfo(string userId) - { - return await _client.GetFromJsonAsync($"{_api.OfficeUsers}/{userId}"); - } - - /// - /// Update Admin user using userId and updated data - /// - /// - /// - /// - public async Task UpdateAdminUser(string userId, X_UserUpdateDto model) - { - await _client.PutAsJsonAsync($"{_api.OfficeUsers}/{userId}", model, _options); - } - - /// - /// Set new user password - /// - /// - /// - /// - /// - public async Task ResetUserPassword(string userId, string newPasswd, string confirmPasswd) - { - var passwd = new Dictionary - { { "newPassword", newPasswd }, { "confirmPassword", confirmPasswd } }; - await _client.PostAsJsonAsync($"{_api.UserManagerSetPasswd}/{userId}", passwd, _options); - } -} \ No newline at end of file diff --git a/Wonky.Client/Services/UserInfoService.cs b/Wonky.Client/Services/UserInfoService.cs new file mode 100644 index 00000000..ed583f26 --- /dev/null +++ b/Wonky.Client/Services/UserInfoService.cs @@ -0,0 +1,6 @@ +namespace Wonky.Client.Services; + +public class UserInfoService +{ + +} \ No newline at end of file diff --git a/Wonky.Entity/Views/X_UserInfoView.cs b/Wonky.Entity/Views/X_UserInfoView.cs deleted file mode 100644 index df05a66d..00000000 --- a/Wonky.Entity/Views/X_UserInfoView.cs +++ /dev/null @@ -1,39 +0,0 @@ - -// Copyright (C) 2022 FCS Frede's Computer Services. -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html] -// - -using System.Text.Json.Serialization; - -namespace Wonky.Entity.Views; - -public class X_UserInfoView -{ - [JsonPropertyName("advisor")] public string Advisor { get; set; } = ""; - [JsonPropertyName("companyId")] public string ReferenceId { get; set; } = ""; - [JsonPropertyName("countryCode")] public string CountryCode { get; set; } = ""; - [JsonPropertyName("countryName")] public string CountryName { get; set; } = ""; - [JsonPropertyName("email")] public string Email { get; set; } = ""; - [JsonPropertyName("fullName")] public string FullName { get; set; } = ""; - [JsonPropertyName("id")] public string Id { get; set; } = ""; - [JsonPropertyName("isAdmin")] public bool IsAdmin { get; set; } - [JsonPropertyName("isAdvisor")] public bool IsAdvisor { get; set; } - [JsonPropertyName("isEDoc")] public bool IsEDoc { get; set; } - [JsonPropertyName("isEShop")] public bool IsEShop { get; set; } - [JsonPropertyName("isOffice")] public bool IsOffice { get; set; } - [JsonPropertyName("isWarehouse")] public bool IsWareHouse { get; set; } - [JsonPropertyName("isSupervisor")] public bool IsSupervisor { get; set; } - [JsonPropertyName("phoneNumber")] public string PhoneNumber { get; set; } = ""; - [JsonPropertyName("roles")] public string Roles { get; set; } = ""; -} \ No newline at end of file diff --git a/Wonky.Entity/Views/WebUserInfoView.cs b/Wonky.Entity/Views/X_WebUserInfoView.cs similarity index 98% rename from Wonky.Entity/Views/WebUserInfoView.cs rename to Wonky.Entity/Views/X_WebUserInfoView.cs index a9743bb9..8e97d7f1 100644 --- a/Wonky.Entity/Views/WebUserInfoView.cs +++ b/Wonky.Entity/Views/X_WebUserInfoView.cs @@ -18,7 +18,7 @@ using System.Text.Json.Serialization; namespace Wonky.Entity.Views; -public class WebUserInfoView +public class X_WebUserInfoView { [JsonPropertyName("userId")] public string UserId { get; set; } = ""; [JsonPropertyName("salesRep")] public string Advisor { get; set; } = "";