From ad822c648aced8d2b890fd33263a1fc0dd711719 Mon Sep 17 00:00:00 2001 From: Mateusz Skoczek Date: Sat, 26 Oct 2024 02:23:33 +0200 Subject: [PATCH 01/20] basic profile info endpoints created --- .../WatchIt.Common.Model/Accounts/Account.cs | 19 +++++++++++ .../Accounts/AccountRequest.cs | 27 +++++++++++++++ .../Accounts/AccountResponse.cs | 34 +++++++++++++++++++ .../Accounts/RegisterResponse.cs | 2 +- .../AccountsController.cs | 23 ++++++++++++- .../AccountsControllerService.cs | 26 ++++++++++++++ .../IAccountsControllerService.cs | 3 ++ .../UserValidator.cs | 15 +++++++- 8 files changed, 146 insertions(+), 3 deletions(-) create mode 100644 WatchIt.Common/WatchIt.Common.Model/Accounts/Account.cs create mode 100644 WatchIt.Common/WatchIt.Common.Model/Accounts/AccountRequest.cs create mode 100644 WatchIt.Common/WatchIt.Common.Model/Accounts/AccountResponse.cs diff --git a/WatchIt.Common/WatchIt.Common.Model/Accounts/Account.cs b/WatchIt.Common/WatchIt.Common.Model/Accounts/Account.cs new file mode 100644 index 0000000..e96ec0f --- /dev/null +++ b/WatchIt.Common/WatchIt.Common.Model/Accounts/Account.cs @@ -0,0 +1,19 @@ +using System.Text.Json.Serialization; + +namespace WatchIt.Common.Model.Accounts; + +public abstract class Account +{ + #region PROPERTIES + + [JsonPropertyName("username")] + public required string Username { get; set; } + + [JsonPropertyName("email")] + public required string Email { get; set; } + + [JsonPropertyName("description")] + public string? Description { get; set; } + + #endregion +} \ No newline at end of file diff --git a/WatchIt.Common/WatchIt.Common.Model/Accounts/AccountRequest.cs b/WatchIt.Common/WatchIt.Common.Model/Accounts/AccountRequest.cs new file mode 100644 index 0000000..37bfeae --- /dev/null +++ b/WatchIt.Common/WatchIt.Common.Model/Accounts/AccountRequest.cs @@ -0,0 +1,27 @@ +using System.Text.Json.Serialization; + +namespace WatchIt.Common.Model.Accounts; + +public class AccountRequest : Account +{ + #region PROPERTIES + + [JsonPropertyName("gender_id")] + public short GenderId { get; set; } + + #endregion + + + + #region PUBLIC METHODS + + public void UpdateAccount(Database.Model.Account.Account account) + { + account.Username = Username; + account.Email = Email; + account.Description = Description; + account.GenderId = GenderId; + } + + #endregion +} \ No newline at end of file diff --git a/WatchIt.Common/WatchIt.Common.Model/Accounts/AccountResponse.cs b/WatchIt.Common/WatchIt.Common.Model/Accounts/AccountResponse.cs new file mode 100644 index 0000000..1595aa8 --- /dev/null +++ b/WatchIt.Common/WatchIt.Common.Model/Accounts/AccountResponse.cs @@ -0,0 +1,34 @@ +using System.Diagnostics.CodeAnalysis; +using System.Text.Json.Serialization; +using WatchIt.Common.Model.Genders; + +namespace WatchIt.Common.Model.Accounts; + +public class AccountResponse : Account +{ + #region PROPERTIES + + [JsonPropertyName("id")] + public required long Id { get; set; } + + [JsonPropertyName("gender")] + public GenderResponse? Gender { get; set; } + + #endregion + + + + #region CONSTRUCTORS + + [SetsRequiredMembers] + public AccountResponse(Database.Model.Account.Account account) + { + Id = account.Id; + Username = account.Username; + Email = account.Email; + Description = account.Description; + Gender = account.Gender is not null ? new GenderResponse(account.Gender) : null; + } + + #endregion +} \ No newline at end of file diff --git a/WatchIt.Common/WatchIt.Common.Model/Accounts/RegisterResponse.cs b/WatchIt.Common/WatchIt.Common.Model/Accounts/RegisterResponse.cs index 335ed0c..b6d904e 100644 --- a/WatchIt.Common/WatchIt.Common.Model/Accounts/RegisterResponse.cs +++ b/WatchIt.Common/WatchIt.Common.Model/Accounts/RegisterResponse.cs @@ -30,7 +30,7 @@ public class RegisterResponse public RegisterResponse() {} [SetsRequiredMembers] - public RegisterResponse(Account account) + public RegisterResponse(Database.Model.Account.Account account) { Id = account.Id; Username = account.Username; diff --git a/WatchIt.WebAPI/WatchIt.WebAPI.Controllers/AccountsController.cs b/WatchIt.WebAPI/WatchIt.WebAPI.Controllers/AccountsController.cs index d1a3de0..c431396 100644 --- a/WatchIt.WebAPI/WatchIt.WebAPI.Controllers/AccountsController.cs +++ b/WatchIt.WebAPI/WatchIt.WebAPI.Controllers/AccountsController.cs @@ -1,4 +1,5 @@ -using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Authentication.JwtBearer; +using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using WatchIt.Common.Model.Accounts; @@ -41,4 +42,24 @@ public class AccountsController(IAccountsControllerService accountsControllerSer [ProducesResponseType(typeof(ValidationProblemDetails), StatusCodes.Status400BadRequest)] [ProducesResponseType(StatusCodes.Status404NotFound)] public async Task GetAccountProfilePicture([FromRoute(Name = "id")]long id) => await accountsControllerService.GetAccountProfilePicture(id); + + [HttpGet("{id}/info")] + [AllowAnonymous] + [ProducesResponseType(typeof(AccountResponse), StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status404NotFound)] + public async Task GetAccountInfo([FromRoute]long id) => await accountsControllerService.GetAccountInfo(id); + + [HttpGet("info")] + [Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme)] + [ProducesResponseType(typeof(AccountResponse), StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status401Unauthorized)] + [ProducesResponseType(StatusCodes.Status404NotFound)] + public async Task GetAccountInfo() => await accountsControllerService.GetAccountInfo(); + + [HttpPut("info")] + [Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme)] + [ProducesResponseType(typeof(AccountResponse), StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status401Unauthorized)] + [ProducesResponseType(StatusCodes.Status404NotFound)] + public async Task PutAccountInfo([FromBody]AccountRequest data) => await accountsControllerService.PutAccountInfo(data); } \ No newline at end of file diff --git a/WatchIt.WebAPI/WatchIt.WebAPI.Services/WatchIt.WebAPI.Services.Controllers/WatchIt.WebAPI.Services.Controllers.Accounts/AccountsControllerService.cs b/WatchIt.WebAPI/WatchIt.WebAPI.Services/WatchIt.WebAPI.Services.Controllers/WatchIt.WebAPI.Services.Controllers.Accounts/AccountsControllerService.cs index 3cbdf70..df37957 100644 --- a/WatchIt.WebAPI/WatchIt.WebAPI.Services/WatchIt.WebAPI.Services.Controllers/WatchIt.WebAPI.Services.Controllers.Accounts/AccountsControllerService.cs +++ b/WatchIt.WebAPI/WatchIt.WebAPI.Services/WatchIt.WebAPI.Services.Controllers/WatchIt.WebAPI.Services.Controllers.Accounts/AccountsControllerService.cs @@ -11,6 +11,7 @@ using WatchIt.WebAPI.Services.Controllers.Common; using WatchIt.WebAPI.Services.Utility.Tokens; using WatchIt.WebAPI.Services.Utility.Tokens.Exceptions; using WatchIt.WebAPI.Services.Utility.User; +using Account = WatchIt.Database.Model.Account.Account; using AccountProfilePicture = WatchIt.Common.Model.Accounts.AccountProfilePicture; namespace WatchIt.WebAPI.Services.Controllers.Accounts; @@ -129,6 +130,31 @@ public class AccountsControllerService( return RequestResult.Ok(picture); } + public async Task GetAccountInfo() => await GetAccountInfo(userService.GetUserId()); + public async Task GetAccountInfo(long id) + { + Account? account = await database.Accounts.FirstOrDefaultAsync(x => x.Id == id); + if (account is null) + { + return RequestResult.NotFound(); + } + + AccountResponse response = new AccountResponse(account); + return RequestResult.Ok(response); + } + + public async Task PutAccountInfo(AccountRequest data) + { + Account? account = await database.Accounts.FirstOrDefaultAsync(x => x.Id == userService.GetUserId()); + if (account is null) + { + return RequestResult.NotFound(); + } + + data.UpdateAccount(account); + return RequestResult.Ok(); + } + #endregion diff --git a/WatchIt.WebAPI/WatchIt.WebAPI.Services/WatchIt.WebAPI.Services.Controllers/WatchIt.WebAPI.Services.Controllers.Accounts/IAccountsControllerService.cs b/WatchIt.WebAPI/WatchIt.WebAPI.Services/WatchIt.WebAPI.Services.Controllers/WatchIt.WebAPI.Services.Controllers.Accounts/IAccountsControllerService.cs index 4d7974d..03098fe 100644 --- a/WatchIt.WebAPI/WatchIt.WebAPI.Services/WatchIt.WebAPI.Services.Controllers/WatchIt.WebAPI.Services.Controllers.Accounts/IAccountsControllerService.cs +++ b/WatchIt.WebAPI/WatchIt.WebAPI.Services/WatchIt.WebAPI.Services.Controllers/WatchIt.WebAPI.Services.Controllers.Accounts/IAccountsControllerService.cs @@ -10,4 +10,7 @@ public interface IAccountsControllerService Task AuthenticateRefresh(); Task Logout(); Task GetAccountProfilePicture(long id); + Task GetAccountInfo(); + Task GetAccountInfo(long id); + Task PutAccountInfo(AccountRequest data); } \ No newline at end of file diff --git a/WatchIt.WebAPI/WatchIt.WebAPI.Services/WatchIt.WebAPI.Services.Utility/WatchIt.WebAPI.Services.Utility.User/UserValidator.cs b/WatchIt.WebAPI/WatchIt.WebAPI.Services/WatchIt.WebAPI.Services.Utility/WatchIt.WebAPI.Services.Utility.User/UserValidator.cs index b3ae31d..3dc0c41 100644 --- a/WatchIt.WebAPI/WatchIt.WebAPI.Services/WatchIt.WebAPI.Services.Utility/WatchIt.WebAPI.Services.Utility.User/UserValidator.cs +++ b/WatchIt.WebAPI/WatchIt.WebAPI.Services/WatchIt.WebAPI.Services.Utility/WatchIt.WebAPI.Services.Utility.User/UserValidator.cs @@ -1,4 +1,5 @@ -using System.Security.Claims; +using System.IdentityModel.Tokens.Jwt; +using System.Security.Claims; using WatchIt.Database; namespace WatchIt.WebAPI.Services.Utility.User; @@ -53,5 +54,17 @@ public class UserValidator return this; } + public UserValidator MustHaveId(long id) + { + Claim adminClaim = _claimsPrincipal.FindFirst(x => x.Type == JwtRegisteredClaimNames.Sub)!; + if (adminClaim.Value == id.ToString()) + { + IsValid = false; + _validationErrors.Add("User have wrong id"); + } + + return this; + } + #endregion } \ No newline at end of file From 89dc74f76778c8d348348fa7061c8b9c2d5077d8 Mon Sep 17 00:00:00 2001 From: Mateusz Skoczek Date: Sun, 27 Oct 2024 20:22:55 +0100 Subject: [PATCH 02/20] client methods for account info endpoints --- .../Accounts/AccountRequest.cs | 2 +- .../Accounts/AccountRequestValidator.cs | 21 ++++++++++ WatchIt.WebAPI/WatchIt.WebAPI/Program.cs | 1 + .../Model/Accounts.cs | 3 ++ .../AccountsWebAPIService.cs | 39 +++++++++++++++++++ .../IAccountsWebAPIService.cs | 3 ++ .../WatchIt.Website/appsettings.json | 5 ++- 7 files changed, 72 insertions(+), 2 deletions(-) create mode 100644 WatchIt.WebAPI/WatchIt.WebAPI.Validators/Accounts/AccountRequestValidator.cs diff --git a/WatchIt.Common/WatchIt.Common.Model/Accounts/AccountRequest.cs b/WatchIt.Common/WatchIt.Common.Model/Accounts/AccountRequest.cs index 37bfeae..30b1d7b 100644 --- a/WatchIt.Common/WatchIt.Common.Model/Accounts/AccountRequest.cs +++ b/WatchIt.Common/WatchIt.Common.Model/Accounts/AccountRequest.cs @@ -7,7 +7,7 @@ public class AccountRequest : Account #region PROPERTIES [JsonPropertyName("gender_id")] - public short GenderId { get; set; } + public short? GenderId { get; set; } #endregion diff --git a/WatchIt.WebAPI/WatchIt.WebAPI.Validators/Accounts/AccountRequestValidator.cs b/WatchIt.WebAPI/WatchIt.WebAPI.Validators/Accounts/AccountRequestValidator.cs new file mode 100644 index 0000000..a5b3265 --- /dev/null +++ b/WatchIt.WebAPI/WatchIt.WebAPI.Validators/Accounts/AccountRequestValidator.cs @@ -0,0 +1,21 @@ +using FluentValidation; +using WatchIt.Common.Model.Accounts; +using WatchIt.Database; + +namespace WatchIt.WebAPI.Validators.Accounts; + +public class AccountRequestValidator : AbstractValidator +{ + public AccountRequestValidator(DatabaseContext database) + { + RuleFor(x => x.Username).NotEmpty() + .MaximumLength(50); + RuleFor(x => x.Email).EmailAddress() + .MaximumLength(320); + RuleFor(x => x.Description).MaximumLength(1000); + When(x => x.GenderId.HasValue, () => + { + RuleFor(x => x.GenderId!.Value).MustBeIn(database.Genders.Select(x => x.Id)); + }); + } +} \ No newline at end of file diff --git a/WatchIt.WebAPI/WatchIt.WebAPI/Program.cs b/WatchIt.WebAPI/WatchIt.WebAPI/Program.cs index d6c6797..581c7c6 100644 --- a/WatchIt.WebAPI/WatchIt.WebAPI/Program.cs +++ b/WatchIt.WebAPI/WatchIt.WebAPI/Program.cs @@ -46,6 +46,7 @@ public static class Program while (!dbContext.Database.CanConnect()) { + app.Logger.LogInformation("Waiting for database..."); Thread.Sleep(1000); } diff --git a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Utility.Configuration/Model/Accounts.cs b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Utility.Configuration/Model/Accounts.cs index ba1f2db..c8f50a5 100644 --- a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Utility.Configuration/Model/Accounts.cs +++ b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Utility.Configuration/Model/Accounts.cs @@ -8,4 +8,7 @@ public class Accounts public string AuthenticateRefresh { get; set; } public string Logout { get; set; } public string GetProfilePicture { get; set; } + public string GetAccountInfoById { get; set; } + public string GetAccountInfo { get; set; } + public string PutAccountInfo { get; set; } } \ No newline at end of file diff --git a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Accounts/AccountsWebAPIService.cs b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Accounts/AccountsWebAPIService.cs index f56757e..5e1c092 100644 --- a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Accounts/AccountsWebAPIService.cs +++ b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Accounts/AccountsWebAPIService.cs @@ -80,6 +80,45 @@ public class AccountsWebAPIService(IHttpClientService httpClientService, IConfig .ExecuteAction(); } + public async Task GetAccountInfoById(long id, Action? successAction = null, Action? notFoundAction = null) + { + string url = GetUrl(EndpointsConfiguration.Accounts.GetAccountInfoById, id); + HttpRequest request = new HttpRequest(HttpMethodType.Get, url); + + HttpResponse response = await httpClientService.SendRequestAsync(request); + response.RegisterActionFor2XXSuccess(successAction) + .RegisterActionFor404NotFound(notFoundAction) + .ExecuteAction(); + } + + public async Task GetAccountInfo(Action? successAction = null, Action? unauthorizedAction = null, Action? notFoundAction = null) + { + string url = GetUrl(EndpointsConfiguration.Accounts.GetAccountInfo); + HttpRequest request = new HttpRequest(HttpMethodType.Get, url); + + HttpResponse response = await httpClientService.SendRequestAsync(request); + response.RegisterActionFor2XXSuccess(successAction) + .RegisterActionFor401Unauthorized(unauthorizedAction) + .RegisterActionFor404NotFound(notFoundAction) + .ExecuteAction(); + } + + public async Task PutAccountInfo(AccountRequest data, Action? successAction = null, Action>? badRequestAction = null, Action? unauthorizedAction = null, Action? notFoundAction = null) + { + string url = GetUrl(EndpointsConfiguration.Accounts.PutAccountInfo); + HttpRequest request = new HttpRequest(HttpMethodType.Put, url) + { + Body = data, + }; + + HttpResponse response = await httpClientService.SendRequestAsync(request); + response.RegisterActionFor2XXSuccess(successAction) + .RegisterActionFor400BadRequest(badRequestAction) + .RegisterActionFor401Unauthorized(unauthorizedAction) + .RegisterActionFor404NotFound(notFoundAction) + .ExecuteAction(); + } + #endregion diff --git a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Accounts/IAccountsWebAPIService.cs b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Accounts/IAccountsWebAPIService.cs index a2e0df5..8aed63e 100644 --- a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Accounts/IAccountsWebAPIService.cs +++ b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Accounts/IAccountsWebAPIService.cs @@ -9,4 +9,7 @@ public interface IAccountsWebAPIService Task AuthenticateRefresh(Action? successAction = null, Action? unauthorizedAction = null, Action? forbiddenAction = null); Task Logout(Action? successAction = null); Task GetAccountProfilePicture(long id, Action? successAction = null, Action>? badRequestAction = null, Action? notFoundAction = null); + Task GetAccountInfoById(long id, Action? successAction = null, Action? notFoundAction = null); + Task GetAccountInfo(Action? successAction = null, Action? unauthorizedAction = null, Action? notFoundAction = null); + Task PutAccountInfo(AccountRequest data, Action? successAction = null, Action>? badRequestAction = null, Action? unauthorizedAction = null, Action? notFoundAction = null); } \ No newline at end of file diff --git a/WatchIt.Website/WatchIt.Website/appsettings.json b/WatchIt.Website/WatchIt.Website/appsettings.json index 2e65e00..3613545 100644 --- a/WatchIt.Website/WatchIt.Website/appsettings.json +++ b/WatchIt.Website/WatchIt.Website/appsettings.json @@ -21,7 +21,10 @@ "Authenticate": "/authenticate", "AuthenticateRefresh": "/authenticate-refresh", "Logout": "/logout", - "GetProfilePicture": "/{0}/profile-picture" + "GetProfilePicture": "/{0}/profile-picture", + "GetAccountInfoById": "/{0}/info", + "GetAccountInfo": "/info", + "PutAccountInfo": "/info" }, "Genders": { "Base": "/genders", From 291982cf958658564893957142d99bad91f0301b Mon Sep 17 00:00:00 2001 From: Mateusz Skoczek Date: Sun, 27 Oct 2024 22:09:46 +0100 Subject: [PATCH 03/20] Website services organized --- .../AuthenticationService.cs | 14 +-- .../IAuthenticationService.cs | 2 +- .../JWTAuthenticationStateProvider.cs | 10 +- .../User.cs | 2 +- ...hIt.Website.Services.Authentication.csproj | 24 ++++ .../Accounts/AccountsClientService.cs} | 10 +- .../Accounts/IAccountsClientService.cs} | 4 +- .../AuthorizationType.cs | 2 +- .../BaseClientService.cs} | 11 +- .../Genders/GendersClientService.cs} | 9 +- .../Genders/IGendersClientService.cs} | 4 +- .../Media/IMediaClientService.cs} | 4 +- .../Media/MediaClientService.cs} | 10 +- .../Movies/IMoviesClientService.cs} | 4 +- .../Movies/MoviesClientService.cs} | 9 +- .../Persons/IPersonsClientService.cs} | 4 +- .../Persons/PersonsClientService.cs} | 9 +- .../Photos/IPhotosClientService.cs} | 4 +- .../Photos/PhotosClientService.cs} | 9 +- .../Roles/IRolesClientService.cs} | 4 +- .../Roles/RolesClientService.cs} | 9 +- .../Series/ISeriesClientService.cs} | 4 +- .../Series/SeriesClientService.cs} | 9 +- .../WatchIt.Website.Services.Client.csproj | 16 +++ .../ITokensService.cs | 2 +- .../TokensService.cs | 4 +- .../WatchIt.Website.Services.Tokens.csproj} | 5 +- .../ConfigurationService.cs | 4 +- .../IConfigurationService.cs | 8 ++ .../Model/Accounts.cs | 2 +- .../Model/ConfigurationData.cs | 2 +- .../Model/Endpoints.cs | 2 +- .../Model/Genders.cs | 2 +- .../Model/Genres.cs | 2 +- .../Model/LogLevel.cs | 2 +- .../Model/Logging.cs | 2 +- .../Model/Media.cs | 2 +- .../Model/Movies.cs | 2 +- .../Model/Persons.cs | 2 +- .../Model/Photos.cs | 2 +- .../Model/Roles.cs | 2 +- .../Model/Series.cs | 2 +- .../Model/StorageKeys.cs | 2 +- .../Model/Style.cs | 2 +- ...hIt.Website.Services.Configuration.csproj} | 0 ...ite.Services.Utility.Authentication.csproj | 19 --- .../IConfigurationService.cs | 8 -- ...It.Website.Services.WebAPI.Accounts.csproj | 16 --- ...chIt.Website.Services.WebAPI.Common.csproj | 15 --- ...hIt.Website.Services.WebAPI.Genders.csproj | 14 --- ...chIt.Website.Services.WebAPI.Genres.csproj | 9 -- ...tchIt.Website.Services.WebAPI.Media.csproj | 16 --- ...chIt.Website.Services.WebAPI.Movies.csproj | 23 ---- ...hIt.Website.Services.WebAPI.Persons.csproj | 14 --- ...chIt.Website.Services.WebAPI.Photos.csproj | 15 --- ...tchIt.Website.Services.WebAPI.Roles.csproj | 14 --- ...chIt.Website.Services.WebAPI.Series.csproj | 14 --- .../Subcomponents/ListItemComponent.razor.cs | 2 +- .../PersonsFilterFormComponent.razor.cs | 6 +- ...MediaActorRolesEditPanelComponent.razor.cs | 22 ++-- ...diaCreatorRolesEditPanelComponent.razor.cs | 22 ++-- .../MediaActorRolesPanelComponent.razor | 14 +-- .../MediaActorRolesPanelComponent.razor.cs | 14 +-- .../MediaCreatorRolesPanelComponent.razor | 14 +-- .../MediaCreatorRolesPanelComponent.razor.cs | 16 +-- ...ersonActorRolesEditPanelComponent.razor.cs | 22 ++-- ...sonCreatorRolesEditPanelComponent.razor.cs | 22 ++-- .../PersonEditFormPanelComponent.razor.cs | 16 +-- .../PersonActorRolesPanelComponent.razor | 14 +-- .../PersonActorRolesPanelComponent.razor.cs | 12 +- .../PersonCreatorRolesPanelComponent.razor | 14 +-- .../PersonCreatorRolesPanelComponent.razor.cs | 14 +-- .../Panels/PersonRatingPanel.razor.cs | 10 +- .../WatchIt.Website/Layout/MainLayout.razor | 2 +- .../Layout/MainLayout.razor.cs | 20 ++-- .../WatchIt.Website/Pages/AdminPage.razor.cs | 2 +- .../WatchIt.Website/Pages/AdminPage.razor.css | 1 - .../WatchIt.Website/Pages/AuthPage.razor.cs | 22 ++-- .../WatchIt.Website/Pages/DatabasePage.razor | 30 ++--- .../Pages/DatabasePage.razor.cs | 16 +-- .../Pages/DatabasePage.razor.css | 0 .../WatchIt.Website/Pages/HomePage.razor | 12 +- .../WatchIt.Website/Pages/HomePage.razor.cs | 16 +-- .../WatchIt.Website/Pages/HomePage.razor.css | 0 .../WatchIt.Website/Pages/MediaEditPage.razor | 6 +- .../Pages/MediaEditPage.razor.cs | 56 ++++----- .../WatchIt.Website/Pages/MediaPage.razor | 2 +- .../WatchIt.Website/Pages/MediaPage.razor.cs | 34 +++--- .../Pages/PersonEditPage.razor | 6 +- .../Pages/PersonEditPage.razor.cs | 14 +-- .../Pages/PersonEditPage.razor.css | 0 .../WatchIt.Website/Pages/PersonPage.razor | 2 +- .../WatchIt.Website/Pages/PersonPage.razor.cs | 8 +- .../Pages/PersonPage.razor.css | 0 .../WatchIt.Website/Pages/SearchPage.razor | 30 ++--- .../WatchIt.Website/Pages/SearchPage.razor.cs | 16 +-- .../Pages/SearchPage.razor.css | 0 .../WatchIt.Website/Pages/UserEditPage.razor | 1 + .../Pages/UserEditPage.razor.cs | 7 ++ .../WatchIt.Website/Pages/UserPage.razor | 1 + .../WatchIt.Website/Pages/UserPage.razor.cs | 7 ++ WatchIt.Website/WatchIt.Website/Program.cs | 38 +++--- .../WatchIt.Website/WatchIt.Website.csproj | 13 +- .../WatchIt.Website/_Imports.razor | 8 +- WatchIt.sln | 113 ++++-------------- 105 files changed, 465 insertions(+), 669 deletions(-) rename WatchIt.Website/WatchIt.Website.Services/{WatchIt.Website.Services.Utility/WatchIt.Website.Services.Utility.Authentication => WatchIt.Website.Services.Authentication}/AuthenticationService.cs (85%) rename WatchIt.Website/WatchIt.Website.Services/{WatchIt.Website.Services.Utility/WatchIt.Website.Services.Utility.Authentication => WatchIt.Website.Services.Authentication}/IAuthenticationService.cs (70%) rename WatchIt.Website/WatchIt.Website.Services/{WatchIt.Website.Services.Utility/WatchIt.Website.Services.Utility.Authentication => WatchIt.Website.Services.Authentication}/JWTAuthenticationStateProvider.cs (94%) rename WatchIt.Website/WatchIt.Website.Services/{WatchIt.Website.Services.Utility/WatchIt.Website.Services.Utility.Authentication => WatchIt.Website.Services.Authentication}/User.cs (80%) create mode 100644 WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Authentication/WatchIt.Website.Services.Authentication.csproj rename WatchIt.Website/WatchIt.Website.Services/{WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Accounts/AccountsWebAPIService.cs => WatchIt.Website.Services.Client/Accounts/AccountsClientService.cs} (93%) rename WatchIt.Website/WatchIt.Website.Services/{WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Accounts/IAccountsWebAPIService.cs => WatchIt.Website.Services.Client/Accounts/IAccountsClientService.cs} (93%) rename WatchIt.Website/WatchIt.Website.Services/{WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Common => WatchIt.Website.Services.Client}/AuthorizationType.cs (52%) rename WatchIt.Website/WatchIt.Website.Services/{WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Common/BaseWebAPIService.cs => WatchIt.Website.Services.Client/BaseClientService.cs} (71%) rename WatchIt.Website/WatchIt.Website.Services/{WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Genders/GendersWebAPIService.cs => WatchIt.Website.Services.Client/Genders/GendersClientService.cs} (91%) rename WatchIt.Website/WatchIt.Website.Services/{WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Genders/IGendersWebAPIService.cs => WatchIt.Website.Services.Client/Genders/IGendersClientService.cs} (87%) rename WatchIt.Website/WatchIt.Website.Services/{WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Media/IMediaWebAPIService.cs => WatchIt.Website.Services.Client/Media/IMediaClientService.cs} (97%) rename WatchIt.Website/WatchIt.Website.Services/{WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Media/MediaWebAPIService.cs => WatchIt.Website.Services.Client/Media/MediaClientService.cs} (97%) rename WatchIt.Website/WatchIt.Website.Services/{WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Movies/IMoviesWebAPIService.cs => WatchIt.Website.Services.Client/Movies/IMoviesClientService.cs} (91%) rename WatchIt.Website/WatchIt.Website.Services/{WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Movies/MoviesWebAPIService.cs => WatchIt.Website.Services.Client/Movies/MoviesClientService.cs} (94%) rename WatchIt.Website/WatchIt.Website.Services/{WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Persons/IPersonsWebAPIService.cs => WatchIt.Website.Services.Client/Persons/IPersonsClientService.cs} (96%) rename WatchIt.Website/WatchIt.Website.Services/{WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Persons/PersonsWebAPIService.cs => WatchIt.Website.Services.Client/Persons/PersonsClientService.cs} (97%) rename WatchIt.Website/WatchIt.Website.Services/{WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Photos/IPhotosWebAPIService.cs => WatchIt.Website.Services.Client/Photos/IPhotosClientService.cs} (89%) rename WatchIt.Website/WatchIt.Website.Services/{WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Photos/PhotosWebAPIService.cs => WatchIt.Website.Services.Client/Photos/PhotosClientService.cs} (92%) rename WatchIt.Website/WatchIt.Website.Services/{WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Roles/IRolesWebAPIService.cs => WatchIt.Website.Services.Client/Roles/IRolesClientService.cs} (97%) rename WatchIt.Website/WatchIt.Website.Services/{WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Roles/RolesWebAPIService.cs => WatchIt.Website.Services.Client/Roles/RolesClientService.cs} (98%) rename WatchIt.Website/WatchIt.Website.Services/{WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Series/ISeriesWebAPIService.cs => WatchIt.Website.Services.Client/Series/ISeriesClientService.cs} (91%) rename WatchIt.Website/WatchIt.Website.Services/{WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Series/SeriesWebAPIService.cs => WatchIt.Website.Services.Client/Series/SeriesClientService.cs} (94%) create mode 100644 WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/WatchIt.Website.Services.Client.csproj rename WatchIt.Website/WatchIt.Website.Services/{WatchIt.Website.Services.Utility/WatchIt.Website.Services.Utility.Tokens => WatchIt.Website.Services.Tokens}/ITokensService.cs (89%) rename WatchIt.Website/WatchIt.Website.Services/{WatchIt.Website.Services.Utility/WatchIt.Website.Services.Utility.Tokens => WatchIt.Website.Services.Tokens}/TokensService.cs (96%) rename WatchIt.Website/WatchIt.Website.Services/{WatchIt.Website.Services.Utility/WatchIt.Website.Services.Utility.Tokens/WatchIt.Website.Services.Utility.Tokens.csproj => WatchIt.Website.Services.Tokens/WatchIt.Website.Services.Tokens.csproj} (54%) rename WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/{WatchIt.Website.Services.Utility.Configuration => WatchIt.Website.Services.Configuration}/ConfigurationService.cs (68%) create mode 100644 WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Configuration/IConfigurationService.cs rename WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/{WatchIt.Website.Services.Utility.Configuration => WatchIt.Website.Services.Configuration}/Model/Accounts.cs (86%) rename WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/{WatchIt.Website.Services.Utility.Configuration => WatchIt.Website.Services.Configuration}/Model/ConfigurationData.cs (78%) rename WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/{WatchIt.Website.Services.Utility.Configuration => WatchIt.Website.Services.Configuration}/Model/Endpoints.cs (86%) rename WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/{WatchIt.Website.Services.Utility.Configuration => WatchIt.Website.Services.Configuration}/Model/Genders.cs (78%) rename WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/{WatchIt.Website.Services.Utility.Configuration => WatchIt.Website.Services.Configuration}/Model/Genres.cs (78%) rename WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/{WatchIt.Website.Services.Utility.Configuration => WatchIt.Website.Services.Configuration}/Model/LogLevel.cs (63%) rename WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/{WatchIt.Website.Services.Utility.Configuration => WatchIt.Website.Services.Configuration}/Model/Logging.cs (50%) rename WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/{WatchIt.Website.Services.Utility.Configuration => WatchIt.Website.Services.Configuration}/Model/Media.cs (93%) rename WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/{WatchIt.Website.Services.Utility.Configuration => WatchIt.Website.Services.Configuration}/Model/Movies.cs (82%) rename WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/{WatchIt.Website.Services.Utility.Configuration => WatchIt.Website.Services.Configuration}/Model/Persons.cs (92%) rename WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/{WatchIt.Website.Services.Utility.Configuration => WatchIt.Website.Services.Configuration}/Model/Photos.cs (81%) rename WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/{WatchIt.Website.Services.Utility.Configuration => WatchIt.Website.Services.Configuration}/Model/Roles.cs (94%) rename WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/{WatchIt.Website.Services.Utility.Configuration => WatchIt.Website.Services.Configuration}/Model/Series.cs (83%) rename WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/{WatchIt.Website.Services.Utility.Configuration => WatchIt.Website.Services.Configuration}/Model/StorageKeys.cs (63%) rename WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/{WatchIt.Website.Services.Utility.Configuration => WatchIt.Website.Services.Configuration}/Model/Style.cs (52%) rename WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/{WatchIt.Website.Services.Utility.Configuration/WatchIt.Website.Services.Utility.Configuration.csproj => WatchIt.Website.Services.Configuration/WatchIt.Website.Services.Configuration.csproj} (100%) delete mode 100644 WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Utility.Authentication/WatchIt.Website.Services.Utility.Authentication.csproj delete mode 100644 WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Utility.Configuration/IConfigurationService.cs delete mode 100644 WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Accounts/WatchIt.Website.Services.WebAPI.Accounts.csproj delete mode 100644 WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Common/WatchIt.Website.Services.WebAPI.Common.csproj delete mode 100644 WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Genders/WatchIt.Website.Services.WebAPI.Genders.csproj delete mode 100644 WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Genres/WatchIt.Website.Services.WebAPI.Genres.csproj delete mode 100644 WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Media/WatchIt.Website.Services.WebAPI.Media.csproj delete mode 100644 WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Movies/WatchIt.Website.Services.WebAPI.Movies.csproj delete mode 100644 WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Persons/WatchIt.Website.Services.WebAPI.Persons.csproj delete mode 100644 WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Photos/WatchIt.Website.Services.WebAPI.Photos.csproj delete mode 100644 WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Roles/WatchIt.Website.Services.WebAPI.Roles.csproj delete mode 100644 WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Series/WatchIt.Website.Services.WebAPI.Series.csproj delete mode 100644 WatchIt.Website/WatchIt.Website/Pages/AdminPage.razor.css delete mode 100644 WatchIt.Website/WatchIt.Website/Pages/DatabasePage.razor.css delete mode 100644 WatchIt.Website/WatchIt.Website/Pages/HomePage.razor.css delete mode 100644 WatchIt.Website/WatchIt.Website/Pages/PersonEditPage.razor.css delete mode 100644 WatchIt.Website/WatchIt.Website/Pages/PersonPage.razor.css delete mode 100644 WatchIt.Website/WatchIt.Website/Pages/SearchPage.razor.css create mode 100644 WatchIt.Website/WatchIt.Website/Pages/UserEditPage.razor create mode 100644 WatchIt.Website/WatchIt.Website/Pages/UserEditPage.razor.cs create mode 100644 WatchIt.Website/WatchIt.Website/Pages/UserPage.razor create mode 100644 WatchIt.Website/WatchIt.Website/Pages/UserPage.razor.cs diff --git a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Utility.Authentication/AuthenticationService.cs b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Authentication/AuthenticationService.cs similarity index 85% rename from WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Utility.Authentication/AuthenticationService.cs rename to WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Authentication/AuthenticationService.cs index efe799c..9f57109 100644 --- a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Utility.Authentication/AuthenticationService.cs +++ b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Authentication/AuthenticationService.cs @@ -1,10 +1,10 @@ using System.IdentityModel.Tokens.Jwt; using System.Net.Http.Headers; using Microsoft.AspNetCore.Components.Authorization; -using WatchIt.Website.Services.Utility.Tokens; -using WatchIt.Website.Services.WebAPI.Accounts; +using WatchIt.Website.Services.Client.Accounts; +using WatchIt.Website.Services.Tokens; -namespace WatchIt.Website.Services.Utility.Authentication; +namespace WatchIt.Website.Services.Authentication; public class AuthenticationService : IAuthenticationService { @@ -13,7 +13,7 @@ public class AuthenticationService : IAuthenticationService private readonly AuthenticationStateProvider _authenticationStateProvider; private readonly HttpClient _httpClient; private readonly ITokensService _tokensService; - private readonly IAccountsWebAPIService _accountsWebAPIService; + private readonly IAccountsClientService _accountsClientService; #endregion @@ -21,12 +21,12 @@ public class AuthenticationService : IAuthenticationService #region CONSTRUCTORS - public AuthenticationService(AuthenticationStateProvider authenticationStateProvider, HttpClient httpClient, ITokensService tokensService, IAccountsWebAPIService accountsWebAPIService) + public AuthenticationService(AuthenticationStateProvider authenticationStateProvider, HttpClient httpClient, ITokensService tokensService, IAccountsClientService accountsClientService) { _authenticationStateProvider = authenticationStateProvider; _httpClient = httpClient; _tokensService = tokensService; - _accountsWebAPIService = accountsWebAPIService; + _accountsClientService = accountsClientService; } #endregion @@ -65,7 +65,7 @@ public class AuthenticationService : IAuthenticationService if (refreshToken is not null) { _httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("refresh", refreshToken.Replace("\"", "")); - await _accountsWebAPIService.Logout(); + await _accountsClientService.Logout(); _httpClient.DefaultRequestHeaders.Authorization = null; } } diff --git a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Utility.Authentication/IAuthenticationService.cs b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Authentication/IAuthenticationService.cs similarity index 70% rename from WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Utility.Authentication/IAuthenticationService.cs rename to WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Authentication/IAuthenticationService.cs index 68ef29c..99a4ac9 100644 --- a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Utility.Authentication/IAuthenticationService.cs +++ b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Authentication/IAuthenticationService.cs @@ -1,4 +1,4 @@ -namespace WatchIt.Website.Services.Utility.Authentication; +namespace WatchIt.Website.Services.Authentication; public interface IAuthenticationService { diff --git a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Utility.Authentication/JWTAuthenticationStateProvider.cs b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Authentication/JWTAuthenticationStateProvider.cs similarity index 94% rename from WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Utility.Authentication/JWTAuthenticationStateProvider.cs rename to WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Authentication/JWTAuthenticationStateProvider.cs index 3646136..b86ccbe 100644 --- a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Utility.Authentication/JWTAuthenticationStateProvider.cs +++ b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Authentication/JWTAuthenticationStateProvider.cs @@ -4,10 +4,10 @@ using System.Text.Json; using Microsoft.AspNetCore.Components.Authorization; using Microsoft.Extensions.Logging; using WatchIt.Common.Model.Accounts; -using WatchIt.Website.Services.Utility.Tokens; -using WatchIt.Website.Services.WebAPI.Accounts; +using WatchIt.Website.Services.Tokens; +using WatchIt.Website.Services.Client.Accounts; -namespace WatchIt.Website.Services.Utility.Authentication; +namespace WatchIt.Website.Services.Authentication; public class JWTAuthenticationStateProvider : AuthenticationStateProvider { @@ -18,7 +18,7 @@ public class JWTAuthenticationStateProvider : AuthenticationStateProvider private readonly ILogger _logger; private readonly ITokensService _tokensService; - private readonly IAccountsWebAPIService _accountsService; + private readonly IAccountsClientService _accountsService; #endregion @@ -26,7 +26,7 @@ public class JWTAuthenticationStateProvider : AuthenticationStateProvider #region CONSTRUCTORS - public JWTAuthenticationStateProvider(HttpClient httpClient, ILogger logger, ITokensService tokensService, IAccountsWebAPIService accountsService) + public JWTAuthenticationStateProvider(HttpClient httpClient, ILogger logger, ITokensService tokensService, IAccountsClientService accountsService) { _httpClient = httpClient; diff --git a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Utility.Authentication/User.cs b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Authentication/User.cs similarity index 80% rename from WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Utility.Authentication/User.cs rename to WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Authentication/User.cs index 247e171..e4a7042 100644 --- a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Utility.Authentication/User.cs +++ b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Authentication/User.cs @@ -1,4 +1,4 @@ -namespace WatchIt.Website.Services.Utility.Authentication; +namespace WatchIt.Website.Services.Authentication; public class User { diff --git a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Authentication/WatchIt.Website.Services.Authentication.csproj b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Authentication/WatchIt.Website.Services.Authentication.csproj new file mode 100644 index 0000000..8e4ca55 --- /dev/null +++ b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Authentication/WatchIt.Website.Services.Authentication.csproj @@ -0,0 +1,24 @@ + + + + net8.0 + enable + enable + + + + + ..\..\..\..\..\..\..\Program Files\dotnet\shared\Microsoft.AspNetCore.App\8.0.10\Microsoft.AspNetCore.Components.Authorization.dll + + + + + + + + + + + + + diff --git a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Accounts/AccountsWebAPIService.cs b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/Accounts/AccountsClientService.cs similarity index 93% rename from WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Accounts/AccountsWebAPIService.cs rename to WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/Accounts/AccountsClientService.cs index 5e1c092..70b6ccd 100644 --- a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Accounts/AccountsWebAPIService.cs +++ b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/Accounts/AccountsClientService.cs @@ -1,13 +1,11 @@ using WatchIt.Common.Model.Accounts; using WatchIt.Common.Services.HttpClient; -using WatchIt.Website.Services.Utility.Configuration; -using WatchIt.Website.Services.Utility.Configuration.Model; -using WatchIt.Website.Services.Utility.Tokens; -using WatchIt.Website.Services.WebAPI.Common; +using WatchIt.Website.Services.Configuration; +using WatchIt.Website.Services.Tokens; -namespace WatchIt.Website.Services.WebAPI.Accounts; +namespace WatchIt.Website.Services.Client.Accounts; -public class AccountsWebAPIService(IHttpClientService httpClientService, IConfigurationService configurationService, ITokensService tokensService) : BaseWebAPIService(configurationService), IAccountsWebAPIService +public class AccountsClientService(IHttpClientService httpClientService, IConfigurationService configurationService, ITokensService tokensService) : BaseClientService(configurationService), IAccountsClientService { #region PUBLIC METHODS diff --git a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Accounts/IAccountsWebAPIService.cs b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/Accounts/IAccountsClientService.cs similarity index 93% rename from WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Accounts/IAccountsWebAPIService.cs rename to WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/Accounts/IAccountsClientService.cs index 8aed63e..9410526 100644 --- a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Accounts/IAccountsWebAPIService.cs +++ b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/Accounts/IAccountsClientService.cs @@ -1,8 +1,8 @@ using WatchIt.Common.Model.Accounts; -namespace WatchIt.Website.Services.WebAPI.Accounts; +namespace WatchIt.Website.Services.Client.Accounts; -public interface IAccountsWebAPIService +public interface IAccountsClientService { Task Register(RegisterRequest data, Action? createdAction = null, Action>? badRequestAction = null); Task Authenticate(AuthenticateRequest data, Action? successAction = null, Action>? badRequestAction = null, Action? unauthorizedAction = null); diff --git a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Common/AuthorizationType.cs b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/AuthorizationType.cs similarity index 52% rename from WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Common/AuthorizationType.cs rename to WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/AuthorizationType.cs index b98bd71..687d7c4 100644 --- a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Common/AuthorizationType.cs +++ b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/AuthorizationType.cs @@ -1,4 +1,4 @@ -namespace WatchIt.Website.Services.WebAPI.Common; +namespace WatchIt.Website.Services.Client; public enum AuthorizationType { diff --git a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Common/BaseWebAPIService.cs b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/BaseClientService.cs similarity index 71% rename from WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Common/BaseWebAPIService.cs rename to WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/BaseClientService.cs index aab7ea8..fd9a9a3 100644 --- a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Common/BaseWebAPIService.cs +++ b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/BaseClientService.cs @@ -1,10 +1,9 @@ -using WatchIt.Website.Services.Utility.Configuration; -using WatchIt.Website.Services.Utility.Configuration.Model; -using WatchIt.Website.Services.Utility.Tokens; +using WatchIt.Website.Services.Configuration; +using WatchIt.Website.Services.Configuration.Model; -namespace WatchIt.Website.Services.WebAPI.Common; +namespace WatchIt.Website.Services.Client; -public abstract class BaseWebAPIService +public abstract class BaseClientService { #region SERVICES @@ -24,7 +23,7 @@ public abstract class BaseWebAPIService #region CONSTRUCTORS - protected BaseWebAPIService(IConfigurationService configurationService) + protected BaseClientService(IConfigurationService configurationService) { _configurationService = configurationService; } diff --git a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Genders/GendersWebAPIService.cs b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/Genders/GendersClientService.cs similarity index 91% rename from WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Genders/GendersWebAPIService.cs rename to WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/Genders/GendersClientService.cs index 1976795..6221118 100644 --- a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Genders/GendersWebAPIService.cs +++ b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/Genders/GendersClientService.cs @@ -1,11 +1,10 @@ using WatchIt.Common.Model.Genders; using WatchIt.Common.Services.HttpClient; -using WatchIt.Website.Services.Utility.Configuration; -using WatchIt.Website.Services.WebAPI.Common; +using WatchIt.Website.Services.Configuration; -namespace WatchIt.Website.Services.WebAPI.Genders; +namespace WatchIt.Website.Services.Client.Genders; -public class GendersWebAPIService : BaseWebAPIService, IGendersWebAPIService +public class GendersClientService : BaseClientService, IGendersClientService { #region SERVICES @@ -18,7 +17,7 @@ public class GendersWebAPIService : BaseWebAPIService, IGendersWebAPIService #region CONSTRUCTORS - public GendersWebAPIService(IHttpClientService httpClientService, IConfigurationService configurationService) : base(configurationService) + public GendersClientService(IHttpClientService httpClientService, IConfigurationService configurationService) : base(configurationService) { _httpClientService = httpClientService; _configurationService = configurationService; diff --git a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Genders/IGendersWebAPIService.cs b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/Genders/IGendersClientService.cs similarity index 87% rename from WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Genders/IGendersWebAPIService.cs rename to WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/Genders/IGendersClientService.cs index 393b0fe..7e32d3a 100644 --- a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Genders/IGendersWebAPIService.cs +++ b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/Genders/IGendersClientService.cs @@ -1,8 +1,8 @@ using WatchIt.Common.Model.Genders; -namespace WatchIt.Website.Services.WebAPI.Genders; +namespace WatchIt.Website.Services.Client.Genders; -public interface IGendersWebAPIService +public interface IGendersClientService { Task GetAllGenders(GenderQueryParameters? query = null, Action>? successAction = null); Task GetGender(long id, Action? successAction = null, Action? notFoundAction = null); diff --git a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Media/IMediaWebAPIService.cs b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/Media/IMediaClientService.cs similarity index 97% rename from WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Media/IMediaWebAPIService.cs rename to WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/Media/IMediaClientService.cs index 7f80fa0..bdc3465 100644 --- a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Media/IMediaWebAPIService.cs +++ b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/Media/IMediaClientService.cs @@ -4,9 +4,9 @@ using WatchIt.Common.Model.Photos; using WatchIt.Common.Model.Rating; using WatchIt.Common.Model.Roles; -namespace WatchIt.Website.Services.WebAPI.Media; +namespace WatchIt.Website.Services.Client.Media; -public interface IMediaWebAPIService +public interface IMediaClientService { Task GetAllMedia(MediaQueryParameters? query = null, Action>? successAction = null); Task GetMedia(long mediaId, Action? successAction = null, Action? notFoundAction = null); diff --git a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Media/MediaWebAPIService.cs b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/Media/MediaClientService.cs similarity index 97% rename from WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Media/MediaWebAPIService.cs rename to WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/Media/MediaClientService.cs index 4fecf3b..d907dfb 100644 --- a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Media/MediaWebAPIService.cs +++ b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/Media/MediaClientService.cs @@ -4,13 +4,11 @@ using WatchIt.Common.Model.Photos; using WatchIt.Common.Model.Rating; using WatchIt.Common.Model.Roles; using WatchIt.Common.Services.HttpClient; -using WatchIt.Website.Services.Utility.Configuration; -using WatchIt.Website.Services.Utility.Configuration.Model; -using WatchIt.Website.Services.WebAPI.Common; +using WatchIt.Website.Services.Configuration; -namespace WatchIt.Website.Services.WebAPI.Media; +namespace WatchIt.Website.Services.Client.Media; -public class MediaWebAPIService : BaseWebAPIService, IMediaWebAPIService +public class MediaClientService : BaseClientService, IMediaClientService { #region FIELDS @@ -22,7 +20,7 @@ public class MediaWebAPIService : BaseWebAPIService, IMediaWebAPIService #region CONSTRUCTORS - public MediaWebAPIService(IHttpClientService httpClientService, IConfigurationService configurationService) : base(configurationService) + public MediaClientService(IHttpClientService httpClientService, IConfigurationService configurationService) : base(configurationService) { _httpClientService = httpClientService; } diff --git a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Movies/IMoviesWebAPIService.cs b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/Movies/IMoviesClientService.cs similarity index 91% rename from WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Movies/IMoviesWebAPIService.cs rename to WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/Movies/IMoviesClientService.cs index 1bbe0e7..2188efe 100644 --- a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Movies/IMoviesWebAPIService.cs +++ b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/Movies/IMoviesClientService.cs @@ -1,8 +1,8 @@ using WatchIt.Common.Model.Movies; -namespace WatchIt.Website.Services.WebAPI.Movies; +namespace WatchIt.Website.Services.Client.Movies; -public interface IMoviesWebAPIService +public interface IMoviesClientService { Task GetAllMovies(MovieQueryParameters? query = null, Action>? successAction = null); Task PostMovie(MovieRequest data, Action? successAction = null, Action>? badRequestAction = null, Action? unauthorizedAction = null, Action? forbiddenAction = null); diff --git a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Movies/MoviesWebAPIService.cs b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/Movies/MoviesClientService.cs similarity index 94% rename from WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Movies/MoviesWebAPIService.cs rename to WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/Movies/MoviesClientService.cs index c8980bf..8ccc46c 100644 --- a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Movies/MoviesWebAPIService.cs +++ b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/Movies/MoviesClientService.cs @@ -3,12 +3,11 @@ using Microsoft.AspNetCore.Components; using Microsoft.Extensions.Primitives; using WatchIt.Common.Model.Movies; using WatchIt.Common.Services.HttpClient; -using WatchIt.Website.Services.Utility.Configuration; -using WatchIt.Website.Services.WebAPI.Common; +using WatchIt.Website.Services.Configuration; -namespace WatchIt.Website.Services.WebAPI.Movies; +namespace WatchIt.Website.Services.Client.Movies; -public class MoviesWebAPIService : BaseWebAPIService, IMoviesWebAPIService +public class MoviesClientService : BaseClientService, IMoviesClientService { #region SERVICES @@ -21,7 +20,7 @@ public class MoviesWebAPIService : BaseWebAPIService, IMoviesWebAPIService #region CONSTRUCTORS - public MoviesWebAPIService(IHttpClientService httpClientService, IConfigurationService configurationService) : base(configurationService) + public MoviesClientService(IHttpClientService httpClientService, IConfigurationService configurationService) : base(configurationService) { _httpClientService = httpClientService; _configurationService = configurationService; diff --git a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Persons/IPersonsWebAPIService.cs b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/Persons/IPersonsClientService.cs similarity index 96% rename from WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Persons/IPersonsWebAPIService.cs rename to WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/Persons/IPersonsClientService.cs index 071ed25..4e564e9 100644 --- a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Persons/IPersonsWebAPIService.cs +++ b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/Persons/IPersonsClientService.cs @@ -2,9 +2,9 @@ using WatchIt.Common.Model.Persons; using WatchIt.Common.Model.Rating; using WatchIt.Common.Model.Roles; -namespace WatchIt.Website.Services.WebAPI.Persons; +namespace WatchIt.Website.Services.Client.Persons; -public interface IPersonsWebAPIService +public interface IPersonsClientService { Task GetAllPersons(PersonQueryParameters? query = null, Action>? successAction = null); Task GetPerson(long id, Action? successAction = null, Action? notFoundAction = null); diff --git a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Persons/PersonsWebAPIService.cs b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/Persons/PersonsClientService.cs similarity index 97% rename from WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Persons/PersonsWebAPIService.cs rename to WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/Persons/PersonsClientService.cs index a38a6f0..d0823eb 100644 --- a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Persons/PersonsWebAPIService.cs +++ b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/Persons/PersonsClientService.cs @@ -5,12 +5,11 @@ using WatchIt.Common.Model.Persons; using WatchIt.Common.Model.Rating; using WatchIt.Common.Model.Roles; using WatchIt.Common.Services.HttpClient; -using WatchIt.Website.Services.Utility.Configuration; -using WatchIt.Website.Services.WebAPI.Common; +using WatchIt.Website.Services.Configuration; -namespace WatchIt.Website.Services.WebAPI.Persons; +namespace WatchIt.Website.Services.Client.Persons; -public class PersonsWebAPIService : BaseWebAPIService, IPersonsWebAPIService +public class PersonsClientService : BaseClientService, IPersonsClientService { #region SERVICES @@ -23,7 +22,7 @@ public class PersonsWebAPIService : BaseWebAPIService, IPersonsWebAPIService #region CONSTRUCTORS - public PersonsWebAPIService(IHttpClientService httpClientService, IConfigurationService configurationService) : base(configurationService) + public PersonsClientService(IHttpClientService httpClientService, IConfigurationService configurationService) : base(configurationService) { _httpClientService = httpClientService; _configurationService = configurationService; diff --git a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Photos/IPhotosWebAPIService.cs b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/Photos/IPhotosClientService.cs similarity index 89% rename from WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Photos/IPhotosWebAPIService.cs rename to WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/Photos/IPhotosClientService.cs index 560574b..4ed2b08 100644 --- a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Photos/IPhotosWebAPIService.cs +++ b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/Photos/IPhotosClientService.cs @@ -1,8 +1,8 @@ using WatchIt.Common.Model.Photos; -namespace WatchIt.Website.Services.WebAPI.Photos; +namespace WatchIt.Website.Services.Client.Photos; -public interface IPhotosWebAPIService +public interface IPhotosClientService { Task GetPhotoRandomBackground(Action? successAction = null, Action? notFoundAction = null); Task DeletePhoto(Guid id, Action? successAction = null, Action? unauthorizedAction = null, Action? forbiddenAction = null, Action? notFoundAction = null); diff --git a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Photos/PhotosWebAPIService.cs b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/Photos/PhotosClientService.cs similarity index 92% rename from WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Photos/PhotosWebAPIService.cs rename to WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/Photos/PhotosClientService.cs index 3ca5a1d..fb9f786 100644 --- a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Photos/PhotosWebAPIService.cs +++ b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/Photos/PhotosClientService.cs @@ -1,11 +1,10 @@ using WatchIt.Common.Model.Photos; using WatchIt.Common.Services.HttpClient; -using WatchIt.Website.Services.Utility.Configuration; -using WatchIt.Website.Services.WebAPI.Common; +using WatchIt.Website.Services.Configuration; -namespace WatchIt.Website.Services.WebAPI.Photos; +namespace WatchIt.Website.Services.Client.Photos; -public class PhotosWebAPIService : BaseWebAPIService, IPhotosWebAPIService +public class PhotosClientService : BaseClientService, IPhotosClientService { #region FIELDS @@ -17,7 +16,7 @@ public class PhotosWebAPIService : BaseWebAPIService, IPhotosWebAPIService #region CONSTRUCTORS - public PhotosWebAPIService(IHttpClientService httpClientService, IConfigurationService configurationService) : base(configurationService) + public PhotosClientService(IHttpClientService httpClientService, IConfigurationService configurationService) : base(configurationService) { _httpClientService = httpClientService; } diff --git a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Roles/IRolesWebAPIService.cs b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/Roles/IRolesClientService.cs similarity index 97% rename from WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Roles/IRolesWebAPIService.cs rename to WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/Roles/IRolesClientService.cs index b270d98..885fcf2 100644 --- a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Roles/IRolesWebAPIService.cs +++ b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/Roles/IRolesClientService.cs @@ -1,9 +1,9 @@ using WatchIt.Common.Model.Rating; using WatchIt.Common.Model.Roles; -namespace WatchIt.Website.Services.WebAPI.Roles; +namespace WatchIt.Website.Services.Client.Roles; -public interface IRolesWebAPIService +public interface IRolesClientService { Task GetActorRole(Guid id, Action? successAction = null, Action? notFoundAction = null); Task PutActorRole(Guid id, ActorRoleUniversalRequest data, Action? successAction = null, Action>? badRequestAction = null, Action? unauthorizedAction = null, Action? forbiddenAction = null, Action? notFoundAction = null); diff --git a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Roles/RolesWebAPIService.cs b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/Roles/RolesClientService.cs similarity index 98% rename from WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Roles/RolesWebAPIService.cs rename to WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/Roles/RolesClientService.cs index 09b0418..29401f2 100644 --- a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Roles/RolesWebAPIService.cs +++ b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/Roles/RolesClientService.cs @@ -1,12 +1,11 @@ using WatchIt.Common.Model.Rating; using WatchIt.Common.Model.Roles; using WatchIt.Common.Services.HttpClient; -using WatchIt.Website.Services.Utility.Configuration; -using WatchIt.Website.Services.WebAPI.Common; +using WatchIt.Website.Services.Configuration; -namespace WatchIt.Website.Services.WebAPI.Roles; +namespace WatchIt.Website.Services.Client.Roles; -public class RolesWebAPIService : BaseWebAPIService, IRolesWebAPIService +public class RolesClientService : BaseClientService, IRolesClientService { #region SERVICES @@ -18,7 +17,7 @@ public class RolesWebAPIService : BaseWebAPIService, IRolesWebAPIService #region CONSTRUCTORS - public RolesWebAPIService(IHttpClientService httpClientService, IConfigurationService configurationService) : base(configurationService) + public RolesClientService(IHttpClientService httpClientService, IConfigurationService configurationService) : base(configurationService) { _httpClientService = httpClientService; } diff --git a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Series/ISeriesWebAPIService.cs b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/Series/ISeriesClientService.cs similarity index 91% rename from WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Series/ISeriesWebAPIService.cs rename to WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/Series/ISeriesClientService.cs index dfb2b4d..8a4dd44 100644 --- a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Series/ISeriesWebAPIService.cs +++ b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/Series/ISeriesClientService.cs @@ -1,8 +1,8 @@ using WatchIt.Common.Model.Series; -namespace WatchIt.Website.Services.WebAPI.Series; +namespace WatchIt.Website.Services.Client.Series; -public interface ISeriesWebAPIService +public interface ISeriesClientService { Task GetAllSeries(SeriesQueryParameters? query = null, Action>? successAction = null); Task GetSeries(long id, Action? successAction = null, Action? notFoundAction = null); diff --git a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Series/SeriesWebAPIService.cs b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/Series/SeriesClientService.cs similarity index 94% rename from WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Series/SeriesWebAPIService.cs rename to WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/Series/SeriesClientService.cs index 52f144b..5a3bc59 100644 --- a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Series/SeriesWebAPIService.cs +++ b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/Series/SeriesClientService.cs @@ -1,12 +1,11 @@ using System.Text; using WatchIt.Common.Model.Series; using WatchIt.Common.Services.HttpClient; -using WatchIt.Website.Services.Utility.Configuration; -using WatchIt.Website.Services.WebAPI.Common; +using WatchIt.Website.Services.Configuration; -namespace WatchIt.Website.Services.WebAPI.Series; +namespace WatchIt.Website.Services.Client.Series; -public class SeriesWebAPIService : BaseWebAPIService, ISeriesWebAPIService +public class SeriesClientService : BaseClientService, ISeriesClientService { #region SERVICES @@ -19,7 +18,7 @@ public class SeriesWebAPIService : BaseWebAPIService, ISeriesWebAPIService #region CONSTRUCTORS - public SeriesWebAPIService(IHttpClientService httpClientService, IConfigurationService configurationService) : base(configurationService) + public SeriesClientService(IHttpClientService httpClientService, IConfigurationService configurationService) : base(configurationService) { _httpClientService = httpClientService; _configurationService = configurationService; diff --git a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/WatchIt.Website.Services.Client.csproj b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/WatchIt.Website.Services.Client.csproj new file mode 100644 index 0000000..2c834c9 --- /dev/null +++ b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/WatchIt.Website.Services.Client.csproj @@ -0,0 +1,16 @@ + + + + net8.0 + enable + enable + + + + + + + + + + diff --git a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Utility.Tokens/ITokensService.cs b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Tokens/ITokensService.cs similarity index 89% rename from WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Utility.Tokens/ITokensService.cs rename to WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Tokens/ITokensService.cs index c0026a1..5c5d08a 100644 --- a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Utility.Tokens/ITokensService.cs +++ b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Tokens/ITokensService.cs @@ -1,6 +1,6 @@ using WatchIt.Common.Model.Accounts; -namespace WatchIt.Website.Services.Utility.Tokens; +namespace WatchIt.Website.Services.Tokens; public interface ITokensService { diff --git a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Utility.Tokens/TokensService.cs b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Tokens/TokensService.cs similarity index 96% rename from WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Utility.Tokens/TokensService.cs rename to WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Tokens/TokensService.cs index ffb35d5..fbbe843 100644 --- a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Utility.Tokens/TokensService.cs +++ b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Tokens/TokensService.cs @@ -2,9 +2,9 @@ using Microsoft.AspNetCore.Components.Server.ProtectedBrowserStorage; using Microsoft.Extensions.Logging; using WatchIt.Common.Model.Accounts; -using WatchIt.Website.Services.Utility.Configuration; +using WatchIt.Website.Services.Configuration; -namespace WatchIt.Website.Services.Utility.Tokens; +namespace WatchIt.Website.Services.Tokens; public class TokensService : ITokensService { diff --git a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Utility.Tokens/WatchIt.Website.Services.Utility.Tokens.csproj b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Tokens/WatchIt.Website.Services.Tokens.csproj similarity index 54% rename from WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Utility.Tokens/WatchIt.Website.Services.Utility.Tokens.csproj rename to WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Tokens/WatchIt.Website.Services.Tokens.csproj index 840c020..f278ad0 100644 --- a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Utility.Tokens/WatchIt.Website.Services.Utility.Tokens.csproj +++ b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Tokens/WatchIt.Website.Services.Tokens.csproj @@ -4,12 +4,11 @@ net8.0 enable enable - WatchIt.Website.Services.Utility.Token - - + + diff --git a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Utility.Configuration/ConfigurationService.cs b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Configuration/ConfigurationService.cs similarity index 68% rename from WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Utility.Configuration/ConfigurationService.cs rename to WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Configuration/ConfigurationService.cs index ea86d69..5848589 100644 --- a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Utility.Configuration/ConfigurationService.cs +++ b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Configuration/ConfigurationService.cs @@ -1,7 +1,7 @@ using Microsoft.Extensions.Configuration; -using WatchIt.Website.Services.Utility.Configuration.Model; +using WatchIt.Website.Services.Configuration.Model; -namespace WatchIt.Website.Services.Utility.Configuration; +namespace WatchIt.Website.Services.Configuration; public class ConfigurationService(IConfiguration configuration) : IConfigurationService { diff --git a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Configuration/IConfigurationService.cs b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Configuration/IConfigurationService.cs new file mode 100644 index 0000000..852ca0a --- /dev/null +++ b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Configuration/IConfigurationService.cs @@ -0,0 +1,8 @@ +using WatchIt.Website.Services.Configuration.Model; + +namespace WatchIt.Website.Services.Configuration; + +public interface IConfigurationService +{ + ConfigurationData Data { get; } +} \ No newline at end of file diff --git a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Utility.Configuration/Model/Accounts.cs b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Configuration/Model/Accounts.cs similarity index 86% rename from WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Utility.Configuration/Model/Accounts.cs rename to WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Configuration/Model/Accounts.cs index c8f50a5..1f648cf 100644 --- a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Utility.Configuration/Model/Accounts.cs +++ b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Configuration/Model/Accounts.cs @@ -1,4 +1,4 @@ -namespace WatchIt.Website.Services.Utility.Configuration.Model; +namespace WatchIt.Website.Services.Configuration.Model; public class Accounts { diff --git a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Utility.Configuration/Model/ConfigurationData.cs b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Configuration/Model/ConfigurationData.cs similarity index 78% rename from WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Utility.Configuration/Model/ConfigurationData.cs rename to WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Configuration/Model/ConfigurationData.cs index 7709295..d8032f0 100644 --- a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Utility.Configuration/Model/ConfigurationData.cs +++ b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Configuration/Model/ConfigurationData.cs @@ -1,4 +1,4 @@ -namespace WatchIt.Website.Services.Utility.Configuration.Model; +namespace WatchIt.Website.Services.Configuration.Model; public class ConfigurationData { diff --git a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Utility.Configuration/Model/Endpoints.cs b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Configuration/Model/Endpoints.cs similarity index 86% rename from WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Utility.Configuration/Model/Endpoints.cs rename to WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Configuration/Model/Endpoints.cs index 386b6c1..979014c 100644 --- a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Utility.Configuration/Model/Endpoints.cs +++ b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Configuration/Model/Endpoints.cs @@ -1,4 +1,4 @@ -namespace WatchIt.Website.Services.Utility.Configuration.Model; +namespace WatchIt.Website.Services.Configuration.Model; public class Endpoints { diff --git a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Utility.Configuration/Model/Genders.cs b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Configuration/Model/Genders.cs similarity index 78% rename from WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Utility.Configuration/Model/Genders.cs rename to WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Configuration/Model/Genders.cs index 58a8f53..93765b3 100644 --- a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Utility.Configuration/Model/Genders.cs +++ b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Configuration/Model/Genders.cs @@ -1,4 +1,4 @@ -namespace WatchIt.Website.Services.Utility.Configuration.Model; +namespace WatchIt.Website.Services.Configuration.Model; public class Genders { diff --git a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Utility.Configuration/Model/Genres.cs b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Configuration/Model/Genres.cs similarity index 78% rename from WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Utility.Configuration/Model/Genres.cs rename to WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Configuration/Model/Genres.cs index 108e72b..59d41f4 100644 --- a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Utility.Configuration/Model/Genres.cs +++ b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Configuration/Model/Genres.cs @@ -1,4 +1,4 @@ -namespace WatchIt.Website.Services.Utility.Configuration.Model; +namespace WatchIt.Website.Services.Configuration.Model; public class Genres { diff --git a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Utility.Configuration/Model/LogLevel.cs b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Configuration/Model/LogLevel.cs similarity index 63% rename from WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Utility.Configuration/Model/LogLevel.cs rename to WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Configuration/Model/LogLevel.cs index 601ee2d..dfb4f77 100644 --- a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Utility.Configuration/Model/LogLevel.cs +++ b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Configuration/Model/LogLevel.cs @@ -1,4 +1,4 @@ -namespace WatchIt.Website.Services.Utility.Configuration.Model; +namespace WatchIt.Website.Services.Configuration.Model; public class LogLevel { diff --git a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Utility.Configuration/Model/Logging.cs b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Configuration/Model/Logging.cs similarity index 50% rename from WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Utility.Configuration/Model/Logging.cs rename to WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Configuration/Model/Logging.cs index 25db637..608faab 100644 --- a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Utility.Configuration/Model/Logging.cs +++ b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Configuration/Model/Logging.cs @@ -1,4 +1,4 @@ -namespace WatchIt.Website.Services.Utility.Configuration.Model; +namespace WatchIt.Website.Services.Configuration.Model; public class Logging { diff --git a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Utility.Configuration/Model/Media.cs b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Configuration/Model/Media.cs similarity index 93% rename from WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Utility.Configuration/Model/Media.cs rename to WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Configuration/Model/Media.cs index a7ae025..9aa7a09 100644 --- a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Utility.Configuration/Model/Media.cs +++ b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Configuration/Model/Media.cs @@ -1,4 +1,4 @@ -namespace WatchIt.Website.Services.Utility.Configuration.Model; +namespace WatchIt.Website.Services.Configuration.Model; public class Media { diff --git a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Utility.Configuration/Model/Movies.cs b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Configuration/Model/Movies.cs similarity index 82% rename from WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Utility.Configuration/Model/Movies.cs rename to WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Configuration/Model/Movies.cs index 36ee8e2..abe1ff8 100644 --- a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Utility.Configuration/Model/Movies.cs +++ b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Configuration/Model/Movies.cs @@ -1,4 +1,4 @@ -namespace WatchIt.Website.Services.Utility.Configuration.Model; +namespace WatchIt.Website.Services.Configuration.Model; public class Movies { diff --git a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Utility.Configuration/Model/Persons.cs b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Configuration/Model/Persons.cs similarity index 92% rename from WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Utility.Configuration/Model/Persons.cs rename to WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Configuration/Model/Persons.cs index 0bbc44e..2cc849d 100644 --- a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Utility.Configuration/Model/Persons.cs +++ b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Configuration/Model/Persons.cs @@ -1,4 +1,4 @@ -namespace WatchIt.Website.Services.Utility.Configuration.Model; +namespace WatchIt.Website.Services.Configuration.Model; public class Persons { diff --git a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Utility.Configuration/Model/Photos.cs b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Configuration/Model/Photos.cs similarity index 81% rename from WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Utility.Configuration/Model/Photos.cs rename to WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Configuration/Model/Photos.cs index 46384b4..5fa02f1 100644 --- a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Utility.Configuration/Model/Photos.cs +++ b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Configuration/Model/Photos.cs @@ -1,4 +1,4 @@ -namespace WatchIt.Website.Services.Utility.Configuration.Model; +namespace WatchIt.Website.Services.Configuration.Model; public class Photos { diff --git a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Utility.Configuration/Model/Roles.cs b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Configuration/Model/Roles.cs similarity index 94% rename from WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Utility.Configuration/Model/Roles.cs rename to WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Configuration/Model/Roles.cs index 6eec92e..8861284 100644 --- a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Utility.Configuration/Model/Roles.cs +++ b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Configuration/Model/Roles.cs @@ -1,4 +1,4 @@ -namespace WatchIt.Website.Services.Utility.Configuration.Model; +namespace WatchIt.Website.Services.Configuration.Model; public class Roles { diff --git a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Utility.Configuration/Model/Series.cs b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Configuration/Model/Series.cs similarity index 83% rename from WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Utility.Configuration/Model/Series.cs rename to WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Configuration/Model/Series.cs index ec8dc63..a22e6ba 100644 --- a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Utility.Configuration/Model/Series.cs +++ b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Configuration/Model/Series.cs @@ -1,4 +1,4 @@ -namespace WatchIt.Website.Services.Utility.Configuration.Model; +namespace WatchIt.Website.Services.Configuration.Model; public class Series { diff --git a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Utility.Configuration/Model/StorageKeys.cs b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Configuration/Model/StorageKeys.cs similarity index 63% rename from WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Utility.Configuration/Model/StorageKeys.cs rename to WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Configuration/Model/StorageKeys.cs index 456f4b0..60531b0 100644 --- a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Utility.Configuration/Model/StorageKeys.cs +++ b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Configuration/Model/StorageKeys.cs @@ -1,4 +1,4 @@ -namespace WatchIt.Website.Services.Utility.Configuration.Model; +namespace WatchIt.Website.Services.Configuration.Model; public class StorageKeys { diff --git a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Utility.Configuration/Model/Style.cs b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Configuration/Model/Style.cs similarity index 52% rename from WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Utility.Configuration/Model/Style.cs rename to WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Configuration/Model/Style.cs index 00abcbd..a6afadd 100644 --- a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Utility.Configuration/Model/Style.cs +++ b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Configuration/Model/Style.cs @@ -1,4 +1,4 @@ -namespace WatchIt.Website.Services.Utility.Configuration.Model; +namespace WatchIt.Website.Services.Configuration.Model; public class Style { diff --git a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Utility.Configuration/WatchIt.Website.Services.Utility.Configuration.csproj b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Configuration/WatchIt.Website.Services.Configuration.csproj similarity index 100% rename from WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Utility.Configuration/WatchIt.Website.Services.Utility.Configuration.csproj rename to WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Configuration/WatchIt.Website.Services.Configuration.csproj diff --git a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Utility.Authentication/WatchIt.Website.Services.Utility.Authentication.csproj b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Utility.Authentication/WatchIt.Website.Services.Utility.Authentication.csproj deleted file mode 100644 index e669fe9..0000000 --- a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Utility.Authentication/WatchIt.Website.Services.Utility.Authentication.csproj +++ /dev/null @@ -1,19 +0,0 @@ - - - - net8.0 - enable - enable - - - - - - - - - - - - - diff --git a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Utility.Configuration/IConfigurationService.cs b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Utility.Configuration/IConfigurationService.cs deleted file mode 100644 index 9a39607..0000000 --- a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Utility.Configuration/IConfigurationService.cs +++ /dev/null @@ -1,8 +0,0 @@ -using WatchIt.Website.Services.Utility.Configuration.Model; - -namespace WatchIt.Website.Services.Utility.Configuration; - -public interface IConfigurationService -{ - ConfigurationData Data { get; } -} \ No newline at end of file diff --git a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Accounts/WatchIt.Website.Services.WebAPI.Accounts.csproj b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Accounts/WatchIt.Website.Services.WebAPI.Accounts.csproj deleted file mode 100644 index ca5168e..0000000 --- a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Accounts/WatchIt.Website.Services.WebAPI.Accounts.csproj +++ /dev/null @@ -1,16 +0,0 @@ - - - - net8.0 - enable - enable - - - - - - - - - - diff --git a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Common/WatchIt.Website.Services.WebAPI.Common.csproj b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Common/WatchIt.Website.Services.WebAPI.Common.csproj deleted file mode 100644 index 642c1aa..0000000 --- a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Common/WatchIt.Website.Services.WebAPI.Common.csproj +++ /dev/null @@ -1,15 +0,0 @@ - - - - net8.0 - enable - enable - - - - - - - - - diff --git a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Genders/WatchIt.Website.Services.WebAPI.Genders.csproj b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Genders/WatchIt.Website.Services.WebAPI.Genders.csproj deleted file mode 100644 index abf3359..0000000 --- a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Genders/WatchIt.Website.Services.WebAPI.Genders.csproj +++ /dev/null @@ -1,14 +0,0 @@ - - - - net8.0 - enable - enable - - - - - - - - diff --git a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Genres/WatchIt.Website.Services.WebAPI.Genres.csproj b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Genres/WatchIt.Website.Services.WebAPI.Genres.csproj deleted file mode 100644 index 3a63532..0000000 --- a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Genres/WatchIt.Website.Services.WebAPI.Genres.csproj +++ /dev/null @@ -1,9 +0,0 @@ - - - - net8.0 - enable - enable - - - diff --git a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Media/WatchIt.Website.Services.WebAPI.Media.csproj b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Media/WatchIt.Website.Services.WebAPI.Media.csproj deleted file mode 100644 index ca5168e..0000000 --- a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Media/WatchIt.Website.Services.WebAPI.Media.csproj +++ /dev/null @@ -1,16 +0,0 @@ - - - - net8.0 - enable - enable - - - - - - - - - - diff --git a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Movies/WatchIt.Website.Services.WebAPI.Movies.csproj b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Movies/WatchIt.Website.Services.WebAPI.Movies.csproj deleted file mode 100644 index ef9c88f..0000000 --- a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Movies/WatchIt.Website.Services.WebAPI.Movies.csproj +++ /dev/null @@ -1,23 +0,0 @@ - - - - net8.0 - enable - enable - - - - - ..\..\..\..\..\..\..\..\Program Files\dotnet\shared\Microsoft.AspNetCore.App\8.0.2\Microsoft.AspNetCore.Components.dll - - - - - - - - - - - - diff --git a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Persons/WatchIt.Website.Services.WebAPI.Persons.csproj b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Persons/WatchIt.Website.Services.WebAPI.Persons.csproj deleted file mode 100644 index abf3359..0000000 --- a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Persons/WatchIt.Website.Services.WebAPI.Persons.csproj +++ /dev/null @@ -1,14 +0,0 @@ - - - - net8.0 - enable - enable - - - - - - - - diff --git a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Photos/WatchIt.Website.Services.WebAPI.Photos.csproj b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Photos/WatchIt.Website.Services.WebAPI.Photos.csproj deleted file mode 100644 index 79bbe83..0000000 --- a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Photos/WatchIt.Website.Services.WebAPI.Photos.csproj +++ /dev/null @@ -1,15 +0,0 @@ - - - - net8.0 - enable - enable - - - - - - - - - diff --git a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Roles/WatchIt.Website.Services.WebAPI.Roles.csproj b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Roles/WatchIt.Website.Services.WebAPI.Roles.csproj deleted file mode 100644 index abf3359..0000000 --- a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Roles/WatchIt.Website.Services.WebAPI.Roles.csproj +++ /dev/null @@ -1,14 +0,0 @@ - - - - net8.0 - enable - enable - - - - - - - - diff --git a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Series/WatchIt.Website.Services.WebAPI.Series.csproj b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Series/WatchIt.Website.Services.WebAPI.Series.csproj deleted file mode 100644 index abf3359..0000000 --- a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.WebAPI/WatchIt.Website.Services.WebAPI.Series/WatchIt.Website.Services.WebAPI.Series.csproj +++ /dev/null @@ -1,14 +0,0 @@ - - - - net8.0 - enable - enable - - - - - - - - diff --git a/WatchIt.Website/WatchIt.Website/Components/Common/Subcomponents/ListItemComponent.razor.cs b/WatchIt.Website/WatchIt.Website/Components/Common/Subcomponents/ListItemComponent.razor.cs index 818f3ee..326dbf1 100644 --- a/WatchIt.Website/WatchIt.Website/Components/Common/Subcomponents/ListItemComponent.razor.cs +++ b/WatchIt.Website/WatchIt.Website/Components/Common/Subcomponents/ListItemComponent.razor.cs @@ -1,7 +1,7 @@ using Microsoft.AspNetCore.Components; using WatchIt.Common.Model; using WatchIt.Common.Model.Rating; -using WatchIt.Website.Services.Utility.Authentication; +using WatchIt.Website.Services.Authentication; namespace WatchIt.Website.Components.Common.Subcomponents; diff --git a/WatchIt.Website/WatchIt.Website/Components/Pages/DatabasePage/Subcomponents/PersonsFilterFormComponent.razor.cs b/WatchIt.Website/WatchIt.Website/Components/Pages/DatabasePage/Subcomponents/PersonsFilterFormComponent.razor.cs index ca4f085..c57a68a 100644 --- a/WatchIt.Website/WatchIt.Website/Components/Pages/DatabasePage/Subcomponents/PersonsFilterFormComponent.razor.cs +++ b/WatchIt.Website/WatchIt.Website/Components/Pages/DatabasePage/Subcomponents/PersonsFilterFormComponent.razor.cs @@ -1,7 +1,7 @@ using Microsoft.AspNetCore.Components; using WatchIt.Common.Model.Genders; using WatchIt.Common.Model.Persons; -using WatchIt.Website.Services.WebAPI.Genders; +using WatchIt.Website.Services.Client.Genders; namespace WatchIt.Website.Components.Pages.DatabasePage.Subcomponents; @@ -9,7 +9,7 @@ public partial class PersonsFilterFormComponent : FilterFormComponent _genders = data) + GendersClientService.GetAllGenders(successAction: data => _genders = data) ]); // END diff --git a/WatchIt.Website/WatchIt.Website/Components/Pages/MediaEditPage/Panels/MediaActorRolesEditPanelComponent.razor.cs b/WatchIt.Website/WatchIt.Website/Components/Pages/MediaEditPage/Panels/MediaActorRolesEditPanelComponent.razor.cs index f152025..f539c69 100644 --- a/WatchIt.Website/WatchIt.Website/Components/Pages/MediaEditPage/Panels/MediaActorRolesEditPanelComponent.razor.cs +++ b/WatchIt.Website/WatchIt.Website/Components/Pages/MediaEditPage/Panels/MediaActorRolesEditPanelComponent.razor.cs @@ -2,9 +2,9 @@ using Microsoft.AspNetCore.Components; using WatchIt.Common.Model.Media; using WatchIt.Common.Model.Persons; using WatchIt.Common.Model.Roles; -using WatchIt.Website.Services.WebAPI.Media; -using WatchIt.Website.Services.WebAPI.Persons; -using WatchIt.Website.Services.WebAPI.Roles; +using WatchIt.Website.Services.Client.Media; +using WatchIt.Website.Services.Client.Persons; +using WatchIt.Website.Services.Client.Roles; namespace WatchIt.Website.Components.Pages.MediaEditPage.Panels; @@ -12,9 +12,9 @@ public partial class MediaActorRolesEditPanelComponent : ComponentBase { #region SERVICES - [Inject] private IPersonsWebAPIService PersonsWebAPIService { get; set; } = default!; - [Inject] private IMediaWebAPIService MediaWebAPIService { get; set; } = default!; - [Inject] private IRolesWebAPIService RolesWebAPIService { get; set; } = default!; + [Inject] private IPersonsClientService PersonsClientService { get; set; } = default!; + [Inject] private IMediaClientService MediaClientService { get; set; } = default!; + [Inject] private IRolesClientService RolesClientService { get; set; } = default!; #endregion @@ -62,8 +62,8 @@ public partial class MediaActorRolesEditPanelComponent : ComponentBase { endTasks.AddRange( [ - MediaWebAPIService.GetMediaAllActorRoles(Id.Value, successAction: data => _roles = data.ToDictionary(x => x.Id, x => (x, false))), - RolesWebAPIService.GetAllActorRoleTypes(successAction: data => _roleTypes = data.ToDictionary(x => x.Id, x => x.Name)), + MediaClientService.GetMediaAllActorRoles(Id.Value, successAction: data => _roles = data.ToDictionary(x => x.Id, x => (x, false))), + RolesClientService.GetAllActorRoleTypes(successAction: data => _roleTypes = data.ToDictionary(x => x.Id, x => x.Name)), ]); } @@ -120,11 +120,11 @@ public partial class MediaActorRolesEditPanelComponent : ComponentBase _saving = true; if (_editedId.HasValue) { - await RolesWebAPIService.PutActorRole(_editedId.Value, _editedModel as ActorRoleUniversalRequest, SuccessPut, BadRequest, Unauthorized); + await RolesClientService.PutActorRole(_editedId.Value, _editedModel as ActorRoleUniversalRequest, SuccessPut, BadRequest, Unauthorized); } else { - await MediaWebAPIService.PostMediaActorRole(Id!.Value, _editedModel as ActorRoleMediaRequest, SuccessPost, BadRequest, Unauthorized); + await MediaClientService.PostMediaActorRole(Id!.Value, _editedModel as ActorRoleMediaRequest, SuccessPost, BadRequest, Unauthorized); } } @@ -141,7 +141,7 @@ public partial class MediaActorRolesEditPanelComponent : ComponentBase private async Task Delete(Guid id) { _roles[id] = (_roles[id].Data, true); - await RolesWebAPIService.DeleteActorRole(id, () => _roles.Remove(id)); + await RolesClientService.DeleteActorRole(id, () => _roles.Remove(id)); } #endregion diff --git a/WatchIt.Website/WatchIt.Website/Components/Pages/MediaEditPage/Panels/MediaCreatorRolesEditPanelComponent.razor.cs b/WatchIt.Website/WatchIt.Website/Components/Pages/MediaEditPage/Panels/MediaCreatorRolesEditPanelComponent.razor.cs index 46c61c7..6d1a131 100644 --- a/WatchIt.Website/WatchIt.Website/Components/Pages/MediaEditPage/Panels/MediaCreatorRolesEditPanelComponent.razor.cs +++ b/WatchIt.Website/WatchIt.Website/Components/Pages/MediaEditPage/Panels/MediaCreatorRolesEditPanelComponent.razor.cs @@ -2,9 +2,9 @@ using Microsoft.AspNetCore.Components; using WatchIt.Common.Model.Media; using WatchIt.Common.Model.Persons; using WatchIt.Common.Model.Roles; -using WatchIt.Website.Services.WebAPI.Media; -using WatchIt.Website.Services.WebAPI.Persons; -using WatchIt.Website.Services.WebAPI.Roles; +using WatchIt.Website.Services.Client.Media; +using WatchIt.Website.Services.Client.Persons; +using WatchIt.Website.Services.Client.Roles; namespace WatchIt.Website.Components.Pages.MediaEditPage.Panels; @@ -12,9 +12,9 @@ public partial class MediaCreatorRolesEditPanelComponent : ComponentBase { #region SERVICES - [Inject] private IPersonsWebAPIService PersonsWebAPIService { get; set; } = default!; - [Inject] private IMediaWebAPIService MediaWebAPIService { get; set; } = default!; - [Inject] private IRolesWebAPIService RolesWebAPIService { get; set; } = default!; + [Inject] private IPersonsClientService PersonsClientService { get; set; } = default!; + [Inject] private IMediaClientService MediaClientService { get; set; } = default!; + [Inject] private IRolesClientService RolesClientService { get; set; } = default!; #endregion @@ -62,8 +62,8 @@ public partial class MediaCreatorRolesEditPanelComponent : ComponentBase { endTasks.AddRange( [ - MediaWebAPIService.GetMediaAllCreatorRoles(Id.Value, successAction: data => _roles = data.ToDictionary(x => x.Id, x => (x, false))), - RolesWebAPIService.GetAllCreatorRoleTypes(successAction: data => _roleTypes = data.ToDictionary(x => x.Id, x => x.Name)), + MediaClientService.GetMediaAllCreatorRoles(Id.Value, successAction: data => _roles = data.ToDictionary(x => x.Id, x => (x, false))), + RolesClientService.GetAllCreatorRoleTypes(successAction: data => _roleTypes = data.ToDictionary(x => x.Id, x => x.Name)), ]); } @@ -119,11 +119,11 @@ public partial class MediaCreatorRolesEditPanelComponent : ComponentBase _saving = true; if (_editedId.HasValue) { - await RolesWebAPIService.PutCreatorRole(_editedId.Value, _editedModel as CreatorRoleUniversalRequest, SuccessPut, BadRequest, Unauthorized); + await RolesClientService.PutCreatorRole(_editedId.Value, _editedModel as CreatorRoleUniversalRequest, SuccessPut, BadRequest, Unauthorized); } else { - await MediaWebAPIService.PostMediaCreatorRole(Id!.Value, _editedModel as CreatorRoleMediaRequest, SuccessPost, BadRequest, Unauthorized); + await MediaClientService.PostMediaCreatorRole(Id!.Value, _editedModel as CreatorRoleMediaRequest, SuccessPost, BadRequest, Unauthorized); } } @@ -140,7 +140,7 @@ public partial class MediaCreatorRolesEditPanelComponent : ComponentBase private async Task Delete(Guid id) { _roles[id] = (_roles[id].Data, true); - await RolesWebAPIService.DeleteCreatorRole(id, () => _roles.Remove(id)); + await RolesClientService.DeleteCreatorRole(id, () => _roles.Remove(id)); } #endregion diff --git a/WatchIt.Website/WatchIt.Website/Components/Pages/MediaPage/Panels/MediaActorRolesPanelComponent.razor b/WatchIt.Website/WatchIt.Website/Components/Pages/MediaPage/Panels/MediaActorRolesPanelComponent.razor index 80804ab..f373100 100644 --- a/WatchIt.Website/WatchIt.Website/Components/Pages/MediaPage/Panels/MediaActorRolesPanelComponent.razor +++ b/WatchIt.Website/WatchIt.Website/Components/Pages/MediaPage/Panels/MediaActorRolesPanelComponent.razor @@ -10,17 +10,17 @@ TQuery="ActorRoleMediaQueryParameters" TRoleParent="PersonResponse" Id="@(Id)" - GetRolesAction="@(MediaWebAPIService.GetMediaAllActorRoles)" + GetRolesAction="@(MediaClientService.GetMediaAllActorRoles)" NameSource="@((_, parent) => parent.Name)" AdditionalInfoSource="@((item, _) => $" as {item.Name}")" - GetRoleParentMethod="@((id, action) => PersonsWebAPIService.GetPerson(id, action))" + GetRoleParentMethod="@((id, action) => PersonsClientService.GetPerson(id, action))" ParentItemIdSource="@(item => item.PersonId)" ParentUrlTemplate="/person/{0}" PosterPlaceholder="/assets/person_poster.png" - PosterDownloadingTask="@((id, action) => PersonsWebAPIService.GetPersonPhoto(id, action))" - GetGlobalRatingMethod="@((id, action) => RolesWebAPIService.GetActorRoleRating(id, action))" - GetUserRatingMethod="@((id, userId, actionSuccess, actionNotFound) => RolesWebAPIService.GetActorRoleRatingByUser(id, userId, actionSuccess, actionNotFound))" - PutRatingMethod="@((id, request) => RolesWebAPIService.PutActorRoleRating(id, request))" - DeleteRatingMethod="@(id => RolesWebAPIService.DeleteActorRoleRating(id))"/> + PosterDownloadingTask="@((id, action) => PersonsClientService.GetPersonPhoto(id, action))" + GetGlobalRatingMethod="@((id, action) => RolesClientService.GetActorRoleRating(id, action))" + GetUserRatingMethod="@((id, userId, actionSuccess, actionNotFound) => RolesClientService.GetActorRoleRatingByUser(id, userId, actionSuccess, actionNotFound))" + PutRatingMethod="@((id, request) => RolesClientService.PutActorRoleRating(id, request))" + DeleteRatingMethod="@(id => RolesClientService.DeleteActorRoleRating(id))"/> \ No newline at end of file diff --git a/WatchIt.Website/WatchIt.Website/Components/Pages/MediaPage/Panels/MediaActorRolesPanelComponent.razor.cs b/WatchIt.Website/WatchIt.Website/Components/Pages/MediaPage/Panels/MediaActorRolesPanelComponent.razor.cs index 54e7287..4cd13fb 100644 --- a/WatchIt.Website/WatchIt.Website/Components/Pages/MediaPage/Panels/MediaActorRolesPanelComponent.razor.cs +++ b/WatchIt.Website/WatchIt.Website/Components/Pages/MediaPage/Panels/MediaActorRolesPanelComponent.razor.cs @@ -1,8 +1,8 @@ using Microsoft.AspNetCore.Components; -using WatchIt.Website.Services.Utility.Authentication; -using WatchIt.Website.Services.WebAPI.Media; -using WatchIt.Website.Services.WebAPI.Persons; -using WatchIt.Website.Services.WebAPI.Roles; +using WatchIt.Website.Services.Authentication; +using WatchIt.Website.Services.Client.Media; +using WatchIt.Website.Services.Client.Persons; +using WatchIt.Website.Services.Client.Roles; namespace WatchIt.Website.Components.Pages.MediaPage.Panels; @@ -10,9 +10,9 @@ public partial class MediaActorRolesPanelComponent : ComponentBase { #region SERVICES - [Inject] private IMediaWebAPIService MediaWebAPIService { get; set; } = default!; - [Inject] private IPersonsWebAPIService PersonsWebAPIService { get; set; } = default!; - [Inject] private IRolesWebAPIService RolesWebAPIService { get; set; } = default!; + [Inject] private IMediaClientService MediaClientService { get; set; } = default!; + [Inject] private IPersonsClientService PersonsClientService { get; set; } = default!; + [Inject] private IRolesClientService RolesClientService { get; set; } = default!; #endregion diff --git a/WatchIt.Website/WatchIt.Website/Components/Pages/MediaPage/Panels/MediaCreatorRolesPanelComponent.razor b/WatchIt.Website/WatchIt.Website/Components/Pages/MediaPage/Panels/MediaCreatorRolesPanelComponent.razor index 3361227..851721f 100644 --- a/WatchIt.Website/WatchIt.Website/Components/Pages/MediaPage/Panels/MediaCreatorRolesPanelComponent.razor +++ b/WatchIt.Website/WatchIt.Website/Components/Pages/MediaPage/Panels/MediaCreatorRolesPanelComponent.razor @@ -22,17 +22,17 @@ TRoleParent="PersonResponse" Id="@(Id)" Query="@(_query)" - GetRolesAction="@(MediaWebAPIService.GetMediaAllCreatorRoles)" + GetRolesAction="@(MediaClientService.GetMediaAllCreatorRoles)" NameSource="@((_, parent) => parent.Name)" - GetRoleParentMethod="@((id, action) => PersonsWebAPIService.GetPerson(id, action))" + GetRoleParentMethod="@((id, action) => PersonsClientService.GetPerson(id, action))" ParentItemIdSource="@(item => item.PersonId)" ParentUrlTemplate="/person/{0}" PosterPlaceholder="/assets/person_poster.png" - PosterDownloadingTask="@((id, action) => PersonsWebAPIService.GetPersonPhoto(id, action))" - GetGlobalRatingMethod="@((id, action) => RolesWebAPIService.GetCreatorRoleRating(id, action))" - GetUserRatingMethod="@((id, userId, actionSuccess, actionNotFound) => RolesWebAPIService.GetCreatorRoleRatingByUser(id, userId, actionSuccess, actionNotFound))" - PutRatingMethod="@((id, request) => RolesWebAPIService.PutCreatorRoleRating(id, request))" - DeleteRatingMethod="@((id) => RolesWebAPIService.DeleteCreatorRoleRating(id))"/> + PosterDownloadingTask="@((id, action) => PersonsClientService.GetPersonPhoto(id, action))" + GetGlobalRatingMethod="@((id, action) => RolesClientService.GetCreatorRoleRating(id, action))" + GetUserRatingMethod="@((id, userId, actionSuccess, actionNotFound) => RolesClientService.GetCreatorRoleRatingByUser(id, userId, actionSuccess, actionNotFound))" + PutRatingMethod="@((id, request) => RolesClientService.PutCreatorRoleRating(id, request))" + DeleteRatingMethod="@((id) => RolesClientService.DeleteCreatorRoleRating(id))"/> } else diff --git a/WatchIt.Website/WatchIt.Website/Components/Pages/MediaPage/Panels/MediaCreatorRolesPanelComponent.razor.cs b/WatchIt.Website/WatchIt.Website/Components/Pages/MediaPage/Panels/MediaCreatorRolesPanelComponent.razor.cs index c1bb1b4..3d86984 100644 --- a/WatchIt.Website/WatchIt.Website/Components/Pages/MediaPage/Panels/MediaCreatorRolesPanelComponent.razor.cs +++ b/WatchIt.Website/WatchIt.Website/Components/Pages/MediaPage/Panels/MediaCreatorRolesPanelComponent.razor.cs @@ -2,10 +2,10 @@ using Microsoft.AspNetCore.Components; using WatchIt.Common.Model.Persons; using WatchIt.Common.Model.Roles; using WatchIt.Website.Components.Common.Subcomponents; -using WatchIt.Website.Services.Utility.Authentication; -using WatchIt.Website.Services.WebAPI.Media; -using WatchIt.Website.Services.WebAPI.Persons; -using WatchIt.Website.Services.WebAPI.Roles; +using WatchIt.Website.Services.Authentication; +using WatchIt.Website.Services.Client.Media; +using WatchIt.Website.Services.Client.Persons; +using WatchIt.Website.Services.Client.Roles; namespace WatchIt.Website.Components.Pages.MediaPage.Panels; @@ -13,9 +13,9 @@ public partial class MediaCreatorRolesPanelComponent : ComponentBase { #region SERVICES - [Inject] private IPersonsWebAPIService PersonsWebAPIService { get; set; } = default!; - [Inject] private IMediaWebAPIService MediaWebAPIService { get; set; } = default!; - [Inject] private IRolesWebAPIService RolesWebAPIService { get; set; } = default!; + [Inject] private IPersonsClientService PersonsClientService { get; set; } = default!; + [Inject] private IMediaClientService MediaClientService { get; set; } = default!; + [Inject] private IRolesClientService RolesClientService { get; set; } = default!; #endregion @@ -54,7 +54,7 @@ public partial class MediaCreatorRolesPanelComponent : ComponentBase // STEP 0 endTasks.AddRange( [ - RolesWebAPIService.GetAllCreatorRoleTypes(successAction: data => _roleTypes = data) + RolesClientService.GetAllCreatorRoleTypes(successAction: data => _roleTypes = data) ]); // END diff --git a/WatchIt.Website/WatchIt.Website/Components/Pages/PersonEditPage/Panels/PersonActorRolesEditPanelComponent.razor.cs b/WatchIt.Website/WatchIt.Website/Components/Pages/PersonEditPage/Panels/PersonActorRolesEditPanelComponent.razor.cs index b462c9e..95a40ab 100644 --- a/WatchIt.Website/WatchIt.Website/Components/Pages/PersonEditPage/Panels/PersonActorRolesEditPanelComponent.razor.cs +++ b/WatchIt.Website/WatchIt.Website/Components/Pages/PersonEditPage/Panels/PersonActorRolesEditPanelComponent.razor.cs @@ -1,9 +1,9 @@ using Microsoft.AspNetCore.Components; using WatchIt.Common.Model.Media; using WatchIt.Common.Model.Roles; -using WatchIt.Website.Services.WebAPI.Media; -using WatchIt.Website.Services.WebAPI.Persons; -using WatchIt.Website.Services.WebAPI.Roles; +using WatchIt.Website.Services.Client.Media; +using WatchIt.Website.Services.Client.Persons; +using WatchIt.Website.Services.Client.Roles; namespace WatchIt.Website.Components.Pages.PersonEditPage.Panels; @@ -11,9 +11,9 @@ public partial class PersonActorRolesEditPanelComponent : ComponentBase { #region SERVICES - [Inject] private IPersonsWebAPIService PersonsWebAPIService { get; set; } = default!; - [Inject] private IMediaWebAPIService MediaWebAPIService { get; set; } = default!; - [Inject] private IRolesWebAPIService RolesWebAPIService { get; set; } = default!; + [Inject] private IPersonsClientService PersonsClientService { get; set; } = default!; + [Inject] private IMediaClientService MediaClientService { get; set; } = default!; + [Inject] private IRolesClientService RolesClientService { get; set; } = default!; #endregion @@ -61,8 +61,8 @@ public partial class PersonActorRolesEditPanelComponent : ComponentBase { endTasks.AddRange( [ - PersonsWebAPIService.GetPersonAllActorRoles(Id.Value, successAction: data => _roles = data.ToDictionary(x => x.Id, x => (x, false))), - RolesWebAPIService.GetAllActorRoleTypes(successAction: data => _roleTypes = data.ToDictionary(x => x.Id, x => x.Name)), + PersonsClientService.GetPersonAllActorRoles(Id.Value, successAction: data => _roles = data.ToDictionary(x => x.Id, x => (x, false))), + RolesClientService.GetAllActorRoleTypes(successAction: data => _roleTypes = data.ToDictionary(x => x.Id, x => x.Name)), ]); } @@ -122,11 +122,11 @@ public partial class PersonActorRolesEditPanelComponent : ComponentBase _saving = true; if (_editedId.HasValue) { - await RolesWebAPIService.PutActorRole(_editedId.Value, _editedModel as ActorRoleUniversalRequest, SuccessPut, BadRequest, Unauthorized); + await RolesClientService.PutActorRole(_editedId.Value, _editedModel as ActorRoleUniversalRequest, SuccessPut, BadRequest, Unauthorized); } else { - await PersonsWebAPIService.PostPersonActorRole(Id!.Value, _editedModel as ActorRolePersonRequest, SuccessPost, BadRequest, Unauthorized); + await PersonsClientService.PostPersonActorRole(Id!.Value, _editedModel as ActorRolePersonRequest, SuccessPost, BadRequest, Unauthorized); } } @@ -143,7 +143,7 @@ public partial class PersonActorRolesEditPanelComponent : ComponentBase private async Task Delete(Guid id) { _roles[id] = (_roles[id].Data, true); - await RolesWebAPIService.DeleteActorRole(id, () => _roles.Remove(id)); + await RolesClientService.DeleteActorRole(id, () => _roles.Remove(id)); } #endregion diff --git a/WatchIt.Website/WatchIt.Website/Components/Pages/PersonEditPage/Panels/PersonCreatorRolesEditPanelComponent.razor.cs b/WatchIt.Website/WatchIt.Website/Components/Pages/PersonEditPage/Panels/PersonCreatorRolesEditPanelComponent.razor.cs index ca9b0c6..11a81d3 100644 --- a/WatchIt.Website/WatchIt.Website/Components/Pages/PersonEditPage/Panels/PersonCreatorRolesEditPanelComponent.razor.cs +++ b/WatchIt.Website/WatchIt.Website/Components/Pages/PersonEditPage/Panels/PersonCreatorRolesEditPanelComponent.razor.cs @@ -1,9 +1,9 @@ using Microsoft.AspNetCore.Components; using WatchIt.Common.Model.Media; using WatchIt.Common.Model.Roles; -using WatchIt.Website.Services.WebAPI.Media; -using WatchIt.Website.Services.WebAPI.Persons; -using WatchIt.Website.Services.WebAPI.Roles; +using WatchIt.Website.Services.Client.Media; +using WatchIt.Website.Services.Client.Persons; +using WatchIt.Website.Services.Client.Roles; namespace WatchIt.Website.Components.Pages.PersonEditPage.Panels; @@ -11,9 +11,9 @@ public partial class PersonCreatorRolesEditPanelComponent : ComponentBase { #region SERVICES - [Inject] private IPersonsWebAPIService PersonsWebAPIService { get; set; } = default!; - [Inject] private IMediaWebAPIService MediaWebAPIService { get; set; } = default!; - [Inject] private IRolesWebAPIService RolesWebAPIService { get; set; } = default!; + [Inject] private IPersonsClientService PersonsClientService { get; set; } = default!; + [Inject] private IMediaClientService MediaClientService { get; set; } = default!; + [Inject] private IRolesClientService RolesClientService { get; set; } = default!; #endregion @@ -61,8 +61,8 @@ public partial class PersonCreatorRolesEditPanelComponent : ComponentBase { endTasks.AddRange( [ - PersonsWebAPIService.GetPersonAllCreatorRoles(Id.Value, successAction: data => _roles = data.ToDictionary(x => x.Id, x => (x, false))), - RolesWebAPIService.GetAllCreatorRoleTypes(successAction: data => _roleTypes = data.ToDictionary(x => x.Id, x => x.Name)), + PersonsClientService.GetPersonAllCreatorRoles(Id.Value, successAction: data => _roles = data.ToDictionary(x => x.Id, x => (x, false))), + RolesClientService.GetAllCreatorRoleTypes(successAction: data => _roleTypes = data.ToDictionary(x => x.Id, x => x.Name)), ]); } @@ -121,11 +121,11 @@ public partial class PersonCreatorRolesEditPanelComponent : ComponentBase _saving = true; if (_editedId.HasValue) { - await RolesWebAPIService.PutCreatorRole(_editedId.Value, _editedModel as CreatorRoleUniversalRequest, SuccessPut, BadRequest, Unauthorized); + await RolesClientService.PutCreatorRole(_editedId.Value, _editedModel as CreatorRoleUniversalRequest, SuccessPut, BadRequest, Unauthorized); } else { - await PersonsWebAPIService.PostPersonCreatorRole(Id!.Value, _editedModel as CreatorRolePersonRequest, SuccessPost, BadRequest, Unauthorized); + await PersonsClientService.PostPersonCreatorRole(Id!.Value, _editedModel as CreatorRolePersonRequest, SuccessPost, BadRequest, Unauthorized); } } @@ -142,7 +142,7 @@ public partial class PersonCreatorRolesEditPanelComponent : ComponentBase private async Task Delete(Guid id) { _roles[id] = (_roles[id].Data, true); - await RolesWebAPIService.DeleteCreatorRole(id, () => _roles.Remove(id)); + await RolesClientService.DeleteCreatorRole(id, () => _roles.Remove(id)); } #endregion diff --git a/WatchIt.Website/WatchIt.Website/Components/Pages/PersonEditPage/Panels/PersonEditFormPanelComponent.razor.cs b/WatchIt.Website/WatchIt.Website/Components/Pages/PersonEditPage/Panels/PersonEditFormPanelComponent.razor.cs index c76a9ff..98be2da 100644 --- a/WatchIt.Website/WatchIt.Website/Components/Pages/PersonEditPage/Panels/PersonEditFormPanelComponent.razor.cs +++ b/WatchIt.Website/WatchIt.Website/Components/Pages/PersonEditPage/Panels/PersonEditFormPanelComponent.razor.cs @@ -1,8 +1,8 @@ using Microsoft.AspNetCore.Components; using WatchIt.Common.Model.Genders; using WatchIt.Common.Model.Persons; -using WatchIt.Website.Services.WebAPI.Genders; -using WatchIt.Website.Services.WebAPI.Persons; +using WatchIt.Website.Services.Client.Genders; +using WatchIt.Website.Services.Client.Persons; namespace WatchIt.Website.Components.Pages.PersonEditPage.Panels; @@ -11,8 +11,8 @@ public partial class PersonEditFormPanelComponent : ComponentBase #region SERVICES [Inject] private NavigationManager NavigationManager { get; set; } = default!; - [Inject] private IPersonsWebAPIService PersonsWebAPIService { get; set; } = default!; - [Inject] private IGendersWebAPIService GendersWebAPIService { get; set; } = default!; + [Inject] private IPersonsClientService PersonsClientService { get; set; } = default!; + [Inject] private IGendersClientService GendersClientService { get; set; } = default!; #endregion @@ -52,13 +52,13 @@ public partial class PersonEditFormPanelComponent : ComponentBase // STEP 0 endTasks.AddRange( [ - GendersWebAPIService.GetAllGenders(successAction: data => _genders = data) + GendersClientService.GetAllGenders(successAction: data => _genders = data) ]); if (Id.HasValue) { endTasks.AddRange( [ - PersonsWebAPIService.GetPerson(Id.Value, data => _person = new PersonRequest(data)) + PersonsClientService.GetPerson(Id.Value, data => _person = new PersonRequest(data)) ]); } @@ -98,11 +98,11 @@ public partial class PersonEditFormPanelComponent : ComponentBase _saving = true; if (Id.HasValue) { - await PersonsWebAPIService.PutPerson(Id.Value, _person, PutSuccess, BadRequest, AuthError, AuthError); + await PersonsClientService.PutPerson(Id.Value, _person, PutSuccess, BadRequest, AuthError, AuthError); } else { - await PersonsWebAPIService.PostPerson(_person, PostSuccess, BadRequest, AuthError, AuthError); + await PersonsClientService.PostPerson(_person, PostSuccess, BadRequest, AuthError, AuthError); } } diff --git a/WatchIt.Website/WatchIt.Website/Components/Pages/PersonPage/Panels/PersonActorRolesPanelComponent.razor b/WatchIt.Website/WatchIt.Website/Components/Pages/PersonPage/Panels/PersonActorRolesPanelComponent.razor index 88a40e8..068bd6d 100644 --- a/WatchIt.Website/WatchIt.Website/Components/Pages/PersonPage/Panels/PersonActorRolesPanelComponent.razor +++ b/WatchIt.Website/WatchIt.Website/Components/Pages/PersonPage/Panels/PersonActorRolesPanelComponent.razor @@ -10,18 +10,18 @@ TQuery="ActorRolePersonQueryParameters" TRoleParent="MediaResponse" Id="@(Id)" - GetRolesAction="@(PersonsWebAPIService.GetPersonAllActorRoles)" + GetRolesAction="@(PersonsClientService.GetPersonAllActorRoles)" NameSource="@((_, parent) => parent.Title)" AdditionalInfoSource="@((item, _) => $" as {item.Name}")" - GetRoleParentMethod="@((id, action) => MediaWebAPIService.GetMedia(id, action))" + GetRoleParentMethod="@((id, action) => MediaClientService.GetMedia(id, action))" ParentItemIdSource="@(item => item.MediaId)" ParentUrlTemplate="/media/{0}" PosterPlaceholder="/assets/media_poster.png" - PosterDownloadingTask="@((id, action) => MediaWebAPIService.GetMediaPoster(id, action))" - GetGlobalRatingMethod="@((id, action) => RolesWebAPIService.GetActorRoleRating(id, action))" - GetUserRatingMethod="@((id, userId, actionSuccess, actionNotFound) => RolesWebAPIService.GetActorRoleRatingByUser(id, userId, actionSuccess, actionNotFound))" - PutRatingMethod="@((id, request) => RolesWebAPIService.PutActorRoleRating(id, request))" - DeleteRatingMethod="@(id => RolesWebAPIService.DeleteActorRoleRating(id))" + PosterDownloadingTask="@((id, action) => MediaClientService.GetMediaPoster(id, action))" + GetGlobalRatingMethod="@((id, action) => RolesClientService.GetActorRoleRating(id, action))" + GetUserRatingMethod="@((id, userId, actionSuccess, actionNotFound) => RolesClientService.GetActorRoleRatingByUser(id, userId, actionSuccess, actionNotFound))" + PutRatingMethod="@((id, request) => RolesClientService.PutActorRoleRating(id, request))" + DeleteRatingMethod="@(id => RolesClientService.DeleteActorRoleRating(id))" OnRatingChanged="@(OnRatingChanged)"/> \ No newline at end of file diff --git a/WatchIt.Website/WatchIt.Website/Components/Pages/PersonPage/Panels/PersonActorRolesPanelComponent.razor.cs b/WatchIt.Website/WatchIt.Website/Components/Pages/PersonPage/Panels/PersonActorRolesPanelComponent.razor.cs index 4b87639..20f6776 100644 --- a/WatchIt.Website/WatchIt.Website/Components/Pages/PersonPage/Panels/PersonActorRolesPanelComponent.razor.cs +++ b/WatchIt.Website/WatchIt.Website/Components/Pages/PersonPage/Panels/PersonActorRolesPanelComponent.razor.cs @@ -1,7 +1,7 @@ using Microsoft.AspNetCore.Components; -using WatchIt.Website.Services.WebAPI.Media; -using WatchIt.Website.Services.WebAPI.Persons; -using WatchIt.Website.Services.WebAPI.Roles; +using WatchIt.Website.Services.Client.Media; +using WatchIt.Website.Services.Client.Persons; +using WatchIt.Website.Services.Client.Roles; namespace WatchIt.Website.Components.Pages.PersonPage.Panels; @@ -9,9 +9,9 @@ public partial class PersonActorRolesPanelComponent : ComponentBase { #region SERVICES - [Inject] private IMediaWebAPIService MediaWebAPIService { get; set; } = default!; - [Inject] private IPersonsWebAPIService PersonsWebAPIService { get; set; } = default!; - [Inject] private IRolesWebAPIService RolesWebAPIService { get; set; } = default!; + [Inject] private IMediaClientService MediaClientService { get; set; } = default!; + [Inject] private IPersonsClientService PersonsClientService { get; set; } = default!; + [Inject] private IRolesClientService RolesClientService { get; set; } = default!; #endregion diff --git a/WatchIt.Website/WatchIt.Website/Components/Pages/PersonPage/Panels/PersonCreatorRolesPanelComponent.razor b/WatchIt.Website/WatchIt.Website/Components/Pages/PersonPage/Panels/PersonCreatorRolesPanelComponent.razor index 609b18a..73173b9 100644 --- a/WatchIt.Website/WatchIt.Website/Components/Pages/PersonPage/Panels/PersonCreatorRolesPanelComponent.razor +++ b/WatchIt.Website/WatchIt.Website/Components/Pages/PersonPage/Panels/PersonCreatorRolesPanelComponent.razor @@ -22,17 +22,17 @@ TRoleParent="MediaResponse" Id="@(Id)" Query="@(_query)" - GetRolesAction="@(PersonsWebAPIService.GetPersonAllCreatorRoles)" + GetRolesAction="@(PersonsClientService.GetPersonAllCreatorRoles)" NameSource="@((_, parent) => parent.Title)" - GetRoleParentMethod="@((id, action) => MediaWebAPIService.GetMedia(id, action))" + GetRoleParentMethod="@((id, action) => MediaClientService.GetMedia(id, action))" ParentItemIdSource="@(item => item.MediaId)" ParentUrlTemplate="/media/{0}" PosterPlaceholder="/assets/media_poster.png" - PosterDownloadingTask="@((id, action) => MediaWebAPIService.GetMediaPoster(id, action))" - GetGlobalRatingMethod="@((id, action) => RolesWebAPIService.GetCreatorRoleRating(id, action))" - GetUserRatingMethod="@((id, userId, actionSuccess, actionNotFound) => RolesWebAPIService.GetCreatorRoleRatingByUser(id, userId, actionSuccess, actionNotFound))" - PutRatingMethod="@((id, request) => RolesWebAPIService.PutCreatorRoleRating(id, request))" - DeleteRatingMethod="@((id) => RolesWebAPIService.DeleteCreatorRoleRating(id))" + PosterDownloadingTask="@((id, action) => MediaClientService.GetMediaPoster(id, action))" + GetGlobalRatingMethod="@((id, action) => RolesClientService.GetCreatorRoleRating(id, action))" + GetUserRatingMethod="@((id, userId, actionSuccess, actionNotFound) => RolesClientService.GetCreatorRoleRatingByUser(id, userId, actionSuccess, actionNotFound))" + PutRatingMethod="@((id, request) => RolesClientService.PutCreatorRoleRating(id, request))" + DeleteRatingMethod="@((id) => RolesClientService.DeleteCreatorRoleRating(id))" OnRatingChanged="@(OnRatingChanged)"/> } diff --git a/WatchIt.Website/WatchIt.Website/Components/Pages/PersonPage/Panels/PersonCreatorRolesPanelComponent.razor.cs b/WatchIt.Website/WatchIt.Website/Components/Pages/PersonPage/Panels/PersonCreatorRolesPanelComponent.razor.cs index ac6f353..98fefb2 100644 --- a/WatchIt.Website/WatchIt.Website/Components/Pages/PersonPage/Panels/PersonCreatorRolesPanelComponent.razor.cs +++ b/WatchIt.Website/WatchIt.Website/Components/Pages/PersonPage/Panels/PersonCreatorRolesPanelComponent.razor.cs @@ -2,9 +2,9 @@ using Microsoft.AspNetCore.Components; using WatchIt.Common.Model.Media; using WatchIt.Common.Model.Roles; using WatchIt.Website.Components.Common.Subcomponents; -using WatchIt.Website.Services.WebAPI.Media; -using WatchIt.Website.Services.WebAPI.Persons; -using WatchIt.Website.Services.WebAPI.Roles; +using WatchIt.Website.Services.Client.Media; +using WatchIt.Website.Services.Client.Persons; +using WatchIt.Website.Services.Client.Roles; namespace WatchIt.Website.Components.Pages.PersonPage.Panels; @@ -12,9 +12,9 @@ public partial class PersonCreatorRolesPanelComponent : ComponentBase { #region SERVICES - [Inject] private IPersonsWebAPIService PersonsWebAPIService { get; set; } = default!; - [Inject] private IMediaWebAPIService MediaWebAPIService { get; set; } = default!; - [Inject] private IRolesWebAPIService RolesWebAPIService { get; set; } = default!; + [Inject] private IPersonsClientService PersonsClientService { get; set; } = default!; + [Inject] private IMediaClientService MediaClientService { get; set; } = default!; + [Inject] private IRolesClientService RolesClientService { get; set; } = default!; #endregion @@ -54,7 +54,7 @@ public partial class PersonCreatorRolesPanelComponent : ComponentBase // STEP 0 endTasks.AddRange( [ - RolesWebAPIService.GetAllCreatorRoleTypes(successAction: data => _roleTypes = data) + RolesClientService.GetAllCreatorRoleTypes(successAction: data => _roleTypes = data) ]); // END diff --git a/WatchIt.Website/WatchIt.Website/Components/Pages/PersonPage/Panels/PersonRatingPanel.razor.cs b/WatchIt.Website/WatchIt.Website/Components/Pages/PersonPage/Panels/PersonRatingPanel.razor.cs index 4e57c54..45d5b55 100644 --- a/WatchIt.Website/WatchIt.Website/Components/Pages/PersonPage/Panels/PersonRatingPanel.razor.cs +++ b/WatchIt.Website/WatchIt.Website/Components/Pages/PersonPage/Panels/PersonRatingPanel.razor.cs @@ -1,7 +1,7 @@ using Microsoft.AspNetCore.Components; using WatchIt.Common.Model.Rating; -using WatchIt.Website.Services.Utility.Authentication; -using WatchIt.Website.Services.WebAPI.Persons; +using WatchIt.Website.Services.Authentication; +using WatchIt.Website.Services.Client.Persons; namespace WatchIt.Website.Components.Pages.PersonPage.Panels; @@ -10,7 +10,7 @@ public partial class PersonRatingPanel : ComponentBase #region SERVICES [Inject] private IAuthenticationService AuthenticationService { get; set; } = default!; - [Inject] private IPersonsWebAPIService PersonsWebAPIService { get; set; } = default!; + [Inject] private IPersonsClientService PersonsClientService { get; set; } = default!; #endregion @@ -83,13 +83,13 @@ public partial class PersonRatingPanel : ComponentBase } } - protected async Task UpdateGlobalRating() => await PersonsWebAPIService.GetPersonGlobalRating(Id, data => Rating = data); + protected async Task UpdateGlobalRating() => await PersonsClientService.GetPersonGlobalRating(Id, data => Rating = data); protected async Task UpdateUserRating() { if (_user is not null) { - await PersonsWebAPIService.GetPersonUserRating(Id, _user.Id, data => _userRating = data); + await PersonsClientService.GetPersonUserRating(Id, _user.Id, data => _userRating = data); } } diff --git a/WatchIt.Website/WatchIt.Website/Layout/MainLayout.razor b/WatchIt.Website/WatchIt.Website/Layout/MainLayout.razor index 63f25b6..deb1be0 100644 --- a/WatchIt.Website/WatchIt.Website/Layout/MainLayout.razor +++ b/WatchIt.Website/WatchIt.Website/Layout/MainLayout.razor @@ -1,6 +1,6 @@ @using System.Net @using WatchIt.Common.Model.Photos -@using WatchIt.Website.Services.WebAPI.Photos +@using WatchIt.Website.Services.Client.Photos @inherits LayoutComponentBase diff --git a/WatchIt.Website/WatchIt.Website/Layout/MainLayout.razor.cs b/WatchIt.Website/WatchIt.Website/Layout/MainLayout.razor.cs index db6a271..1f2f80b 100644 --- a/WatchIt.Website/WatchIt.Website/Layout/MainLayout.razor.cs +++ b/WatchIt.Website/WatchIt.Website/Layout/MainLayout.razor.cs @@ -2,11 +2,11 @@ using System.Net; using Microsoft.AspNetCore.Components; using WatchIt.Common.Model.Accounts; using WatchIt.Common.Model.Photos; -using WatchIt.Website.Services.Utility.Authentication; -using WatchIt.Website.Services.Utility.Tokens; -using WatchIt.Website.Services.WebAPI.Accounts; -using WatchIt.Website.Services.WebAPI.Media; -using WatchIt.Website.Services.WebAPI.Photos; +using WatchIt.Website.Services.Authentication; +using WatchIt.Website.Services.Tokens; +using WatchIt.Website.Services.Client.Accounts; +using WatchIt.Website.Services.Client.Media; +using WatchIt.Website.Services.Client.Photos; namespace WatchIt.Website.Layout; @@ -18,9 +18,9 @@ public partial class MainLayout : LayoutComponentBase [Inject] public NavigationManager NavigationManager { get; set; } = default!; [Inject] public ITokensService TokensService { get; set; } = default!; [Inject] public IAuthenticationService AuthenticationService { get; set; } = default!; - [Inject] public IAccountsWebAPIService AccountsWebAPIService { get; set; } = default!; - [Inject] public IMediaWebAPIService MediaWebAPIService { get; set; } = default!; - [Inject] public IPhotosWebAPIService PhotosWebAPIService { get; set; } = default!; + [Inject] public IAccountsClientService AccountsClientService { get; set; } = default!; + [Inject] public IMediaClientService MediaClientService { get; set; } = default!; + [Inject] public IPhotosClientService PhotosClientService { get; set; } = default!; #endregion @@ -76,7 +76,7 @@ public partial class MainLayout : LayoutComponentBase ]); endTasks.AddRange( [ - PhotosWebAPIService.GetPhotoRandomBackground(data => _defaultBackgroundPhoto = data) + PhotosClientService.GetPhotoRandomBackground(data => _defaultBackgroundPhoto = data) ]); // STEP 1 @@ -85,7 +85,7 @@ public partial class MainLayout : LayoutComponentBase { endTasks.AddRange( [ - AccountsWebAPIService.GetAccountProfilePicture(_user.Id, data => _userProfilePicture = data) + AccountsClientService.GetAccountProfilePicture(_user.Id, data => _userProfilePicture = data) ]); } diff --git a/WatchIt.Website/WatchIt.Website/Pages/AdminPage.razor.cs b/WatchIt.Website/WatchIt.Website/Pages/AdminPage.razor.cs index 3817611..b8993a8 100644 --- a/WatchIt.Website/WatchIt.Website/Pages/AdminPage.razor.cs +++ b/WatchIt.Website/WatchIt.Website/Pages/AdminPage.razor.cs @@ -1,6 +1,6 @@ using Microsoft.AspNetCore.Components; using WatchIt.Website.Layout; -using WatchIt.Website.Services.Utility.Authentication; +using WatchIt.Website.Services.Authentication; namespace WatchIt.Website.Pages; diff --git a/WatchIt.Website/WatchIt.Website/Pages/AdminPage.razor.css b/WatchIt.Website/WatchIt.Website/Pages/AdminPage.razor.css deleted file mode 100644 index 5f28270..0000000 --- a/WatchIt.Website/WatchIt.Website/Pages/AdminPage.razor.css +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/WatchIt.Website/WatchIt.Website/Pages/AuthPage.razor.cs b/WatchIt.Website/WatchIt.Website/Pages/AuthPage.razor.cs index d646264..05f6be9 100644 --- a/WatchIt.Website/WatchIt.Website/Pages/AuthPage.razor.cs +++ b/WatchIt.Website/WatchIt.Website/Pages/AuthPage.razor.cs @@ -3,11 +3,11 @@ using Microsoft.AspNetCore.Components; using WatchIt.Common.Model.Accounts; using WatchIt.Common.Model.Media; using WatchIt.Common.Model.Photos; -using WatchIt.Website.Services.Utility.Authentication; -using WatchIt.Website.Services.Utility.Tokens; -using WatchIt.Website.Services.WebAPI.Accounts; -using WatchIt.Website.Services.WebAPI.Media; -using WatchIt.Website.Services.WebAPI.Photos; +using WatchIt.Website.Services.Authentication; +using WatchIt.Website.Services.Tokens; +using WatchIt.Website.Services.Client.Accounts; +using WatchIt.Website.Services.Client.Media; +using WatchIt.Website.Services.Client.Photos; namespace WatchIt.Website.Pages; @@ -18,9 +18,9 @@ public partial class AuthPage [Inject] public ILogger Logger { get; set; } = default!; [Inject] public IAuthenticationService AuthenticationService { get; set; } = default!; [Inject] public ITokensService TokensService { get; set; } = default!; - [Inject] public IMediaWebAPIService MediaWebAPIService { get; set; } = default!; - [Inject] public IAccountsWebAPIService AccountsWebAPIService { get; set; } = default!; - [Inject] public IPhotosWebAPIService PhotosWebAPIService { get; set; } = default!; + [Inject] public IMediaClientService MediaClientService { get; set; } = default!; + [Inject] public IAccountsClientService AccountsClientService { get; set; } = default!; + [Inject] public IPhotosClientService PhotosClientService { get; set; } = default!; [Inject] public NavigationManager NavigationManager { get; set; } = default!; #endregion @@ -80,7 +80,7 @@ public partial class AuthPage // STEP 0 endTasks.AddRange( [ - PhotosWebAPIService.GetPhotoRandomBackground(data => _background = data) + PhotosClientService.GetPhotoRandomBackground(data => _background = data) ]); // END @@ -112,7 +112,7 @@ public partial class AuthPage } - await AccountsWebAPIService.Authenticate(_loginModel, async (data) => await LoginSuccess(data), LoginBadRequest, LoginUnauthorized); + await AccountsClientService.Authenticate(_loginModel, async (data) => await LoginSuccess(data), LoginBadRequest, LoginUnauthorized); } private async Task Register() @@ -137,7 +137,7 @@ public partial class AuthPage _formMessage = "Password fields don't match"; return; } - await AccountsWebAPIService.Register(_registerModel, RegisterSuccess, RegisterBadRequest); + await AccountsClientService.Register(_registerModel, RegisterSuccess, RegisterBadRequest); } #endregion diff --git a/WatchIt.Website/WatchIt.Website/Pages/DatabasePage.razor b/WatchIt.Website/WatchIt.Website/Pages/DatabasePage.razor index 5740ae8..c1cbd6a 100644 --- a/WatchIt.Website/WatchIt.Website/Pages/DatabasePage.razor +++ b/WatchIt.Website/WatchIt.Website/Pages/DatabasePage.razor @@ -38,8 +38,8 @@ AdditionalNameInfoSource="@(item => item.ReleaseDate.HasValue ? $" ({item.ReleaseDate.Value.Year})" : null)" RatingSource="@(item => item.Rating)" UrlIdTemplate="/media/{0}" - PictureDownloadingTask="@((id, action) => MediaWebAPIService.GetMediaPoster(id, action))" - ItemDownloadingTask="@(MoviesWebAPIService.GetAllMovies)" + PictureDownloadingTask="@((id, action) => MediaClientService.GetMediaPoster(id, action))" + ItemDownloadingTask="@(MoviesClientService.GetAllMovies)" SortingOptions="@(new Dictionary { { "rating.count", "Number of ratings" }, @@ -48,10 +48,10 @@ { "release_date", "Release date" }, })" PosterPlaceholder="/assets/media_poster.png" - GetGlobalRatingMethod="@((id, action) => MediaWebAPIService.GetMediaRating(id, action))" - GetUserRatingMethod="@((id, userId, successAction, notfoundAction) => MediaWebAPIService.GetMediaRatingByUser(id, userId, successAction, notfoundAction))" - PutRatingMethod="@((id, request) => MediaWebAPIService.PutMediaRating(id, request))" - DeleteRatingMethod="@(id => MediaWebAPIService.DeleteMediaRating(id))"> + GetGlobalRatingMethod="@((id, action) => MediaClientService.GetMediaRating(id, action))" + GetUserRatingMethod="@((id, userId, successAction, notfoundAction) => MediaClientService.GetMediaRatingByUser(id, userId, successAction, notfoundAction))" + PutRatingMethod="@((id, request) => MediaClientService.PutMediaRating(id, request))" + DeleteRatingMethod="@(id => MediaClientService.DeleteMediaRating(id))"> break; @@ -64,8 +64,8 @@ AdditionalNameInfoSource="@(item => item.ReleaseDate.HasValue ? $" ({item.ReleaseDate.Value.Year})" : null)" RatingSource="@(item => item.Rating)" UrlIdTemplate="/media/{0}" - PictureDownloadingTask="@((id, action) => MediaWebAPIService.GetMediaPoster(id, action))" - ItemDownloadingTask="@(SeriesWebAPIService.GetAllSeries)" + PictureDownloadingTask="@((id, action) => MediaClientService.GetMediaPoster(id, action))" + ItemDownloadingTask="@(SeriesClientService.GetAllSeries)" SortingOptions="@(new Dictionary { { "rating.count", "Number of ratings" }, @@ -74,10 +74,10 @@ { "release_date", "Release date" }, })" PosterPlaceholder="/assets/media_poster.png" - GetGlobalRatingMethod="@((id, action) => MediaWebAPIService.GetMediaRating(id, action))" - GetUserRatingMethod="@((id, userId, successAction, notfoundAction) => MediaWebAPIService.GetMediaRatingByUser(id, userId, successAction, notfoundAction))" - PutRatingMethod="@((id, request) => MediaWebAPIService.PutMediaRating(id, request))" - DeleteRatingMethod="@(id => MediaWebAPIService.DeleteMediaRating(id))"> + GetGlobalRatingMethod="@((id, action) => MediaClientService.GetMediaRating(id, action))" + GetUserRatingMethod="@((id, userId, successAction, notfoundAction) => MediaClientService.GetMediaRatingByUser(id, userId, successAction, notfoundAction))" + PutRatingMethod="@((id, request) => MediaClientService.PutMediaRating(id, request))" + DeleteRatingMethod="@(id => MediaClientService.DeleteMediaRating(id))"> break; @@ -89,8 +89,8 @@ NameSource="@(item => item.Name)" RatingSource="@(item => item.Rating)" UrlIdTemplate="/person/{0}" - PictureDownloadingTask="@((id, action) => PersonsWebAPIService.GetPersonPhoto(id, action))" - ItemDownloadingTask="@(PersonsWebAPIService.GetAllPersons)" + PictureDownloadingTask="@((id, action) => PersonsClientService.GetPersonPhoto(id, action))" + ItemDownloadingTask="@(PersonsClientService.GetAllPersons)" SortingOptions="@(new Dictionary { { "rating.count", "Number of ratings" }, @@ -100,7 +100,7 @@ { "death_date", "Death date" }, })" PosterPlaceholder="/assets/person_poster.png" - GetGlobalRatingMethod="@((id, action) => PersonsWebAPIService.GetPersonGlobalRating(id, action))"> + GetGlobalRatingMethod="@((id, action) => PersonsClientService.GetPersonGlobalRating(id, action))"> break; diff --git a/WatchIt.Website/WatchIt.Website/Pages/DatabasePage.razor.cs b/WatchIt.Website/WatchIt.Website/Pages/DatabasePage.razor.cs index 179454a..48ae59b 100644 --- a/WatchIt.Website/WatchIt.Website/Pages/DatabasePage.razor.cs +++ b/WatchIt.Website/WatchIt.Website/Pages/DatabasePage.razor.cs @@ -1,9 +1,9 @@ using Microsoft.AspNetCore.Components; using WatchIt.Website.Layout; -using WatchIt.Website.Services.WebAPI.Media; -using WatchIt.Website.Services.WebAPI.Movies; -using WatchIt.Website.Services.WebAPI.Persons; -using WatchIt.Website.Services.WebAPI.Series; +using WatchIt.Website.Services.Client.Media; +using WatchIt.Website.Services.Client.Movies; +using WatchIt.Website.Services.Client.Persons; +using WatchIt.Website.Services.Client.Series; namespace WatchIt.Website.Pages; @@ -12,10 +12,10 @@ public partial class DatabasePage : ComponentBase #region SERVICES [Inject] private NavigationManager NavigationManager { get; set; } = default!; - [Inject] private IMediaWebAPIService MediaWebAPIService { get; set; } = default!; - [Inject] private IMoviesWebAPIService MoviesWebAPIService { get; set; } = default!; - [Inject] private ISeriesWebAPIService SeriesWebAPIService { get; set; } = default!; - [Inject] private IPersonsWebAPIService PersonsWebAPIService { get; set; } = default!; + [Inject] private IMediaClientService MediaClientService { get; set; } = default!; + [Inject] private IMoviesClientService MoviesClientService { get; set; } = default!; + [Inject] private ISeriesClientService SeriesClientService { get; set; } = default!; + [Inject] private IPersonsClientService PersonsClientService { get; set; } = default!; #endregion diff --git a/WatchIt.Website/WatchIt.Website/Pages/DatabasePage.razor.css b/WatchIt.Website/WatchIt.Website/Pages/DatabasePage.razor.css deleted file mode 100644 index e69de29..0000000 diff --git a/WatchIt.Website/WatchIt.Website/Pages/HomePage.razor b/WatchIt.Website/WatchIt.Website/Pages/HomePage.razor index f967910..7a43a22 100644 --- a/WatchIt.Website/WatchIt.Website/Pages/HomePage.razor +++ b/WatchIt.Website/WatchIt.Website/Pages/HomePage.razor @@ -12,26 +12,26 @@
+ GetPictureAction="@((id, action) => MediaClientService.GetMediaPoster(id, action))"/> + GetPictureAction="@((id, action) => MediaClientService.GetMediaPoster(id, action))"/> + GetPictureAction="@((id, action) => PersonsClientService.GetPersonPhoto(id, action))"/>
\ No newline at end of file diff --git a/WatchIt.Website/WatchIt.Website/Pages/HomePage.razor.cs b/WatchIt.Website/WatchIt.Website/Pages/HomePage.razor.cs index abed50c..b623573 100644 --- a/WatchIt.Website/WatchIt.Website/Pages/HomePage.razor.cs +++ b/WatchIt.Website/WatchIt.Website/Pages/HomePage.razor.cs @@ -3,10 +3,10 @@ using WatchIt.Common.Model.Media; using WatchIt.Common.Model.Movies; using WatchIt.Common.Model.Series; using WatchIt.Website.Layout; -using WatchIt.Website.Services.WebAPI.Media; -using WatchIt.Website.Services.WebAPI.Movies; -using WatchIt.Website.Services.WebAPI.Persons; -using WatchIt.Website.Services.WebAPI.Series; +using WatchIt.Website.Services.Client.Media; +using WatchIt.Website.Services.Client.Movies; +using WatchIt.Website.Services.Client.Persons; +using WatchIt.Website.Services.Client.Series; namespace WatchIt.Website.Pages; @@ -15,10 +15,10 @@ public partial class HomePage #region SERVICES [Inject] public NavigationManager NavigationManager { get; set; } = default!; - [Inject] public IMediaWebAPIService MediaWebAPIService { get; set; } = default!; - [Inject] public IMoviesWebAPIService MoviesWebAPIService { get; set; } = default!; - [Inject] public ISeriesWebAPIService SeriesWebAPIService { get; set; } = default!; - [Inject] public IPersonsWebAPIService PersonsWebAPIService { get; set; } = default!; + [Inject] public IMediaClientService MediaClientService { get; set; } = default!; + [Inject] public IMoviesClientService MoviesClientService { get; set; } = default!; + [Inject] public ISeriesClientService SeriesClientService { get; set; } = default!; + [Inject] public IPersonsClientService PersonsClientService { get; set; } = default!; #endregion diff --git a/WatchIt.Website/WatchIt.Website/Pages/HomePage.razor.css b/WatchIt.Website/WatchIt.Website/Pages/HomePage.razor.css deleted file mode 100644 index e69de29..0000000 diff --git a/WatchIt.Website/WatchIt.Website/Pages/MediaEditPage.razor b/WatchIt.Website/WatchIt.Website/Pages/MediaEditPage.razor index 58a4ef7..86a3d61 100644 --- a/WatchIt.Website/WatchIt.Website/Pages/MediaEditPage.razor +++ b/WatchIt.Website/WatchIt.Website/Pages/MediaEditPage.razor @@ -58,9 +58,9 @@
diff --git a/WatchIt.Website/WatchIt.Website/Pages/MediaEditPage.razor.cs b/WatchIt.Website/WatchIt.Website/Pages/MediaEditPage.razor.cs index d0dc6f5..ad6d54f 100644 --- a/WatchIt.Website/WatchIt.Website/Pages/MediaEditPage.razor.cs +++ b/WatchIt.Website/WatchIt.Website/Pages/MediaEditPage.razor.cs @@ -7,12 +7,12 @@ using WatchIt.Common.Model.Persons; using WatchIt.Common.Model.Photos; using WatchIt.Common.Model.Series; using WatchIt.Website.Layout; -using WatchIt.Website.Services.Utility.Authentication; -using WatchIt.Website.Services.WebAPI.Media; -using WatchIt.Website.Services.WebAPI.Movies; -using WatchIt.Website.Services.WebAPI.Persons; -using WatchIt.Website.Services.WebAPI.Photos; -using WatchIt.Website.Services.WebAPI.Series; +using WatchIt.Website.Services.Authentication; +using WatchIt.Website.Services.Client.Media; +using WatchIt.Website.Services.Client.Movies; +using WatchIt.Website.Services.Client.Persons; +using WatchIt.Website.Services.Client.Photos; +using WatchIt.Website.Services.Client.Series; namespace WatchIt.Website.Pages; @@ -22,11 +22,11 @@ public partial class MediaEditPage : ComponentBase [Inject] public NavigationManager NavigationManager { get; set; } = default!; [Inject] public IAuthenticationService AuthenticationService { get; set; } = default!; - [Inject] public IMediaWebAPIService MediaWebAPIService { get; set; } = default!; - [Inject] public IMoviesWebAPIService MoviesWebAPIService { get; set; } = default!; - [Inject] public ISeriesWebAPIService SeriesWebAPIService { get; set; } = default!; - [Inject] public IPhotosWebAPIService PhotosWebAPIService { get; set; } = default!; - [Inject] public IPersonsWebAPIService PersonsWebAPIService { get; set; } = default!; + [Inject] public IMediaClientService MediaClientService { get; set; } = default!; + [Inject] public IMoviesClientService MoviesClientService { get; set; } = default!; + [Inject] public ISeriesClientService SeriesClientService { get; set; } = default!; + [Inject] public IPhotosClientService PhotosClientService { get; set; } = default!; + [Inject] public IPersonsClientService PersonsClientService { get; set; } = default!; #endregion @@ -114,7 +114,7 @@ public partial class MediaEditPage : ComponentBase ]); endTasks.AddRange( [ - PersonsWebAPIService.GetAllPersons(successAction: data => _persons = data.ToDictionary(x => x.Id, x => x)) + PersonsClientService.GetAllPersons(successAction: data => _persons = data.ToDictionary(x => x.Id, x => x)) ]); } @@ -124,13 +124,13 @@ public partial class MediaEditPage : ComponentBase { endTasks.AddRange( [ - MediaWebAPIService.GetMediaPhotoRandomBackground(Id.Value, data => Layout.BackgroundPhoto = data), - MediaWebAPIService.GetMediaPoster(Id.Value, data => + MediaClientService.GetMediaPhotoRandomBackground(Id.Value, data => Layout.BackgroundPhoto = data), + MediaClientService.GetMediaPoster(Id.Value, data => { _mediaPosterSaved = data; _mediaPosterRequest = new MediaPosterRequest(data); }), - MediaWebAPIService.GetMediaPhotos(Id.Value, successAction: data => _photos = data) + MediaClientService.GetMediaPhotos(Id.Value, successAction: data => _photos = data) ]); } @@ -145,14 +145,14 @@ public partial class MediaEditPage : ComponentBase { if (Id.HasValue) { - await MediaWebAPIService.GetMedia(Id.Value, data => _media = data, () => NavigationManager.NavigateTo("/media/new/movie")); + await MediaClientService.GetMedia(Id.Value, data => _media = data, () => NavigationManager.NavigateTo("/media/new/movie")); if (_media.Type == MediaType.Movie) { - await MoviesWebAPIService.GetMovie(Id.Value, data => _movieRequest = new MovieRequest(data)); + await MoviesClientService.GetMovie(Id.Value, data => _movieRequest = new MovieRequest(data)); } else { - await SeriesWebAPIService.GetSeries(Id.Value, data => _seriesRequest = new SeriesRequest(data)); + await SeriesClientService.GetSeries(Id.Value, data => _seriesRequest = new SeriesRequest(data)); } } else @@ -210,7 +210,7 @@ public partial class MediaEditPage : ComponentBase } _mediaPosterSaving = true; - await MediaWebAPIService.PutMediaPoster(Id.Value, _mediaPosterRequest, Success); + await MediaClientService.PutMediaPoster(Id.Value, _mediaPosterRequest, Success); } private void CancelPoster() @@ -230,7 +230,7 @@ public partial class MediaEditPage : ComponentBase } _mediaPosterDeleting = true; - await MediaWebAPIService.DeleteMediaPoster(Id.Value, Success); + await MediaClientService.DeleteMediaPoster(Id.Value, Success); } #endregion @@ -259,22 +259,22 @@ public partial class MediaEditPage : ComponentBase { if (_movieRequest is not null) { - await MoviesWebAPIService.PostMovie(_movieRequest, data => SuccessPost(data.Id), BadRequest); + await MoviesClientService.PostMovie(_movieRequest, data => SuccessPost(data.Id), BadRequest); } else { - await SeriesWebAPIService.PostSeries(_seriesRequest, data => SuccessPost(data.Id), BadRequest); + await SeriesClientService.PostSeries(_seriesRequest, data => SuccessPost(data.Id), BadRequest); } } else { if (_movieRequest is not null) { - await MoviesWebAPIService.PutMovie(Id.Value, _movieRequest, () => _basicDataSaving = false, BadRequest); + await MoviesClientService.PutMovie(Id.Value, _movieRequest, () => _basicDataSaving = false, BadRequest); } else { - await SeriesWebAPIService.PutSeries(Id.Value, _seriesRequest, () => _basicDataSaving = false, BadRequest); + await SeriesClientService.PutSeries(Id.Value, _seriesRequest, () => _basicDataSaving = false, BadRequest); } } } @@ -291,7 +291,7 @@ public partial class MediaEditPage : ComponentBase } _photoDeleting.Add(id); - await PhotosWebAPIService.DeletePhoto(id, async () => await Success()); + await PhotosClientService.DeletePhoto(id, async () => await Success()); } private void InitEditPhoto(Guid? id) @@ -345,17 +345,17 @@ public partial class MediaEditPage : ComponentBase if (_photoEditId is null) { _photoEditRequest.Background = _photoEditIsBackground ? _photoEditBackgroundData : null; - await MediaWebAPIService.PostMediaPhoto(Id.Value, _photoEditRequest, Success, BadRequest); + await MediaClientService.PostMediaPhoto(Id.Value, _photoEditRequest, Success, BadRequest); } else { if (_photoEditIsBackground) { - await PhotosWebAPIService.PutPhotoBackgroundData(_photoEditId.Value, _photoEditBackgroundData, Success, BadRequest); + await PhotosClientService.PutPhotoBackgroundData(_photoEditId.Value, _photoEditBackgroundData, Success, BadRequest); } else { - await PhotosWebAPIService.DeletePhotoBackgroundData(_photoEditId.Value, Success); + await PhotosClientService.DeletePhotoBackgroundData(_photoEditId.Value, Success); } } } diff --git a/WatchIt.Website/WatchIt.Website/Pages/MediaPage.razor b/WatchIt.Website/WatchIt.Website/Pages/MediaPage.razor index 2dde4a8..34d068c 100644 --- a/WatchIt.Website/WatchIt.Website/Pages/MediaPage.razor +++ b/WatchIt.Website/WatchIt.Website/Pages/MediaPage.razor @@ -36,7 +36,7 @@ else Subname="@(_media.OriginalTitle)" Description="@(_media.Description)" PosterPlaceholder="/assets/media_poster.png" - GetPosterMethod="@(action => MediaWebAPIService.GetMediaPoster(_media.Id, action))"/> + GetPosterMethod="@(action => MediaClientService.GetMediaPoster(_media.Id, action))"/>
diff --git a/WatchIt.Website/WatchIt.Website/Pages/MediaPage.razor.cs b/WatchIt.Website/WatchIt.Website/Pages/MediaPage.razor.cs index e3321c9..047716f 100644 --- a/WatchIt.Website/WatchIt.Website/Pages/MediaPage.razor.cs +++ b/WatchIt.Website/WatchIt.Website/Pages/MediaPage.razor.cs @@ -7,10 +7,10 @@ using WatchIt.Common.Model.Photos; using WatchIt.Common.Model.Rating; using WatchIt.Common.Model.Series; using WatchIt.Website.Layout; -using WatchIt.Website.Services.Utility.Authentication; -using WatchIt.Website.Services.WebAPI.Media; -using WatchIt.Website.Services.WebAPI.Movies; -using WatchIt.Website.Services.WebAPI.Series; +using WatchIt.Website.Services.Authentication; +using WatchIt.Website.Services.Client.Media; +using WatchIt.Website.Services.Client.Movies; +using WatchIt.Website.Services.Client.Series; namespace WatchIt.Website.Pages; @@ -20,9 +20,9 @@ public partial class MediaPage : ComponentBase [Inject] public NavigationManager NavigationManager { get; set; } = default!; [Inject] public IAuthenticationService AuthenticationService { get; set; } = default!; - [Inject] public IMediaWebAPIService MediaWebAPIService { get; set; } = default!; - [Inject] public IMoviesWebAPIService MoviesWebAPIService { get; set; } = default!; - [Inject] public ISeriesWebAPIService SeriesWebAPIService { get; set; } = default!; + [Inject] public IMediaClientService MediaClientService { get; set; } = default!; + [Inject] public IMoviesClientService MoviesClientService { get; set; } = default!; + [Inject] public ISeriesClientService SeriesClientService { get; set; } = default!; #endregion @@ -74,7 +74,7 @@ public partial class MediaPage : ComponentBase // STEP 0 step1Tasks.AddRange( [ - MediaWebAPIService.GetMedia(Id, data => _media = data, () => _error = $"Media with id {Id} was not found") + MediaClientService.GetMedia(Id, data => _media = data, () => _error = $"Media with id {Id} was not found") ]); // STEP 1 @@ -88,11 +88,11 @@ public partial class MediaPage : ComponentBase endTasks.AddRange( [ - MediaWebAPIService.PostMediaView(Id), - MediaWebAPIService.GetMediaPhotoRandomBackground(Id, data => Layout.BackgroundPhoto = data), - MediaWebAPIService.GetMediaGenres(Id, data => _genres = data), - MediaWebAPIService.GetMediaRating(Id, data => _globalRating = data), - _media.Type == MediaType.Movie ? MoviesWebAPIService.GetMovie(Id, data => _movie = data) : SeriesWebAPIService.GetSeries(Id, data => _series = data), + MediaClientService.PostMediaView(Id), + MediaClientService.GetMediaPhotoRandomBackground(Id, data => Layout.BackgroundPhoto = data), + MediaClientService.GetMediaGenres(Id, data => _genres = data), + MediaClientService.GetMediaRating(Id, data => _globalRating = data), + _media.Type == MediaType.Movie ? MoviesClientService.GetMovie(Id, data => _movie = data) : SeriesClientService.GetSeries(Id, data => _series = data), ]); } @@ -102,7 +102,7 @@ public partial class MediaPage : ComponentBase { endTasks.AddRange( [ - MediaWebAPIService.GetMediaRatingByUser(Id, _user.Id, data => _userRating = data) + MediaClientService.GetMediaRatingByUser(Id, _user.Id, data => _userRating = data) ]); } @@ -118,15 +118,15 @@ public partial class MediaPage : ComponentBase { if (_userRating == rating) { - await MediaWebAPIService.DeleteMediaRating(Id); + await MediaClientService.DeleteMediaRating(Id); _userRating = null; } else { - await MediaWebAPIService.PutMediaRating(Id, new RatingRequest(rating)); + await MediaClientService.PutMediaRating(Id, new RatingRequest(rating)); _userRating = rating; } - await MediaWebAPIService.GetMediaRating(Id, data => _globalRating = data); + await MediaClientService.GetMediaRating(Id, data => _globalRating = data); } #endregion diff --git a/WatchIt.Website/WatchIt.Website/Pages/PersonEditPage.razor b/WatchIt.Website/WatchIt.Website/Pages/PersonEditPage.razor index 4e557d3..466d05d 100644 --- a/WatchIt.Website/WatchIt.Website/Pages/PersonEditPage.razor +++ b/WatchIt.Website/WatchIt.Website/Pages/PersonEditPage.razor @@ -49,9 +49,9 @@
diff --git a/WatchIt.Website/WatchIt.Website/Pages/PersonEditPage.razor.cs b/WatchIt.Website/WatchIt.Website/Pages/PersonEditPage.razor.cs index 242d128..77bd731 100644 --- a/WatchIt.Website/WatchIt.Website/Pages/PersonEditPage.razor.cs +++ b/WatchIt.Website/WatchIt.Website/Pages/PersonEditPage.razor.cs @@ -2,9 +2,9 @@ using Microsoft.AspNetCore.Components; using WatchIt.Common.Model.Media; using WatchIt.Common.Model.Persons; using WatchIt.Website.Layout; -using WatchIt.Website.Services.Utility.Authentication; -using WatchIt.Website.Services.WebAPI.Media; -using WatchIt.Website.Services.WebAPI.Persons; +using WatchIt.Website.Services.Authentication; +using WatchIt.Website.Services.Client.Media; +using WatchIt.Website.Services.Client.Persons; namespace WatchIt.Website.Pages; @@ -14,8 +14,8 @@ public partial class PersonEditPage : ComponentBase [Inject] private NavigationManager NavigationManager { get; set; } = default!; [Inject] private IAuthenticationService AuthenticationService { get; set; } = default!; - [Inject] private IPersonsWebAPIService PersonsWebAPIService { get; set; } = default!; - [Inject] private IMediaWebAPIService MediaWebAPIService { get; set; } = default!; + [Inject] private IPersonsClientService PersonsClientService { get; set; } = default!; + [Inject] private IMediaClientService MediaClientService { get; set; } = default!; #endregion @@ -66,8 +66,8 @@ public partial class PersonEditPage : ComponentBase { endTasks.AddRange( [ - PersonsWebAPIService.GetPerson(Id.Value, data => _person = data, () => NavigationManager.NavigateTo("/person/new", true)), - MediaWebAPIService.GetAllMedia(successAction: data => _media = data.ToDictionary(x => x.Id, x => x)), + PersonsClientService.GetPerson(Id.Value, data => _person = data, () => NavigationManager.NavigateTo("/person/new", true)), + MediaClientService.GetAllMedia(successAction: data => _media = data.ToDictionary(x => x.Id, x => x)), ]); } diff --git a/WatchIt.Website/WatchIt.Website/Pages/PersonEditPage.razor.css b/WatchIt.Website/WatchIt.Website/Pages/PersonEditPage.razor.css deleted file mode 100644 index e69de29..0000000 diff --git a/WatchIt.Website/WatchIt.Website/Pages/PersonPage.razor b/WatchIt.Website/WatchIt.Website/Pages/PersonPage.razor index d88eb16..c98324f 100644 --- a/WatchIt.Website/WatchIt.Website/Pages/PersonPage.razor +++ b/WatchIt.Website/WatchIt.Website/Pages/PersonPage.razor @@ -26,7 +26,7 @@ Subname="@(_person.FullName)" Description="@(_person.Description)" PosterPlaceholder="/assets/person_poster.png" - GetPosterMethod="@(action => PersonsWebAPIService.GetPersonPhoto(_person.Id, action))"/> + GetPosterMethod="@(action => PersonsClientService.GetPersonPhoto(_person.Id, action))"/>
diff --git a/WatchIt.Website/WatchIt.Website/Pages/PersonPage.razor.cs b/WatchIt.Website/WatchIt.Website/Pages/PersonPage.razor.cs index 12120a1..29307ce 100644 --- a/WatchIt.Website/WatchIt.Website/Pages/PersonPage.razor.cs +++ b/WatchIt.Website/WatchIt.Website/Pages/PersonPage.razor.cs @@ -2,7 +2,7 @@ using Microsoft.AspNetCore.Components; using WatchIt.Common.Model.Persons; using WatchIt.Website.Components.Pages.PersonPage.Panels; using WatchIt.Website.Layout; -using WatchIt.Website.Services.WebAPI.Persons; +using WatchIt.Website.Services.Client.Persons; namespace WatchIt.Website.Pages; @@ -10,7 +10,7 @@ public partial class PersonPage : ComponentBase { #region SERVICES - [Inject] private IPersonsWebAPIService PersonsWebAPIService { get; set; } = default!; + [Inject] private IPersonsClientService PersonsClientService { get; set; } = default!; #endregion @@ -53,7 +53,7 @@ public partial class PersonPage : ComponentBase // STEP 0 step1Tasks.AddRange( [ - PersonsWebAPIService.GetPerson(Id, data => _person = data) + PersonsClientService.GetPerson(Id, data => _person = data) ]); // STEP 1 @@ -62,7 +62,7 @@ public partial class PersonPage : ComponentBase { endTasks.AddRange( [ - PersonsWebAPIService.PostPersonView(Id), + PersonsClientService.PostPersonView(Id), ]); } diff --git a/WatchIt.Website/WatchIt.Website/Pages/PersonPage.razor.css b/WatchIt.Website/WatchIt.Website/Pages/PersonPage.razor.css deleted file mode 100644 index e69de29..0000000 diff --git a/WatchIt.Website/WatchIt.Website/Pages/SearchPage.razor b/WatchIt.Website/WatchIt.Website/Pages/SearchPage.razor index a88e28e..7e30b8f 100644 --- a/WatchIt.Website/WatchIt.Website/Pages/SearchPage.razor +++ b/WatchIt.Website/WatchIt.Website/Pages/SearchPage.razor @@ -28,13 +28,13 @@ AdditionalNameInfoSource="@(item => item.ReleaseDate.HasValue ? $" ({item.ReleaseDate.Value.Year})" : null)" RatingSource="@(item => item.Rating)" Query="@(new MovieQueryParameters { Title = DecodedQuery, OrderBy = "rating.count" })" - ItemDownloadingTask="@(MoviesWebAPIService.GetAllMovies)" - PictureDownloadingTask="@((id, action) => MediaWebAPIService.GetMediaPoster(id, action))" + ItemDownloadingTask="@(MoviesClientService.GetAllMovies)" + PictureDownloadingTask="@((id, action) => MediaClientService.GetMediaPoster(id, action))" PosterPlaceholder="/assets/media_poster.png" - GetGlobalRatingMethod="@((id, action) => MediaWebAPIService.GetMediaRating(id, action))" - GetUserRatingMethod="@((id, userId, successAction, notfoundAction) => MediaWebAPIService.GetMediaRatingByUser(id, userId, successAction, notfoundAction))" - PutRatingMethod="@((id, request) => MediaWebAPIService.PutMediaRating(id, request))" - DeleteRatingMethod="@(id => MediaWebAPIService.DeleteMediaRating(id))"/> + GetGlobalRatingMethod="@((id, action) => MediaClientService.GetMediaRating(id, action))" + GetUserRatingMethod="@((id, userId, successAction, notfoundAction) => MediaClientService.GetMediaRatingByUser(id, userId, successAction, notfoundAction))" + PutRatingMethod="@((id, request) => MediaClientService.PutMediaRating(id, request))" + DeleteRatingMethod="@(id => MediaClientService.DeleteMediaRating(id))"/> + GetGlobalRatingMethod="@((id, action) => MediaClientService.GetMediaRating(id, action))" + GetUserRatingMethod="@((id, userId, successAction, notfoundAction) => MediaClientService.GetMediaRatingByUser(id, userId, successAction, notfoundAction))" + PutRatingMethod="@((id, request) => MediaClientService.PutMediaRating(id, request))" + DeleteRatingMethod="@(id => MediaClientService.DeleteMediaRating(id))"/> + GetGlobalRatingMethod="@((id, action) => PersonsClientService.GetPersonGlobalRating(id, action))"/>
\ No newline at end of file diff --git a/WatchIt.Website/WatchIt.Website/Pages/SearchPage.razor.cs b/WatchIt.Website/WatchIt.Website/Pages/SearchPage.razor.cs index 029a402..baaef95 100644 --- a/WatchIt.Website/WatchIt.Website/Pages/SearchPage.razor.cs +++ b/WatchIt.Website/WatchIt.Website/Pages/SearchPage.razor.cs @@ -1,10 +1,10 @@ using System.Net; using Microsoft.AspNetCore.Components; using WatchIt.Website.Layout; -using WatchIt.Website.Services.WebAPI.Media; -using WatchIt.Website.Services.WebAPI.Movies; -using WatchIt.Website.Services.WebAPI.Persons; -using WatchIt.Website.Services.WebAPI.Series; +using WatchIt.Website.Services.Client.Media; +using WatchIt.Website.Services.Client.Movies; +using WatchIt.Website.Services.Client.Persons; +using WatchIt.Website.Services.Client.Series; namespace WatchIt.Website.Pages; @@ -12,10 +12,10 @@ public partial class SearchPage : ComponentBase { #region SERVICES - [Inject] private IMoviesWebAPIService MoviesWebAPIService { get; set; } = default!; - [Inject] private ISeriesWebAPIService SeriesWebAPIService { get; set; } = default!; - [Inject] private IMediaWebAPIService MediaWebAPIService { get; set; } = default!; - [Inject] private IPersonsWebAPIService PersonsWebAPIService { get; set; } = default!; + [Inject] private IMoviesClientService MoviesClientService { get; set; } = default!; + [Inject] private ISeriesClientService SeriesClientService { get; set; } = default!; + [Inject] private IMediaClientService MediaClientService { get; set; } = default!; + [Inject] private IPersonsClientService PersonsClientService { get; set; } = default!; #endregion diff --git a/WatchIt.Website/WatchIt.Website/Pages/SearchPage.razor.css b/WatchIt.Website/WatchIt.Website/Pages/SearchPage.razor.css deleted file mode 100644 index e69de29..0000000 diff --git a/WatchIt.Website/WatchIt.Website/Pages/UserEditPage.razor b/WatchIt.Website/WatchIt.Website/Pages/UserEditPage.razor new file mode 100644 index 0000000..64a2378 --- /dev/null +++ b/WatchIt.Website/WatchIt.Website/Pages/UserEditPage.razor @@ -0,0 +1 @@ +@page "/user/edit" \ No newline at end of file diff --git a/WatchIt.Website/WatchIt.Website/Pages/UserEditPage.razor.cs b/WatchIt.Website/WatchIt.Website/Pages/UserEditPage.razor.cs new file mode 100644 index 0000000..d5a489f --- /dev/null +++ b/WatchIt.Website/WatchIt.Website/Pages/UserEditPage.razor.cs @@ -0,0 +1,7 @@ +using Microsoft.AspNetCore.Components; + +namespace WatchIt.Website.Pages; + +public partial class UserEditPage : ComponentBase +{ +} \ No newline at end of file diff --git a/WatchIt.Website/WatchIt.Website/Pages/UserPage.razor b/WatchIt.Website/WatchIt.Website/Pages/UserPage.razor new file mode 100644 index 0000000..74f46be --- /dev/null +++ b/WatchIt.Website/WatchIt.Website/Pages/UserPage.razor @@ -0,0 +1 @@ +@page "/user/{id:long}" \ No newline at end of file diff --git a/WatchIt.Website/WatchIt.Website/Pages/UserPage.razor.cs b/WatchIt.Website/WatchIt.Website/Pages/UserPage.razor.cs new file mode 100644 index 0000000..3af1678 --- /dev/null +++ b/WatchIt.Website/WatchIt.Website/Pages/UserPage.razor.cs @@ -0,0 +1,7 @@ +using Microsoft.AspNetCore.Components; + +namespace WatchIt.Website.Pages; + +public partial class UserPage : ComponentBase +{ +} \ No newline at end of file diff --git a/WatchIt.Website/WatchIt.Website/Program.cs b/WatchIt.Website/WatchIt.Website/Program.cs index 9f05d6f..fe0c437 100644 --- a/WatchIt.Website/WatchIt.Website/Program.cs +++ b/WatchIt.Website/WatchIt.Website/Program.cs @@ -5,17 +5,17 @@ using Blazorise.Bootstrap5; using Blazorise.Icons.FontAwesome; using Microsoft.AspNetCore.Components.Authorization; using WatchIt.Common.Services.HttpClient; -using WatchIt.Website.Services.Utility.Authentication; -using WatchIt.Website.Services.Utility.Configuration; -using WatchIt.Website.Services.Utility.Tokens; -using WatchIt.Website.Services.WebAPI.Accounts; -using WatchIt.Website.Services.WebAPI.Genders; -using WatchIt.Website.Services.WebAPI.Media; -using WatchIt.Website.Services.WebAPI.Movies; -using WatchIt.Website.Services.WebAPI.Persons; -using WatchIt.Website.Services.WebAPI.Photos; -using WatchIt.Website.Services.WebAPI.Roles; -using WatchIt.Website.Services.WebAPI.Series; +using WatchIt.Website.Services.Authentication; +using WatchIt.Website.Services.Configuration; +using WatchIt.Website.Services.Tokens; +using WatchIt.Website.Services.Client.Accounts; +using WatchIt.Website.Services.Client.Genders; +using WatchIt.Website.Services.Client.Media; +using WatchIt.Website.Services.Client.Movies; +using WatchIt.Website.Services.Client.Persons; +using WatchIt.Website.Services.Client.Photos; +using WatchIt.Website.Services.Client.Roles; +using WatchIt.Website.Services.Client.Series; namespace WatchIt.Website; @@ -73,14 +73,14 @@ public static class Program builder.Services.AddScoped(); // WebAPI - builder.Services.AddScoped(); - builder.Services.AddSingleton(); - builder.Services.AddSingleton(); - builder.Services.AddSingleton(); - builder.Services.AddSingleton(); - builder.Services.AddSingleton(); - builder.Services.AddSingleton(); - builder.Services.AddSingleton(); + builder.Services.AddScoped(); + builder.Services.AddSingleton(); + builder.Services.AddSingleton(); + builder.Services.AddSingleton(); + builder.Services.AddSingleton(); + builder.Services.AddSingleton(); + builder.Services.AddSingleton(); + builder.Services.AddSingleton(); return builder; } diff --git a/WatchIt.Website/WatchIt.Website/WatchIt.Website.csproj b/WatchIt.Website/WatchIt.Website/WatchIt.Website.csproj index 9601cf7..ec831bd 100644 --- a/WatchIt.Website/WatchIt.Website/WatchIt.Website.csproj +++ b/WatchIt.Website/WatchIt.Website/WatchIt.Website.csproj @@ -16,17 +16,8 @@ - - - - - - - - - - - + + diff --git a/WatchIt.Website/WatchIt.Website/_Imports.razor b/WatchIt.Website/WatchIt.Website/_Imports.razor index e95dbc3..a1fd28e 100644 --- a/WatchIt.Website/WatchIt.Website/_Imports.razor +++ b/WatchIt.Website/WatchIt.Website/_Imports.razor @@ -12,9 +12,9 @@ @using WatchIt.Website.Components.Common.Panels @using WatchIt.Common.Model.Accounts @using WatchIt.Common.Model.Media -@using WatchIt.Website.Services.Utility.Tokens -@using WatchIt.Website.Services.Utility.Authentication -@using WatchIt.Website.Services.WebAPI.Accounts -@using WatchIt.Website.Services.WebAPI.Media +@using WatchIt.Website.Services.Tokens +@using WatchIt.Website.Services.Authentication +@using WatchIt.Website.Services.Client.Accounts +@using WatchIt.Website.Services.Client.Media @using Blazorise @using Blazorise.Bootstrap5 \ No newline at end of file diff --git a/WatchIt.sln b/WatchIt.sln index 70d247e..9af8955 100644 --- a/WatchIt.sln +++ b/WatchIt.sln @@ -52,53 +52,31 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WatchIt.WebAPI.Services.Con EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "WatchIt.Website.Services", "WatchIt.Website.Services", "{A82972D0-9A60-4B3F-AE46-9F304D79137F}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "WatchIt.Website.Services.WebAPI", "WatchIt.Website.Services.WebAPI", "{46E3711F-18BD-4004-AF53-EA4D8643D92F}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WatchIt.Website.Services.WebAPI.Accounts", "WatchIt.Website\WatchIt.Website.Services\WatchIt.Website.Services.WebAPI\WatchIt.Website.Services.WebAPI.Accounts\WatchIt.Website.Services.WebAPI.Accounts.csproj", "{68B7E892-9074-4034-8AFC-2474D7D5BE29}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WatchIt.Website.Services.WebAPI.Genres", "WatchIt.Website\WatchIt.Website.Services\WatchIt.Website.Services.WebAPI\WatchIt.Website.Services.WebAPI.Genres\WatchIt.Website.Services.WebAPI.Genres.csproj", "{A98D06A6-9C95-4449-9F4E-1D31BBE1D9B1}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WatchIt.Website.Services.WebAPI.Movies", "WatchIt.Website\WatchIt.Website.Services\WatchIt.Website.Services.WebAPI\WatchIt.Website.Services.WebAPI.Movies\WatchIt.Website.Services.WebAPI.Movies.csproj", "{539404EB-BDFD-46F8-8F21-6A231ABED9B1}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "WatchIt.Website.Services.Utility", "WatchIt.Website.Services.Utility", "{130BC8F5-82CE-4EDF-AECB-21594DD41849}" -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "WatchIt.Common.Services", "WatchIt.Common.Services", "{882A9795-4AC0-4556-9750-6582B2701EFA}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WatchIt.Common.Query", "WatchIt.Common\WatchIt.Common.Query\WatchIt.Common.Query.csproj", "{6C3AE7B4-18C5-42D3-B254-460027E50143}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WatchIt.Common.Services.HttpClient", "WatchIt.Common\WatchIt.Common.Services\WatchIt.Common.Services.HttpClient\WatchIt.Common.Services.HttpClient.csproj", "{A4A75CCA-0DEE-4F1E-9816-60674CA807FA}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WatchIt.Website.Services.Utility.Configuration", "WatchIt.Website\WatchIt.Website.Services\WatchIt.Website.Services.Utility\WatchIt.Website.Services.Utility.Configuration\WatchIt.Website.Services.Utility.Configuration.csproj", "{0DBBE7EA-05FE-481F-8814-6FA0BC9E571F}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WatchIt.Website.Services.Configuration", "WatchIt.Website\WatchIt.Website.Services\WatchIt.Website.Services.Utility\WatchIt.Website.Services.Configuration\WatchIt.Website.Services.Configuration.csproj", "{0DBBE7EA-05FE-481F-8814-6FA0BC9E571F}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WatchIt.WebAPI.Services.Controllers.Media", "WatchIt.WebAPI\WatchIt.WebAPI.Services\WatchIt.WebAPI.Services.Controllers\WatchIt.WebAPI.Services.Controllers.Media\WatchIt.WebAPI.Services.Controllers.Media.csproj", "{3156AD7B-D6EC-4EB6-AEE8-4FBAF14C18E4}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WatchIt.Website.Services.WebAPI.Media", "WatchIt.Website\WatchIt.Website.Services\WatchIt.Website.Services.WebAPI\WatchIt.Website.Services.WebAPI.Media\WatchIt.Website.Services.WebAPI.Media.csproj", "{1D64B7B5-650D-4AF3-AC33-A8D1F0999906}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WatchIt.Website.Services.WebAPI.Common", "WatchIt.Website\WatchIt.Website.Services\WatchIt.Website.Services.WebAPI\WatchIt.Website.Services.WebAPI.Common\WatchIt.Website.Services.WebAPI.Common.csproj", "{2D62ED42-489E-4888-9479-E5A50A0E7D70}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WatchIt.Website.Services.Utility.Tokens", "WatchIt.Website\WatchIt.Website.Services\WatchIt.Website.Services.Utility\WatchIt.Website.Services.Utility.Tokens\WatchIt.Website.Services.Utility.Tokens.csproj", "{77FDAFDD-E97E-4059-A935-B563B6B0D555}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WatchIt.Website.Services.Utility.Authentication", "WatchIt.Website\WatchIt.Website.Services\WatchIt.Website.Services.Utility\WatchIt.Website.Services.Utility.Authentication\WatchIt.Website.Services.Utility.Authentication.csproj", "{8720AECA-7084-429A-BA15-49B6622C1A32}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WatchIt.WebAPI.Services.Controllers.Series", "WatchIt.WebAPI\WatchIt.WebAPI.Services\WatchIt.WebAPI.Services.Controllers\WatchIt.WebAPI.Services.Controllers.Series\WatchIt.WebAPI.Services.Controllers.Series.csproj", "{F8FCEF7B-72EA-48BC-AC68-E11244B067DD}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WatchIt.Website.Services.WebAPI.Series", "WatchIt.Website\WatchIt.Website.Services\WatchIt.Website.Services.WebAPI\WatchIt.Website.Services.WebAPI.Series\WatchIt.Website.Services.WebAPI.Series.csproj", "{783C743A-85BF-4382-BFE5-7A90E3F3B8B6}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WatchIt.WebAPI.Services.Controllers.Photos", "WatchIt.WebAPI\WatchIt.WebAPI.Services\WatchIt.WebAPI.Services.Controllers\WatchIt.WebAPI.Services.Controllers.Photos\WatchIt.WebAPI.Services.Controllers.Photos.csproj", "{ABDF8471-2FAB-4930-B016-7DD3E48AE6B8}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WatchIt.Website.Services.WebAPI.Photos", "WatchIt.Website\WatchIt.Website.Services\WatchIt.Website.Services.WebAPI\WatchIt.Website.Services.WebAPI.Photos\WatchIt.Website.Services.WebAPI.Photos.csproj", "{960A833F-C195-4D1D-AD4F-D00B57067181}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WatchIt.WebAPI.Services.Controllers.Persons", "WatchIt.WebAPI\WatchIt.WebAPI.Services\WatchIt.WebAPI.Services.Controllers\WatchIt.WebAPI.Services.Controllers.Persons\WatchIt.WebAPI.Services.Controllers.Persons.csproj", "{335686F5-65B8-4D66-AAA8-C5032906451D}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WatchIt.Website.Services.WebAPI.Persons", "WatchIt.Website\WatchIt.Website.Services\WatchIt.Website.Services.WebAPI\WatchIt.Website.Services.WebAPI.Persons\WatchIt.Website.Services.WebAPI.Persons.csproj", "{83D42D72-FF67-4577-8280-2ABD5B20F985}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WatchIt.WebAPI.Services.Controllers.Genders", "WatchIt.WebAPI\WatchIt.WebAPI.Services\WatchIt.WebAPI.Services.Controllers\WatchIt.WebAPI.Services.Controllers.Genders\WatchIt.WebAPI.Services.Controllers.Genders.csproj", "{13BE36AB-2120-4F1B-815A-6F5E3F589EE8}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WatchIt.Website.Services.WebAPI.Genders", "WatchIt.Website\WatchIt.Website.Services\WatchIt.Website.Services.WebAPI\WatchIt.Website.Services.WebAPI.Genders\WatchIt.Website.Services.WebAPI.Genders.csproj", "{B74144DE-EF62-430A-AB80-5D185DD03C05}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WatchIt.WebAPI.Services.Controllers.Roles", "WatchIt.WebAPI\WatchIt.WebAPI.Services\WatchIt.WebAPI.Services.Controllers\WatchIt.WebAPI.Services.Controllers.Roles\WatchIt.WebAPI.Services.Controllers.Roles.csproj", "{847D157A-E486-4FB6-9AA3-43931A60FB5F}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WatchIt.Website.Services.WebAPI.Roles", "WatchIt.Website\WatchIt.Website.Services\WatchIt.Website.Services.WebAPI\WatchIt.Website.Services.WebAPI.Roles\WatchIt.Website.Services.WebAPI.Roles.csproj", "{3D8B7909-BAC2-42FD-8A72-D1DADDB3BC82}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WatchIt.Website.Services.Tokens", "WatchIt.Website\WatchIt.Website.Services\WatchIt.Website.Services.Tokens\WatchIt.Website.Services.Tokens.csproj", "{188CE560-A1DC-459D-BF41-1B62E5C0D7B5}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WatchIt.Website.Services.Authentication", "WatchIt.Website\WatchIt.Website.Services\WatchIt.Website.Services.Authentication\WatchIt.Website.Services.Authentication.csproj", "{B647BAB2-D261-40A0-95AF-95E8A2F00ED1}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WatchIt.Website.Services.Client", "WatchIt.Website\WatchIt.Website.Services\WatchIt.Website.Services.Client\WatchIt.Website.Services.Client.csproj", "{C9FCD231-3BC9-4453-8949-F521D2D71BCF}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -128,30 +106,19 @@ Global {46CE78A1-3EC3-4112-AAAD-26EEB8D8B194} = {4CB91BF6-87F1-4088-A943-62548CD1F9F4} {69BB6A9E-B673-42AB-A516-6B2513E21FDC} = {CEC468DB-CC49-47D3-9E3E-1CC9530C3CE7} {A82972D0-9A60-4B3F-AE46-9F304D79137F} = {4CB91BF6-87F1-4088-A943-62548CD1F9F4} - {46E3711F-18BD-4004-AF53-EA4D8643D92F} = {A82972D0-9A60-4B3F-AE46-9F304D79137F} - {68B7E892-9074-4034-8AFC-2474D7D5BE29} = {46E3711F-18BD-4004-AF53-EA4D8643D92F} - {A98D06A6-9C95-4449-9F4E-1D31BBE1D9B1} = {46E3711F-18BD-4004-AF53-EA4D8643D92F} - {539404EB-BDFD-46F8-8F21-6A231ABED9B1} = {46E3711F-18BD-4004-AF53-EA4D8643D92F} - {130BC8F5-82CE-4EDF-AECB-21594DD41849} = {A82972D0-9A60-4B3F-AE46-9F304D79137F} {882A9795-4AC0-4556-9750-6582B2701EFA} = {E98C42C1-26E5-4939-8C22-72C253DE874B} {6C3AE7B4-18C5-42D3-B254-460027E50143} = {E98C42C1-26E5-4939-8C22-72C253DE874B} {A4A75CCA-0DEE-4F1E-9816-60674CA807FA} = {882A9795-4AC0-4556-9750-6582B2701EFA} - {0DBBE7EA-05FE-481F-8814-6FA0BC9E571F} = {130BC8F5-82CE-4EDF-AECB-21594DD41849} {3156AD7B-D6EC-4EB6-AEE8-4FBAF14C18E4} = {CEC468DB-CC49-47D3-9E3E-1CC9530C3CE7} - {1D64B7B5-650D-4AF3-AC33-A8D1F0999906} = {46E3711F-18BD-4004-AF53-EA4D8643D92F} - {2D62ED42-489E-4888-9479-E5A50A0E7D70} = {46E3711F-18BD-4004-AF53-EA4D8643D92F} - {77FDAFDD-E97E-4059-A935-B563B6B0D555} = {130BC8F5-82CE-4EDF-AECB-21594DD41849} - {8720AECA-7084-429A-BA15-49B6622C1A32} = {130BC8F5-82CE-4EDF-AECB-21594DD41849} {F8FCEF7B-72EA-48BC-AC68-E11244B067DD} = {CEC468DB-CC49-47D3-9E3E-1CC9530C3CE7} - {783C743A-85BF-4382-BFE5-7A90E3F3B8B6} = {46E3711F-18BD-4004-AF53-EA4D8643D92F} {ABDF8471-2FAB-4930-B016-7DD3E48AE6B8} = {CEC468DB-CC49-47D3-9E3E-1CC9530C3CE7} - {960A833F-C195-4D1D-AD4F-D00B57067181} = {46E3711F-18BD-4004-AF53-EA4D8643D92F} {335686F5-65B8-4D66-AAA8-C5032906451D} = {CEC468DB-CC49-47D3-9E3E-1CC9530C3CE7} - {83D42D72-FF67-4577-8280-2ABD5B20F985} = {46E3711F-18BD-4004-AF53-EA4D8643D92F} {13BE36AB-2120-4F1B-815A-6F5E3F589EE8} = {CEC468DB-CC49-47D3-9E3E-1CC9530C3CE7} - {B74144DE-EF62-430A-AB80-5D185DD03C05} = {46E3711F-18BD-4004-AF53-EA4D8643D92F} {847D157A-E486-4FB6-9AA3-43931A60FB5F} = {CEC468DB-CC49-47D3-9E3E-1CC9530C3CE7} - {3D8B7909-BAC2-42FD-8A72-D1DADDB3BC82} = {46E3711F-18BD-4004-AF53-EA4D8643D92F} + {188CE560-A1DC-459D-BF41-1B62E5C0D7B5} = {A82972D0-9A60-4B3F-AE46-9F304D79137F} + {B647BAB2-D261-40A0-95AF-95E8A2F00ED1} = {A82972D0-9A60-4B3F-AE46-9F304D79137F} + {0DBBE7EA-05FE-481F-8814-6FA0BC9E571F} = {A82972D0-9A60-4B3F-AE46-9F304D79137F} + {C9FCD231-3BC9-4453-8949-F521D2D71BCF} = {A82972D0-9A60-4B3F-AE46-9F304D79137F} EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {23383776-1F27-4B5D-8C7C-57BFF75FA473}.Debug|Any CPU.ActiveCfg = Debug|Any CPU @@ -222,18 +189,6 @@ Global {69BB6A9E-B673-42AB-A516-6B2513E21FDC}.Debug|Any CPU.Build.0 = Debug|Any CPU {69BB6A9E-B673-42AB-A516-6B2513E21FDC}.Release|Any CPU.ActiveCfg = Release|Any CPU {69BB6A9E-B673-42AB-A516-6B2513E21FDC}.Release|Any CPU.Build.0 = Release|Any CPU - {68B7E892-9074-4034-8AFC-2474D7D5BE29}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {68B7E892-9074-4034-8AFC-2474D7D5BE29}.Debug|Any CPU.Build.0 = Debug|Any CPU - {68B7E892-9074-4034-8AFC-2474D7D5BE29}.Release|Any CPU.ActiveCfg = Release|Any CPU - {68B7E892-9074-4034-8AFC-2474D7D5BE29}.Release|Any CPU.Build.0 = Release|Any CPU - {A98D06A6-9C95-4449-9F4E-1D31BBE1D9B1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {A98D06A6-9C95-4449-9F4E-1D31BBE1D9B1}.Debug|Any CPU.Build.0 = Debug|Any CPU - {A98D06A6-9C95-4449-9F4E-1D31BBE1D9B1}.Release|Any CPU.ActiveCfg = Release|Any CPU - {A98D06A6-9C95-4449-9F4E-1D31BBE1D9B1}.Release|Any CPU.Build.0 = Release|Any CPU - {539404EB-BDFD-46F8-8F21-6A231ABED9B1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {539404EB-BDFD-46F8-8F21-6A231ABED9B1}.Debug|Any CPU.Build.0 = Debug|Any CPU - {539404EB-BDFD-46F8-8F21-6A231ABED9B1}.Release|Any CPU.ActiveCfg = Release|Any CPU - {539404EB-BDFD-46F8-8F21-6A231ABED9B1}.Release|Any CPU.Build.0 = Release|Any CPU {6C3AE7B4-18C5-42D3-B254-460027E50143}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {6C3AE7B4-18C5-42D3-B254-460027E50143}.Debug|Any CPU.Build.0 = Debug|Any CPU {6C3AE7B4-18C5-42D3-B254-460027E50143}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -250,61 +205,37 @@ Global {3156AD7B-D6EC-4EB6-AEE8-4FBAF14C18E4}.Debug|Any CPU.Build.0 = Debug|Any CPU {3156AD7B-D6EC-4EB6-AEE8-4FBAF14C18E4}.Release|Any CPU.ActiveCfg = Release|Any CPU {3156AD7B-D6EC-4EB6-AEE8-4FBAF14C18E4}.Release|Any CPU.Build.0 = Release|Any CPU - {1D64B7B5-650D-4AF3-AC33-A8D1F0999906}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {1D64B7B5-650D-4AF3-AC33-A8D1F0999906}.Debug|Any CPU.Build.0 = Debug|Any CPU - {1D64B7B5-650D-4AF3-AC33-A8D1F0999906}.Release|Any CPU.ActiveCfg = Release|Any CPU - {1D64B7B5-650D-4AF3-AC33-A8D1F0999906}.Release|Any CPU.Build.0 = Release|Any CPU - {2D62ED42-489E-4888-9479-E5A50A0E7D70}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {2D62ED42-489E-4888-9479-E5A50A0E7D70}.Debug|Any CPU.Build.0 = Debug|Any CPU - {2D62ED42-489E-4888-9479-E5A50A0E7D70}.Release|Any CPU.ActiveCfg = Release|Any CPU - {2D62ED42-489E-4888-9479-E5A50A0E7D70}.Release|Any CPU.Build.0 = Release|Any CPU - {77FDAFDD-E97E-4059-A935-B563B6B0D555}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {77FDAFDD-E97E-4059-A935-B563B6B0D555}.Debug|Any CPU.Build.0 = Debug|Any CPU - {77FDAFDD-E97E-4059-A935-B563B6B0D555}.Release|Any CPU.ActiveCfg = Release|Any CPU - {77FDAFDD-E97E-4059-A935-B563B6B0D555}.Release|Any CPU.Build.0 = Release|Any CPU - {8720AECA-7084-429A-BA15-49B6622C1A32}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {8720AECA-7084-429A-BA15-49B6622C1A32}.Debug|Any CPU.Build.0 = Debug|Any CPU - {8720AECA-7084-429A-BA15-49B6622C1A32}.Release|Any CPU.ActiveCfg = Release|Any CPU - {8720AECA-7084-429A-BA15-49B6622C1A32}.Release|Any CPU.Build.0 = Release|Any CPU {F8FCEF7B-72EA-48BC-AC68-E11244B067DD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {F8FCEF7B-72EA-48BC-AC68-E11244B067DD}.Debug|Any CPU.Build.0 = Debug|Any CPU {F8FCEF7B-72EA-48BC-AC68-E11244B067DD}.Release|Any CPU.ActiveCfg = Release|Any CPU {F8FCEF7B-72EA-48BC-AC68-E11244B067DD}.Release|Any CPU.Build.0 = Release|Any CPU - {783C743A-85BF-4382-BFE5-7A90E3F3B8B6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {783C743A-85BF-4382-BFE5-7A90E3F3B8B6}.Debug|Any CPU.Build.0 = Debug|Any CPU - {783C743A-85BF-4382-BFE5-7A90E3F3B8B6}.Release|Any CPU.ActiveCfg = Release|Any CPU - {783C743A-85BF-4382-BFE5-7A90E3F3B8B6}.Release|Any CPU.Build.0 = Release|Any CPU {ABDF8471-2FAB-4930-B016-7DD3E48AE6B8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {ABDF8471-2FAB-4930-B016-7DD3E48AE6B8}.Debug|Any CPU.Build.0 = Debug|Any CPU {ABDF8471-2FAB-4930-B016-7DD3E48AE6B8}.Release|Any CPU.ActiveCfg = Release|Any CPU {ABDF8471-2FAB-4930-B016-7DD3E48AE6B8}.Release|Any CPU.Build.0 = Release|Any CPU - {960A833F-C195-4D1D-AD4F-D00B57067181}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {960A833F-C195-4D1D-AD4F-D00B57067181}.Debug|Any CPU.Build.0 = Debug|Any CPU - {960A833F-C195-4D1D-AD4F-D00B57067181}.Release|Any CPU.ActiveCfg = Release|Any CPU - {960A833F-C195-4D1D-AD4F-D00B57067181}.Release|Any CPU.Build.0 = Release|Any CPU {335686F5-65B8-4D66-AAA8-C5032906451D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {335686F5-65B8-4D66-AAA8-C5032906451D}.Debug|Any CPU.Build.0 = Debug|Any CPU {335686F5-65B8-4D66-AAA8-C5032906451D}.Release|Any CPU.ActiveCfg = Release|Any CPU {335686F5-65B8-4D66-AAA8-C5032906451D}.Release|Any CPU.Build.0 = Release|Any CPU - {83D42D72-FF67-4577-8280-2ABD5B20F985}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {83D42D72-FF67-4577-8280-2ABD5B20F985}.Debug|Any CPU.Build.0 = Debug|Any CPU - {83D42D72-FF67-4577-8280-2ABD5B20F985}.Release|Any CPU.ActiveCfg = Release|Any CPU - {83D42D72-FF67-4577-8280-2ABD5B20F985}.Release|Any CPU.Build.0 = Release|Any CPU {13BE36AB-2120-4F1B-815A-6F5E3F589EE8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {13BE36AB-2120-4F1B-815A-6F5E3F589EE8}.Debug|Any CPU.Build.0 = Debug|Any CPU {13BE36AB-2120-4F1B-815A-6F5E3F589EE8}.Release|Any CPU.ActiveCfg = Release|Any CPU {13BE36AB-2120-4F1B-815A-6F5E3F589EE8}.Release|Any CPU.Build.0 = Release|Any CPU - {B74144DE-EF62-430A-AB80-5D185DD03C05}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B74144DE-EF62-430A-AB80-5D185DD03C05}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B74144DE-EF62-430A-AB80-5D185DD03C05}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B74144DE-EF62-430A-AB80-5D185DD03C05}.Release|Any CPU.Build.0 = Release|Any CPU {847D157A-E486-4FB6-9AA3-43931A60FB5F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {847D157A-E486-4FB6-9AA3-43931A60FB5F}.Debug|Any CPU.Build.0 = Debug|Any CPU {847D157A-E486-4FB6-9AA3-43931A60FB5F}.Release|Any CPU.ActiveCfg = Release|Any CPU {847D157A-E486-4FB6-9AA3-43931A60FB5F}.Release|Any CPU.Build.0 = Release|Any CPU - {3D8B7909-BAC2-42FD-8A72-D1DADDB3BC82}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {3D8B7909-BAC2-42FD-8A72-D1DADDB3BC82}.Debug|Any CPU.Build.0 = Debug|Any CPU - {3D8B7909-BAC2-42FD-8A72-D1DADDB3BC82}.Release|Any CPU.ActiveCfg = Release|Any CPU - {3D8B7909-BAC2-42FD-8A72-D1DADDB3BC82}.Release|Any CPU.Build.0 = Release|Any CPU + {188CE560-A1DC-459D-BF41-1B62E5C0D7B5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {188CE560-A1DC-459D-BF41-1B62E5C0D7B5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {188CE560-A1DC-459D-BF41-1B62E5C0D7B5}.Release|Any CPU.ActiveCfg = Release|Any CPU + {188CE560-A1DC-459D-BF41-1B62E5C0D7B5}.Release|Any CPU.Build.0 = Release|Any CPU + {B647BAB2-D261-40A0-95AF-95E8A2F00ED1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B647BAB2-D261-40A0-95AF-95E8A2F00ED1}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B647BAB2-D261-40A0-95AF-95E8A2F00ED1}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B647BAB2-D261-40A0-95AF-95E8A2F00ED1}.Release|Any CPU.Build.0 = Release|Any CPU + {C9FCD231-3BC9-4453-8949-F521D2D71BCF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C9FCD231-3BC9-4453-8949-F521D2D71BCF}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C9FCD231-3BC9-4453-8949-F521D2D71BCF}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C9FCD231-3BC9-4453-8949-F521D2D71BCF}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection EndGlobal From 017b3ac1856dfa9d421088187005a905e758d047 Mon Sep 17 00:00:00 2001 From: Mateusz Skoczek Date: Mon, 28 Oct 2024 00:35:32 +0100 Subject: [PATCH 04/20] UserPage created --- .../Accounts/AccountResponse.cs | 3 + .../WatchIt.Website.Services.Client.csproj | 2 +- .../ConfigurationService.cs | 0 .../IConfigurationService.cs | 0 .../Model/Accounts.cs | 0 .../Model/ConfigurationData.cs | 0 .../Model/Endpoints.cs | 0 .../Model/Genders.cs | 0 .../Model/Genres.cs | 0 .../Model/LogLevel.cs | 0 .../Model/Logging.cs | 0 .../Model/Media.cs | 0 .../Model/Movies.cs | 0 .../Model/Persons.cs | 0 .../Model/Photos.cs | 0 .../Model/Roles.cs | 0 .../Model/Series.cs | 0 .../Model/StorageKeys.cs | 0 .../Model/Style.cs | 0 ...chIt.Website.Services.Configuration.csproj | 0 .../WatchIt.Website.Services.Tokens.csproj | 2 +- .../Panels/UserPageHeaderPanelComponent.razor | 0 .../UserPageHeaderPanelComponent.razor.cs | 7 ++ .../WatchIt.Website/Layout/MainLayout.razor | 2 + .../WatchIt.Website/Pages/UserPage.razor | 50 +++++++++++- .../WatchIt.Website/Pages/UserPage.razor.cs | 80 +++++++++++++++++++ .../WatchIt.Website/WatchIt.Website.csproj | 2 +- WatchIt.sln | 2 +- 28 files changed, 145 insertions(+), 5 deletions(-) rename WatchIt.Website/WatchIt.Website.Services/{WatchIt.Website.Services.Utility => }/WatchIt.Website.Services.Configuration/ConfigurationService.cs (100%) rename WatchIt.Website/WatchIt.Website.Services/{WatchIt.Website.Services.Utility => }/WatchIt.Website.Services.Configuration/IConfigurationService.cs (100%) rename WatchIt.Website/WatchIt.Website.Services/{WatchIt.Website.Services.Utility => }/WatchIt.Website.Services.Configuration/Model/Accounts.cs (100%) rename WatchIt.Website/WatchIt.Website.Services/{WatchIt.Website.Services.Utility => }/WatchIt.Website.Services.Configuration/Model/ConfigurationData.cs (100%) rename WatchIt.Website/WatchIt.Website.Services/{WatchIt.Website.Services.Utility => }/WatchIt.Website.Services.Configuration/Model/Endpoints.cs (100%) rename WatchIt.Website/WatchIt.Website.Services/{WatchIt.Website.Services.Utility => }/WatchIt.Website.Services.Configuration/Model/Genders.cs (100%) rename WatchIt.Website/WatchIt.Website.Services/{WatchIt.Website.Services.Utility => }/WatchIt.Website.Services.Configuration/Model/Genres.cs (100%) rename WatchIt.Website/WatchIt.Website.Services/{WatchIt.Website.Services.Utility => }/WatchIt.Website.Services.Configuration/Model/LogLevel.cs (100%) rename WatchIt.Website/WatchIt.Website.Services/{WatchIt.Website.Services.Utility => }/WatchIt.Website.Services.Configuration/Model/Logging.cs (100%) rename WatchIt.Website/WatchIt.Website.Services/{WatchIt.Website.Services.Utility => }/WatchIt.Website.Services.Configuration/Model/Media.cs (100%) rename WatchIt.Website/WatchIt.Website.Services/{WatchIt.Website.Services.Utility => }/WatchIt.Website.Services.Configuration/Model/Movies.cs (100%) rename WatchIt.Website/WatchIt.Website.Services/{WatchIt.Website.Services.Utility => }/WatchIt.Website.Services.Configuration/Model/Persons.cs (100%) rename WatchIt.Website/WatchIt.Website.Services/{WatchIt.Website.Services.Utility => }/WatchIt.Website.Services.Configuration/Model/Photos.cs (100%) rename WatchIt.Website/WatchIt.Website.Services/{WatchIt.Website.Services.Utility => }/WatchIt.Website.Services.Configuration/Model/Roles.cs (100%) rename WatchIt.Website/WatchIt.Website.Services/{WatchIt.Website.Services.Utility => }/WatchIt.Website.Services.Configuration/Model/Series.cs (100%) rename WatchIt.Website/WatchIt.Website.Services/{WatchIt.Website.Services.Utility => }/WatchIt.Website.Services.Configuration/Model/StorageKeys.cs (100%) rename WatchIt.Website/WatchIt.Website.Services/{WatchIt.Website.Services.Utility => }/WatchIt.Website.Services.Configuration/Model/Style.cs (100%) rename WatchIt.Website/WatchIt.Website.Services/{WatchIt.Website.Services.Utility => }/WatchIt.Website.Services.Configuration/WatchIt.Website.Services.Configuration.csproj (100%) create mode 100644 WatchIt.Website/WatchIt.Website/Components/Pages/UserPage/Panels/UserPageHeaderPanelComponent.razor create mode 100644 WatchIt.Website/WatchIt.Website/Components/Pages/UserPage/Panels/UserPageHeaderPanelComponent.razor.cs diff --git a/WatchIt.Common/WatchIt.Common.Model/Accounts/AccountResponse.cs b/WatchIt.Common/WatchIt.Common.Model/Accounts/AccountResponse.cs index 1595aa8..a87d407 100644 --- a/WatchIt.Common/WatchIt.Common.Model/Accounts/AccountResponse.cs +++ b/WatchIt.Common/WatchIt.Common.Model/Accounts/AccountResponse.cs @@ -19,6 +19,9 @@ public class AccountResponse : Account #region CONSTRUCTORS + + [JsonConstructor] + public AccountResponse() {} [SetsRequiredMembers] public AccountResponse(Database.Model.Account.Account account) diff --git a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/WatchIt.Website.Services.Client.csproj b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/WatchIt.Website.Services.Client.csproj index 2c834c9..97f494d 100644 --- a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/WatchIt.Website.Services.Client.csproj +++ b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/WatchIt.Website.Services.Client.csproj @@ -10,7 +10,7 @@ - + diff --git a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Configuration/ConfigurationService.cs b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Configuration/ConfigurationService.cs similarity index 100% rename from WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Configuration/ConfigurationService.cs rename to WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Configuration/ConfigurationService.cs diff --git a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Configuration/IConfigurationService.cs b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Configuration/IConfigurationService.cs similarity index 100% rename from WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Configuration/IConfigurationService.cs rename to WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Configuration/IConfigurationService.cs diff --git a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Configuration/Model/Accounts.cs b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Configuration/Model/Accounts.cs similarity index 100% rename from WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Configuration/Model/Accounts.cs rename to WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Configuration/Model/Accounts.cs diff --git a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Configuration/Model/ConfigurationData.cs b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Configuration/Model/ConfigurationData.cs similarity index 100% rename from WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Configuration/Model/ConfigurationData.cs rename to WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Configuration/Model/ConfigurationData.cs diff --git a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Configuration/Model/Endpoints.cs b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Configuration/Model/Endpoints.cs similarity index 100% rename from WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Configuration/Model/Endpoints.cs rename to WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Configuration/Model/Endpoints.cs diff --git a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Configuration/Model/Genders.cs b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Configuration/Model/Genders.cs similarity index 100% rename from WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Configuration/Model/Genders.cs rename to WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Configuration/Model/Genders.cs diff --git a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Configuration/Model/Genres.cs b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Configuration/Model/Genres.cs similarity index 100% rename from WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Configuration/Model/Genres.cs rename to WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Configuration/Model/Genres.cs diff --git a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Configuration/Model/LogLevel.cs b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Configuration/Model/LogLevel.cs similarity index 100% rename from WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Configuration/Model/LogLevel.cs rename to WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Configuration/Model/LogLevel.cs diff --git a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Configuration/Model/Logging.cs b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Configuration/Model/Logging.cs similarity index 100% rename from WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Configuration/Model/Logging.cs rename to WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Configuration/Model/Logging.cs diff --git a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Configuration/Model/Media.cs b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Configuration/Model/Media.cs similarity index 100% rename from WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Configuration/Model/Media.cs rename to WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Configuration/Model/Media.cs diff --git a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Configuration/Model/Movies.cs b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Configuration/Model/Movies.cs similarity index 100% rename from WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Configuration/Model/Movies.cs rename to WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Configuration/Model/Movies.cs diff --git a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Configuration/Model/Persons.cs b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Configuration/Model/Persons.cs similarity index 100% rename from WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Configuration/Model/Persons.cs rename to WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Configuration/Model/Persons.cs diff --git a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Configuration/Model/Photos.cs b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Configuration/Model/Photos.cs similarity index 100% rename from WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Configuration/Model/Photos.cs rename to WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Configuration/Model/Photos.cs diff --git a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Configuration/Model/Roles.cs b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Configuration/Model/Roles.cs similarity index 100% rename from WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Configuration/Model/Roles.cs rename to WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Configuration/Model/Roles.cs diff --git a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Configuration/Model/Series.cs b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Configuration/Model/Series.cs similarity index 100% rename from WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Configuration/Model/Series.cs rename to WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Configuration/Model/Series.cs diff --git a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Configuration/Model/StorageKeys.cs b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Configuration/Model/StorageKeys.cs similarity index 100% rename from WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Configuration/Model/StorageKeys.cs rename to WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Configuration/Model/StorageKeys.cs diff --git a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Configuration/Model/Style.cs b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Configuration/Model/Style.cs similarity index 100% rename from WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Configuration/Model/Style.cs rename to WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Configuration/Model/Style.cs diff --git a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Configuration/WatchIt.Website.Services.Configuration.csproj b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Configuration/WatchIt.Website.Services.Configuration.csproj similarity index 100% rename from WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Configuration/WatchIt.Website.Services.Configuration.csproj rename to WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Configuration/WatchIt.Website.Services.Configuration.csproj diff --git a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Tokens/WatchIt.Website.Services.Tokens.csproj b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Tokens/WatchIt.Website.Services.Tokens.csproj index f278ad0..c93f753 100644 --- a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Tokens/WatchIt.Website.Services.Tokens.csproj +++ b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Tokens/WatchIt.Website.Services.Tokens.csproj @@ -8,7 +8,7 @@ - + diff --git a/WatchIt.Website/WatchIt.Website/Components/Pages/UserPage/Panels/UserPageHeaderPanelComponent.razor b/WatchIt.Website/WatchIt.Website/Components/Pages/UserPage/Panels/UserPageHeaderPanelComponent.razor new file mode 100644 index 0000000..e69de29 diff --git a/WatchIt.Website/WatchIt.Website/Components/Pages/UserPage/Panels/UserPageHeaderPanelComponent.razor.cs b/WatchIt.Website/WatchIt.Website/Components/Pages/UserPage/Panels/UserPageHeaderPanelComponent.razor.cs new file mode 100644 index 0000000..6df479a --- /dev/null +++ b/WatchIt.Website/WatchIt.Website/Components/Pages/UserPage/Panels/UserPageHeaderPanelComponent.razor.cs @@ -0,0 +1,7 @@ +using Microsoft.AspNetCore.Components; + +namespace WatchIt.Website.Components.Pages.UserPage.Panels; + +public partial class UserPageHeaderPanelComponent : ComponentBase +{ +} \ No newline at end of file diff --git a/WatchIt.Website/WatchIt.Website/Layout/MainLayout.razor b/WatchIt.Website/WatchIt.Website/Layout/MainLayout.razor index deb1be0..c9b5833 100644 --- a/WatchIt.Website/WatchIt.Website/Layout/MainLayout.razor +++ b/WatchIt.Website/WatchIt.Website/Layout/MainLayout.razor @@ -61,8 +61,10 @@ + Your profile @if (_user.IsAdmin) { + Administrator panel } diff --git a/WatchIt.Website/WatchIt.Website/Pages/UserPage.razor b/WatchIt.Website/WatchIt.Website/Pages/UserPage.razor index 74f46be..1bbe594 100644 --- a/WatchIt.Website/WatchIt.Website/Pages/UserPage.razor +++ b/WatchIt.Website/WatchIt.Website/Pages/UserPage.razor @@ -1 +1,49 @@ -@page "/user/{id:long}" \ No newline at end of file +@using System.Text +@using WatchIt.Website.Components.Pages.UserPage.Panels + +@page "/user/{id:long?}" + +@{ + StringBuilder sb = new StringBuilder(" - WatchIt"); + + if (!_loaded) sb.Insert(0, "Loading..."); + else if (_accountData is null) sb.Insert(0, "Error"); + else + { + if (_owner) sb.Insert(0, "Your profile"); + else sb.Insert(0, $"\"{_accountData.Username}\" profile"); + } + + @(sb.ToString()) +} + + + +
+ @if (!_loaded) + { +
+
+
+ +
+
+
+ } + else if (_accountData is null) + { +
+
+ +
+
+ } + else + { +
+
+ +
+
+ } +
\ No newline at end of file diff --git a/WatchIt.Website/WatchIt.Website/Pages/UserPage.razor.cs b/WatchIt.Website/WatchIt.Website/Pages/UserPage.razor.cs index 3af1678..7685fa6 100644 --- a/WatchIt.Website/WatchIt.Website/Pages/UserPage.razor.cs +++ b/WatchIt.Website/WatchIt.Website/Pages/UserPage.razor.cs @@ -1,7 +1,87 @@ using Microsoft.AspNetCore.Components; +using WatchIt.Common.Model.Accounts; +using WatchIt.Website.Layout; +using WatchIt.Website.Services.Authentication; +using WatchIt.Website.Services.Client.Accounts; namespace WatchIt.Website.Pages; public partial class UserPage : ComponentBase { + #region SERVICES + + [Inject] private NavigationManager NavigationManager { get; set; } = default!; + [Inject] private IAuthenticationService AuthenticationService { get; set; } = default!; + [Inject] private IAccountsClientService AccountsClientService { get; set; } = default!; + + #endregion + + + + #region PARAMETERS + + [Parameter] public long? Id { get; set; } + + [CascadingParameter] public MainLayout Layout { get; set; } = default!; + + #endregion + + + + #region FIELDS + + private bool _loaded; + private bool _redirection; + private bool _owner; + private AccountResponse? _accountData; + + #endregion + + + + #region PRIVATE METHODS + + protected override async Task OnAfterRenderAsync(bool firstRender) + { + if (firstRender) + { + List endTasks = new List(); + + // INIT + Layout.BackgroundPhoto = null; + + // STEP 0 + endTasks.AddRange( + [ + GetUserData() + ]); + + // END + await Task.WhenAll(endTasks); + + _loaded = !_redirection; + StateHasChanged(); + } + } + + private async Task GetUserData() + { + User? user = await AuthenticationService.GetUserAsync(); + if (!Id.HasValue) + { + if (user is null) + { + NavigationManager.NavigateTo("/auth"); + _redirection = true; + return; + } + Id = user.Id; + } + + await AccountsClientService.GetAccountInfoById(Id.Value, data => _accountData = data); + _owner = Id.Value == user?.Id; + } + + + #endregion } \ No newline at end of file diff --git a/WatchIt.Website/WatchIt.Website/WatchIt.Website.csproj b/WatchIt.Website/WatchIt.Website/WatchIt.Website.csproj index ec831bd..d473aa5 100644 --- a/WatchIt.Website/WatchIt.Website/WatchIt.Website.csproj +++ b/WatchIt.Website/WatchIt.Website/WatchIt.Website.csproj @@ -17,7 +17,7 @@ - + diff --git a/WatchIt.sln b/WatchIt.sln index 9af8955..38b4a56 100644 --- a/WatchIt.sln +++ b/WatchIt.sln @@ -58,7 +58,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WatchIt.Common.Query", "Wat EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WatchIt.Common.Services.HttpClient", "WatchIt.Common\WatchIt.Common.Services\WatchIt.Common.Services.HttpClient\WatchIt.Common.Services.HttpClient.csproj", "{A4A75CCA-0DEE-4F1E-9816-60674CA807FA}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WatchIt.Website.Services.Configuration", "WatchIt.Website\WatchIt.Website.Services\WatchIt.Website.Services.Utility\WatchIt.Website.Services.Configuration\WatchIt.Website.Services.Configuration.csproj", "{0DBBE7EA-05FE-481F-8814-6FA0BC9E571F}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WatchIt.Website.Services.Configuration", "WatchIt.Website\WatchIt.Website.Services\WatchIt.Website.Services.Configuration\WatchIt.Website.Services.Configuration.csproj", "{0DBBE7EA-05FE-481F-8814-6FA0BC9E571F}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WatchIt.WebAPI.Services.Controllers.Media", "WatchIt.WebAPI\WatchIt.WebAPI.Services\WatchIt.WebAPI.Services.Controllers\WatchIt.WebAPI.Services.Controllers.Media\WatchIt.WebAPI.Services.Controllers.Media.csproj", "{3156AD7B-D6EC-4EB6-AEE8-4FBAF14C18E4}" EndProject From 2f6eb335180b8be4be5facfdcba1622b75843725 Mon Sep 17 00:00:00 2001 From: Mateusz Skoczek Date: Wed, 30 Oct 2024 23:28:47 +0100 Subject: [PATCH 05/20] add header in profile page --- .../Accounts/AccountResponse.cs | 12 ++++ .../AccountsControllerService.cs | 6 ++ WatchIt.Website/WatchIt.Website/App.razor | 2 +- .../Panels/ItemPageHeaderPanelComponent.razor | 2 +- .../ItemPageHeaderPanelComponent.razor.css | 4 -- .../AccountPictureComponent.razor | 1 + .../AccountPictureComponent.razor.cs | 58 +++++++++++++++++++ .../DatabasePageComponent.razor.cs | 1 - .../Panels/UserPageHeaderPanelComponent.razor | 30 ++++++++++ .../UserPageHeaderPanelComponent.razor.cs | 50 ++++++++++++++++ .../UserPageHeaderPanelComponent.razor.css | 9 +++ .../WatchIt.Website/Layout/MainLayout.razor | 6 +- .../Layout/MainLayout.razor.cs | 18 +----- .../WatchIt.Website/Pages/MediaPage.razor | 2 +- .../WatchIt.Website/Pages/PersonPage.razor | 2 +- .../WatchIt.Website/Pages/UserPage.razor | 37 +++++++++++- .../WatchIt.Website/wwwroot/css/gaps.css | 4 ++ 17 files changed, 213 insertions(+), 31 deletions(-) create mode 100644 WatchIt.Website/WatchIt.Website/Components/Common/Subcomponents/AccountPictureComponent.razor create mode 100644 WatchIt.Website/WatchIt.Website/Components/Common/Subcomponents/AccountPictureComponent.razor.cs create mode 100644 WatchIt.Website/WatchIt.Website/Components/Pages/UserPage/Panels/UserPageHeaderPanelComponent.razor.css diff --git a/WatchIt.Common/WatchIt.Common.Model/Accounts/AccountResponse.cs b/WatchIt.Common/WatchIt.Common.Model/Accounts/AccountResponse.cs index a87d407..fb3bc77 100644 --- a/WatchIt.Common/WatchIt.Common.Model/Accounts/AccountResponse.cs +++ b/WatchIt.Common/WatchIt.Common.Model/Accounts/AccountResponse.cs @@ -14,6 +14,15 @@ public class AccountResponse : Account [JsonPropertyName("gender")] public GenderResponse? Gender { get; set; } + [JsonPropertyName("last_active")] + public DateTime LastActive { get; set; } + + [JsonPropertyName("creation_date")] + public DateTime CreationDate { get; set; } + + [JsonPropertyName("is_admin")] + public bool IsAdmin { get; set; } + #endregion @@ -31,6 +40,9 @@ public class AccountResponse : Account Email = account.Email; Description = account.Description; Gender = account.Gender is not null ? new GenderResponse(account.Gender) : null; + LastActive = account.LastActive; + CreationDate = account.CreationDate; + IsAdmin = account.IsAdmin; } #endregion diff --git a/WatchIt.WebAPI/WatchIt.WebAPI.Services/WatchIt.WebAPI.Services.Controllers/WatchIt.WebAPI.Services.Controllers.Accounts/AccountsControllerService.cs b/WatchIt.WebAPI/WatchIt.WebAPI.Services/WatchIt.WebAPI.Services.Controllers/WatchIt.WebAPI.Services.Controllers.Accounts/AccountsControllerService.cs index df37957..af69597 100644 --- a/WatchIt.WebAPI/WatchIt.WebAPI.Services/WatchIt.WebAPI.Services.Controllers/WatchIt.WebAPI.Services.Controllers.Accounts/AccountsControllerService.cs +++ b/WatchIt.WebAPI/WatchIt.WebAPI.Services/WatchIt.WebAPI.Services.Controllers/WatchIt.WebAPI.Services.Controllers.Accounts/AccountsControllerService.cs @@ -62,6 +62,9 @@ public class AccountsControllerService( RefreshToken = await refreshTokenTask, }; + account.LastActive = DateTime.UtcNow; + await database.SaveChangesAsync(); + logger.LogInformation($"Account with ID {account.Id} was authenticated"); return RequestResult.Ok(response); } @@ -91,6 +94,9 @@ public class AccountsControllerService( string accessToken = await tokensService.CreateAccessTokenAsync(token.Account); + token.Account.LastActive = DateTime.UtcNow; + await database.SaveChangesAsync(); + logger.LogInformation($"Account with ID {token.AccountId} was authenticated by token refreshing"); return RequestResult.Ok(new AuthenticateResponse { diff --git a/WatchIt.Website/WatchIt.Website/App.razor b/WatchIt.Website/WatchIt.Website/App.razor index e5cba46..502723d 100644 --- a/WatchIt.Website/WatchIt.Website/App.razor +++ b/WatchIt.Website/WatchIt.Website/App.razor @@ -13,7 +13,7 @@ - + diff --git a/WatchIt.Website/WatchIt.Website/Components/Common/Panels/ItemPageHeaderPanelComponent.razor b/WatchIt.Website/WatchIt.Website/Components/Common/Panels/ItemPageHeaderPanelComponent.razor index 689936a..12bbc20 100644 --- a/WatchIt.Website/WatchIt.Website/Components/Common/Panels/ItemPageHeaderPanelComponent.razor +++ b/WatchIt.Website/WatchIt.Website/Components/Common/Panels/ItemPageHeaderPanelComponent.razor @@ -1,4 +1,4 @@ -
+
diff --git a/WatchIt.Website/WatchIt.Website/Components/Common/Panels/ItemPageHeaderPanelComponent.razor.css b/WatchIt.Website/WatchIt.Website/Components/Common/Panels/ItemPageHeaderPanelComponent.razor.css index 8d33a8c..5baade5 100644 --- a/WatchIt.Website/WatchIt.Website/Components/Common/Panels/ItemPageHeaderPanelComponent.razor.css +++ b/WatchIt.Website/WatchIt.Website/Components/Common/Panels/ItemPageHeaderPanelComponent.razor.css @@ -1,9 +1,5 @@ /* CLASSES */ -.mt-grid { - margin-top: 9rem !important; -} - .title-shadow { text-shadow: 2px 2px 2px #000; } diff --git a/WatchIt.Website/WatchIt.Website/Components/Common/Subcomponents/AccountPictureComponent.razor b/WatchIt.Website/WatchIt.Website/Components/Common/Subcomponents/AccountPictureComponent.razor new file mode 100644 index 0000000..ee75eef --- /dev/null +++ b/WatchIt.Website/WatchIt.Website/Components/Common/Subcomponents/AccountPictureComponent.razor @@ -0,0 +1 @@ +avatar \ No newline at end of file diff --git a/WatchIt.Website/WatchIt.Website/Components/Common/Subcomponents/AccountPictureComponent.razor.cs b/WatchIt.Website/WatchIt.Website/Components/Common/Subcomponents/AccountPictureComponent.razor.cs new file mode 100644 index 0000000..21e0402 --- /dev/null +++ b/WatchIt.Website/WatchIt.Website/Components/Common/Subcomponents/AccountPictureComponent.razor.cs @@ -0,0 +1,58 @@ +using Microsoft.AspNetCore.Components; +using WatchIt.Common.Model.Accounts; +using WatchIt.Website.Services.Client.Accounts; + +namespace WatchIt.Website.Components.Common.Subcomponents; + +public partial class AccountPictureComponent : ComponentBase +{ + #region SERVICES + + [Inject] private IAccountsClientService AccountsClientService { get; set; } = default!; + + #endregion + + + + #region PARAMETERS + + [Parameter] public required long Id { get; set; } + [Parameter] public required int Size { get; set; } + + [Parameter] public string Class { get; set; } = string.Empty; + + #endregion + + + + #region FIELDS + + private AccountProfilePictureResponse? _picture; + + #endregion + + + + #region PRIVATE METHODS + + protected override async Task OnAfterRenderAsync(bool firstRender) + { + if (firstRender) + { + List endTasks = new List(); + + // STEP 0 + endTasks.AddRange( + [ + AccountsClientService.GetAccountProfilePicture(Id, data => _picture = data) + ]); + + // END + await Task.WhenAll(endTasks); + + StateHasChanged(); + } + } + + #endregion +} \ No newline at end of file diff --git a/WatchIt.Website/WatchIt.Website/Components/Pages/DatabasePage/DatabasePageComponent.razor.cs b/WatchIt.Website/WatchIt.Website/Components/Pages/DatabasePage/DatabasePageComponent.razor.cs index 6d07ab9..85791ad 100644 --- a/WatchIt.Website/WatchIt.Website/Components/Pages/DatabasePage/DatabasePageComponent.razor.cs +++ b/WatchIt.Website/WatchIt.Website/Components/Pages/DatabasePage/DatabasePageComponent.razor.cs @@ -33,7 +33,6 @@ public partial class DatabasePageComponent : ComponentBase where [Parameter] public Func? PutRatingMethod { get; set; } [Parameter] public Func? DeleteRatingMethod { get; set; } [Parameter] public required string PosterPlaceholder { get; set; } - #endregion diff --git a/WatchIt.Website/WatchIt.Website/Components/Pages/UserPage/Panels/UserPageHeaderPanelComponent.razor b/WatchIt.Website/WatchIt.Website/Components/Pages/UserPage/Panels/UserPageHeaderPanelComponent.razor index e69de29..86e41f1 100644 --- a/WatchIt.Website/WatchIt.Website/Components/Pages/UserPage/Panels/UserPageHeaderPanelComponent.razor +++ b/WatchIt.Website/WatchIt.Website/Components/Pages/UserPage/Panels/UserPageHeaderPanelComponent.razor @@ -0,0 +1,30 @@ +
+ +
+
+
+
+

@(AccountData.Username)

+
+ @if (!string.IsNullOrWhiteSpace(AccountData.Description)) + { + + @(AccountData.Description) + + } + +
+
+
\ No newline at end of file diff --git a/WatchIt.Website/WatchIt.Website/Components/Pages/UserPage/Panels/UserPageHeaderPanelComponent.razor.cs b/WatchIt.Website/WatchIt.Website/Components/Pages/UserPage/Panels/UserPageHeaderPanelComponent.razor.cs index 6df479a..acaaa99 100644 --- a/WatchIt.Website/WatchIt.Website/Components/Pages/UserPage/Panels/UserPageHeaderPanelComponent.razor.cs +++ b/WatchIt.Website/WatchIt.Website/Components/Pages/UserPage/Panels/UserPageHeaderPanelComponent.razor.cs @@ -1,7 +1,57 @@ using Microsoft.AspNetCore.Components; +using WatchIt.Common.Model.Accounts; +using WatchIt.Website.Services.Authentication; +using WatchIt.Website.Services.Client.Accounts; namespace WatchIt.Website.Components.Pages.UserPage.Panels; public partial class UserPageHeaderPanelComponent : ComponentBase { + #region SERVICES + + [Inject] private IAuthenticationService AuthenticationService { get; set; } = default!; + [Inject] private IAccountsClientService AccountsClientService { get; set; } = default!; + + #endregion + + + + #region PARAMETERS + + [Parameter] public required AccountResponse AccountData { get; set; } + + #endregion + + + + #region FIELDS + + private AccountProfilePictureResponse? _accountProfilePicture; + + #endregion + + + + #region PRIVATE METHODS + + protected override async Task OnAfterRenderAsync(bool firstRender) + { + if (firstRender) + { + List endTasks = new List(); + + // STEP 0 + endTasks.AddRange( + [ + AccountsClientService.GetAccountProfilePicture(AccountData.Id, data => _accountProfilePicture = data), + ]); + + // END + await Task.WhenAll(endTasks); + + StateHasChanged(); + } + } + + #endregion } \ No newline at end of file diff --git a/WatchIt.Website/WatchIt.Website/Components/Pages/UserPage/Panels/UserPageHeaderPanelComponent.razor.css b/WatchIt.Website/WatchIt.Website/Components/Pages/UserPage/Panels/UserPageHeaderPanelComponent.razor.css new file mode 100644 index 0000000..1fcbf05 --- /dev/null +++ b/WatchIt.Website/WatchIt.Website/Components/Pages/UserPage/Panels/UserPageHeaderPanelComponent.razor.css @@ -0,0 +1,9 @@ +/* IDS */ + +#base { + margin-top: 120px; +} + +#space { + height: 100px; +} \ No newline at end of file diff --git a/WatchIt.Website/WatchIt.Website/Layout/MainLayout.razor b/WatchIt.Website/WatchIt.Website/Layout/MainLayout.razor index c9b5833..ac67a74 100644 --- a/WatchIt.Website/WatchIt.Website/Layout/MainLayout.razor +++ b/WatchIt.Website/WatchIt.Website/Layout/MainLayout.razor @@ -53,14 +53,14 @@ else { - - + Your profile @if (_user.IsAdmin) { diff --git a/WatchIt.Website/WatchIt.Website/Layout/MainLayout.razor.cs b/WatchIt.Website/WatchIt.Website/Layout/MainLayout.razor.cs index 1f2f80b..10a09d8 100644 --- a/WatchIt.Website/WatchIt.Website/Layout/MainLayout.razor.cs +++ b/WatchIt.Website/WatchIt.Website/Layout/MainLayout.razor.cs @@ -18,7 +18,6 @@ public partial class MainLayout : LayoutComponentBase [Inject] public NavigationManager NavigationManager { get; set; } = default!; [Inject] public ITokensService TokensService { get; set; } = default!; [Inject] public IAuthenticationService AuthenticationService { get; set; } = default!; - [Inject] public IAccountsClientService AccountsClientService { get; set; } = default!; [Inject] public IMediaClientService MediaClientService { get; set; } = default!; [Inject] public IPhotosClientService PhotosClientService { get; set; } = default!; @@ -32,7 +31,6 @@ public partial class MainLayout : LayoutComponentBase private User? _user; private PhotoResponse? _defaultBackgroundPhoto; - private AccountProfilePictureResponse? _userProfilePicture; private bool _searchbarVisible; private string _searchbarText = string.Empty; @@ -67,28 +65,14 @@ public partial class MainLayout : LayoutComponentBase if (firstRender) { List endTasks = new List(); - List step1Tasks = new List(); // STEP 0 - step1Tasks.AddRange( - [ - Task.Run(async () => _user = await AuthenticationService.GetUserAsync()) - ]); endTasks.AddRange( [ + Task.Run(async () => _user = await AuthenticationService.GetUserAsync()), PhotosClientService.GetPhotoRandomBackground(data => _defaultBackgroundPhoto = data) ]); - // STEP 1 - await Task.WhenAll(step1Tasks); - if (_user is not null) - { - endTasks.AddRange( - [ - AccountsClientService.GetAccountProfilePicture(_user.Id, data => _userProfilePicture = data) - ]); - } - // END await Task.WhenAll(endTasks); diff --git a/WatchIt.Website/WatchIt.Website/Pages/MediaPage.razor b/WatchIt.Website/WatchIt.Website/Pages/MediaPage.razor index 34d068c..87b0359 100644 --- a/WatchIt.Website/WatchIt.Website/Pages/MediaPage.razor +++ b/WatchIt.Website/WatchIt.Website/Pages/MediaPage.razor @@ -169,7 +169,7 @@ else + Class="panel panel-menu panel-background-menu justify-content-center"> Actors Creators diff --git a/WatchIt.Website/WatchIt.Website/Pages/PersonPage.razor b/WatchIt.Website/WatchIt.Website/Pages/PersonPage.razor index c98324f..bbd303c 100644 --- a/WatchIt.Website/WatchIt.Website/Pages/PersonPage.razor +++ b/WatchIt.Website/WatchIt.Website/Pages/PersonPage.razor @@ -44,7 +44,7 @@ + Class="panel panel-menu panel-background-menu justify-content-center"> Actor Creator diff --git a/WatchIt.Website/WatchIt.Website/Pages/UserPage.razor b/WatchIt.Website/WatchIt.Website/Pages/UserPage.razor index 1bbe594..430ada9 100644 --- a/WatchIt.Website/WatchIt.Website/Pages/UserPage.razor +++ b/WatchIt.Website/WatchIt.Website/Pages/UserPage.razor @@ -40,9 +40,42 @@ } else { -
+
- + +
+
+
+
+ + + Summary + Movies + TV Series + People + Roles + + + + + + + + + + + + + + + + + + +
} diff --git a/WatchIt.Website/WatchIt.Website/wwwroot/css/gaps.css b/WatchIt.Website/WatchIt.Website/wwwroot/css/gaps.css index 3b45259..a89f191 100644 --- a/WatchIt.Website/WatchIt.Website/wwwroot/css/gaps.css +++ b/WatchIt.Website/WatchIt.Website/wwwroot/css/gaps.css @@ -1,5 +1,9 @@ /* DEFAULT */ +.mt-header { + margin-top: 9rem !important; +} + .mt-default { margin-top: 1rem !important; } From 226b2b619cb403ef5e67881670803c878705f167 Mon Sep 17 00:00:00 2001 From: Mateusz Skoczek Date: Fri, 1 Nov 2024 01:03:00 +0100 Subject: [PATCH 06/20] UserPage - Lists of rated movies and tv series added --- .../Genres/GenreResponse.cs | 2 +- .../Media/MediaQueryParameters.cs | 5 + .../Media/MediaResponse.cs | 5 + .../Movies/MovieQueryParameters.cs | 5 + .../Movies/MovieRatedQueryParameters.cs | 104 ++++++++++++++ .../Movies/MovieRatedResponse.cs | 58 ++++++++ .../Movies/MovieResponse.cs | 5 + .../Series/SeriesQueryParameters.cs | 5 + .../Series/SeriesRatedQueryParameters.cs | 100 +++++++++++++ .../Series/SeriesRatedResponse.cs | 58 ++++++++ .../Series/SeriesResponse.cs | 5 + .../WatchIt.Common.Query/QueryParameters.cs | 39 ++++- .../AccountsController.cs | 21 ++- .../AccountsControllerService.cs | 32 ++++- .../IAccountsControllerService.cs | 6 +- .../Accounts/AccountsClientService.cs | 46 ++++-- .../Accounts/IAccountsClientService.cs | 7 +- .../Model/Accounts.cs | 3 +- WatchIt.Website/WatchIt.Website/App.razor | 2 +- .../ListComponent}/FilterFormComponent.cs | 4 +- .../ListComponent/ListComponent.razor} | 2 + .../ListComponent/ListComponent.razor.cs} | 6 +- .../DisplayRatingComponent.razor | 10 +- .../DisplayRatingComponent.razor.cs | 1 + .../Subcomponents/ListItemComponent.razor | 92 +++++++----- .../Subcomponents/ListItemComponent.razor.cs | 2 + .../Subcomponents/ListItemComponent.razor.css | 37 ++++- .../MoviesFilterFormComponent.razor | 2 +- .../PersonsFilterFormComponent.razor | 2 +- .../PersonsFilterFormComponent.razor.cs | 1 + .../SeriesFilterFormComponent.razor | 2 +- .../MoviesRatedFilterFormComponent.razor | 74 ++++++++++ .../SeriesRatedFilterFormComponent.razor | 77 ++++++++++ .../WatchIt.Website/Layout/MainLayout.razor | 2 +- .../WatchIt.Website/Pages/DatabasePage.razor | 133 +++++++++--------- .../WatchIt.Website/Pages/UserPage.razor | 52 ++++++- .../WatchIt.Website/Pages/UserPage.razor.cs | 4 +- .../WatchIt.Website/appsettings.json | 7 +- 38 files changed, 862 insertions(+), 156 deletions(-) create mode 100644 WatchIt.Common/WatchIt.Common.Model/Movies/MovieRatedQueryParameters.cs create mode 100644 WatchIt.Common/WatchIt.Common.Model/Movies/MovieRatedResponse.cs create mode 100644 WatchIt.Common/WatchIt.Common.Model/Series/SeriesRatedQueryParameters.cs create mode 100644 WatchIt.Common/WatchIt.Common.Model/Series/SeriesRatedResponse.cs rename WatchIt.Website/WatchIt.Website/Components/{Pages/DatabasePage/Subcomponents => Common/ListComponent}/FilterFormComponent.cs (73%) rename WatchIt.Website/WatchIt.Website/Components/{Pages/DatabasePage/DatabasePageComponent.razor => Common/ListComponent/ListComponent.razor} (96%) rename WatchIt.Website/WatchIt.Website/Components/{Pages/DatabasePage/DatabasePageComponent.razor.cs => Common/ListComponent/ListComponent.razor.cs} (92%) create mode 100644 WatchIt.Website/WatchIt.Website/Components/Pages/UserPage/Subcomponents/MoviesRatedFilterFormComponent.razor create mode 100644 WatchIt.Website/WatchIt.Website/Components/Pages/UserPage/Subcomponents/SeriesRatedFilterFormComponent.razor diff --git a/WatchIt.Common/WatchIt.Common.Model/Genres/GenreResponse.cs b/WatchIt.Common/WatchIt.Common.Model/Genres/GenreResponse.cs index 022fa80..9bb7cba 100644 --- a/WatchIt.Common/WatchIt.Common.Model/Genres/GenreResponse.cs +++ b/WatchIt.Common/WatchIt.Common.Model/Genres/GenreResponse.cs @@ -18,7 +18,7 @@ public class GenreResponse : Genre, IQueryOrderable [JsonPropertyName("id")] - public long Id { get; set; } + public short Id { get; set; } #endregion diff --git a/WatchIt.Common/WatchIt.Common.Model/Media/MediaQueryParameters.cs b/WatchIt.Common/WatchIt.Common.Model/Media/MediaQueryParameters.cs index fcbfe10..b0952b0 100644 --- a/WatchIt.Common/WatchIt.Common.Model/Media/MediaQueryParameters.cs +++ b/WatchIt.Common/WatchIt.Common.Model/Media/MediaQueryParameters.cs @@ -54,6 +54,9 @@ public class MediaQueryParameters : QueryParameters [FromQuery(Name = "rating_count_to")] public long? RatingCountTo { get; set; } + + [FromQuery(Name = "genre")] + public IEnumerable? Genres { get; set; } #endregion @@ -78,6 +81,8 @@ public class MediaQueryParameters : QueryParameters TestComparable(item.Rating.Average, RatingAverage, RatingAverageFrom, RatingAverageTo) && TestComparable(item.Rating.Count, RatingCount, RatingCountFrom, RatingCountTo) + && + TestContains(Genres, item.Genres.Select(x => x.Id)) ); #endregion diff --git a/WatchIt.Common/WatchIt.Common.Model/Media/MediaResponse.cs b/WatchIt.Common/WatchIt.Common.Model/Media/MediaResponse.cs index fd10ae8..8a18de1 100644 --- a/WatchIt.Common/WatchIt.Common.Model/Media/MediaResponse.cs +++ b/WatchIt.Common/WatchIt.Common.Model/Media/MediaResponse.cs @@ -1,5 +1,6 @@ using System.Diagnostics.CodeAnalysis; using System.Text.Json.Serialization; +using WatchIt.Common.Model.Genres; using WatchIt.Common.Model.Rating; using WatchIt.Common.Query; @@ -31,6 +32,9 @@ public class MediaResponse : Media, IQueryOrderable [JsonPropertyName("rating")] public RatingResponse Rating { get; set; } + + [JsonPropertyName("genres")] + public IEnumerable Genres { get; set; } #endregion @@ -52,6 +56,7 @@ public class MediaResponse : Media, IQueryOrderable Length = media.Length; Type = mediaType; Rating = RatingResponse.Create(media.RatingMedia); + Genres = media.Genres.Select(x => new GenreResponse(x)).ToList(); } #endregion diff --git a/WatchIt.Common/WatchIt.Common.Model/Movies/MovieQueryParameters.cs b/WatchIt.Common/WatchIt.Common.Model/Movies/MovieQueryParameters.cs index ede62e0..35c239c 100644 --- a/WatchIt.Common/WatchIt.Common.Model/Movies/MovieQueryParameters.cs +++ b/WatchIt.Common/WatchIt.Common.Model/Movies/MovieQueryParameters.cs @@ -60,6 +60,9 @@ public class MovieQueryParameters : QueryParameters [FromQuery(Name = "rating_count_to")] public long? RatingCountTo { get; set; } + + [FromQuery(Name = "genre")] + public IEnumerable? Genres { get; set; } #endregion @@ -84,6 +87,8 @@ public class MovieQueryParameters : QueryParameters TestComparable(item.Rating.Average, RatingAverage, RatingAverageFrom, RatingAverageTo) && TestComparable(item.Rating.Count, RatingCount, RatingCountFrom, RatingCountTo) + && + TestContains(item.Genres.Select(x => x.Id), Genres) ); #endregion diff --git a/WatchIt.Common/WatchIt.Common.Model/Movies/MovieRatedQueryParameters.cs b/WatchIt.Common/WatchIt.Common.Model/Movies/MovieRatedQueryParameters.cs new file mode 100644 index 0000000..ef74767 --- /dev/null +++ b/WatchIt.Common/WatchIt.Common.Model/Movies/MovieRatedQueryParameters.cs @@ -0,0 +1,104 @@ +using Microsoft.AspNetCore.Mvc; +using WatchIt.Common.Query; + +namespace WatchIt.Common.Model.Movies; + +public class MovieRatedQueryParameters : QueryParameters +{ + #region PROPERTIES + + [FromQuery(Name = "title")] + public string? Title { get; set; } + + [FromQuery(Name = "original_title")] + public string? OriginalTitle { get; set; } + + [FromQuery(Name = "description")] + public string? Description { get; set; } + + [FromQuery(Name = "release_date")] + public DateOnly? ReleaseDate { get; set; } + + [FromQuery(Name = "release_date_from")] + public DateOnly? ReleaseDateFrom { get; set; } + + [FromQuery(Name = "release_date_to")] + public DateOnly? ReleaseDateTo { get; set; } + + [FromQuery(Name = "length")] + public short? Length { get; set; } + + [FromQuery(Name = "length_from")] + public short? LengthFrom { get; set; } + + [FromQuery(Name = "length_to")] + public short? LengthTo { get; set; } + + [FromQuery(Name = "budget")] + public decimal? Budget { get; set; } + + [FromQuery(Name = "budget_from")] + public decimal? BudgetFrom { get; set; } + + [FromQuery(Name = "budget_to")] + public decimal? BudgetTo { get; set; } + + [FromQuery(Name = "rating_average")] + public decimal? RatingAverage { get; set; } + + [FromQuery(Name = "rating_average_from")] + public decimal? RatingAverageFrom { get; set; } + + [FromQuery(Name = "rating_average_to")] + public decimal? RatingAverageTo { get; set; } + + [FromQuery(Name = "rating_count")] + public long? RatingCount { get; set; } + + [FromQuery(Name = "rating_count_from")] + public long? RatingCountFrom { get; set; } + + [FromQuery(Name = "rating_count_to")] + public long? RatingCountTo { get; set; } + + [FromQuery(Name = "genre")] + public IEnumerable? Genres { get; set; } + + [FromQuery(Name = "user_rating")] + public decimal? UserRating { get; set; } + + [FromQuery(Name = "user_rating_from")] + public decimal? UserRatingFrom { get; set; } + + [FromQuery(Name = "user_rating_to")] + public decimal? UserRatingTo { get; set; } + + #endregion + + + + #region PRIVATE METHODS + + protected override bool IsMeetingConditions(MovieRatedResponse item) => + ( + TestStringWithRegex(item.Title, Title) + && + TestStringWithRegex(item.OriginalTitle, OriginalTitle) + && + TestStringWithRegex(item.Description, Description) + && + TestComparable(item.ReleaseDate, ReleaseDate, ReleaseDateFrom, ReleaseDateTo) + && + TestComparable(item.Length, Length, LengthFrom, LengthTo) + && + TestComparable(item.Rating.Average, RatingAverage, RatingAverageFrom, RatingAverageTo) + && + TestComparable(item.Rating.Count, RatingCount, RatingCountFrom, RatingCountTo) + && + TestContains(Genres, item.Genres.Select(x => x.Id)) + && + TestComparable((decimal)item.UserRating, UserRating, UserRatingFrom, UserRatingTo) + ); + + #endregion +} \ No newline at end of file diff --git a/WatchIt.Common/WatchIt.Common.Model/Movies/MovieRatedResponse.cs b/WatchIt.Common/WatchIt.Common.Model/Movies/MovieRatedResponse.cs new file mode 100644 index 0000000..0e1bd31 --- /dev/null +++ b/WatchIt.Common/WatchIt.Common.Model/Movies/MovieRatedResponse.cs @@ -0,0 +1,58 @@ +using System.Diagnostics.CodeAnalysis; +using System.Text.Json.Serialization; +using WatchIt.Common.Model.Genres; +using WatchIt.Common.Model.Rating; +using WatchIt.Common.Query; +using WatchIt.Database.Model.Media; +using WatchIt.Database.Model.Rating; + +namespace WatchIt.Common.Model.Movies; + +public class MovieRatedResponse : MovieResponse, IQueryOrderable +{ + #region PROPERTIES + + [JsonIgnore] + public static IDictionary> OrderableProperties { get; } = new Dictionary> + { + { "id", x => x.Id }, + { "title", x => x.Title }, + { "original_title", x => x.OriginalTitle }, + { "description", x => x.Description }, + { "release_date", x => x.ReleaseDate }, + { "length", x => x.Length }, + { "budget", x => x.Budget }, + { "rating.average", x => x.Rating.Average }, + { "rating.count", x => x.Rating.Count }, + { "user_rating", x => x.UserRating } + }; + + [JsonPropertyName("user_rating")] + public short UserRating { get; set; } + + #endregion + + + + #region CONSTRUCTORS + + [JsonConstructor] + public MovieRatedResponse() { } + + [SetsRequiredMembers] + public MovieRatedResponse(MediaMovie mediaMovie, RatingMedia response) + { + Id = mediaMovie.Media.Id; + Title = mediaMovie.Media.Title; + OriginalTitle = mediaMovie.Media.OriginalTitle; + Description = mediaMovie.Media.Description; + ReleaseDate = mediaMovie.Media.ReleaseDate; + Length = mediaMovie.Media.Length; + Budget = mediaMovie.Budget; + Rating = RatingResponse.Create(mediaMovie.Media.RatingMedia); + Genres = mediaMovie.Media.Genres.Select(x => new GenreResponse(x)).ToList(); + UserRating = response.Rating; + } + + #endregion +} \ No newline at end of file diff --git a/WatchIt.Common/WatchIt.Common.Model/Movies/MovieResponse.cs b/WatchIt.Common/WatchIt.Common.Model/Movies/MovieResponse.cs index 366b058..2e25288 100644 --- a/WatchIt.Common/WatchIt.Common.Model/Movies/MovieResponse.cs +++ b/WatchIt.Common/WatchIt.Common.Model/Movies/MovieResponse.cs @@ -1,5 +1,6 @@ using System.Diagnostics.CodeAnalysis; using System.Text.Json.Serialization; +using WatchIt.Common.Model.Genres; using WatchIt.Common.Model.Rating; using WatchIt.Common.Query; using WatchIt.Database.Model.Media; @@ -30,6 +31,9 @@ public class MovieResponse : Movie, IQueryOrderable [JsonPropertyName("rating")] public RatingResponse Rating { get; set; } + + [JsonPropertyName("genres")] + public IEnumerable Genres { get; set; } #endregion @@ -51,6 +55,7 @@ public class MovieResponse : Movie, IQueryOrderable Length = mediaMovie.Media.Length; Budget = mediaMovie.Budget; Rating = RatingResponse.Create(mediaMovie.Media.RatingMedia); + Genres = mediaMovie.Media.Genres.Select(x => new GenreResponse(x)).ToList(); } #endregion diff --git a/WatchIt.Common/WatchIt.Common.Model/Series/SeriesQueryParameters.cs b/WatchIt.Common/WatchIt.Common.Model/Series/SeriesQueryParameters.cs index 164a029..2cc5de4 100644 --- a/WatchIt.Common/WatchIt.Common.Model/Series/SeriesQueryParameters.cs +++ b/WatchIt.Common/WatchIt.Common.Model/Series/SeriesQueryParameters.cs @@ -54,6 +54,9 @@ public class SeriesQueryParameters : QueryParameters [FromQuery(Name = "rating_count_to")] public long? RatingCountTo { get; set; } + + [FromQuery(Name = "genre")] + public IEnumerable? Genres { get; set; } #endregion @@ -78,6 +81,8 @@ public class SeriesQueryParameters : QueryParameters TestComparable(item.Rating.Average, RatingAverage, RatingAverageFrom, RatingAverageTo) && TestComparable(item.Rating.Count, RatingCount, RatingCountFrom, RatingCountTo) + && + TestContains(item.Genres.Select(x => x.Id), Genres) ); #endregion diff --git a/WatchIt.Common/WatchIt.Common.Model/Series/SeriesRatedQueryParameters.cs b/WatchIt.Common/WatchIt.Common.Model/Series/SeriesRatedQueryParameters.cs new file mode 100644 index 0000000..7d155ab --- /dev/null +++ b/WatchIt.Common/WatchIt.Common.Model/Series/SeriesRatedQueryParameters.cs @@ -0,0 +1,100 @@ +using Microsoft.AspNetCore.Mvc; +using WatchIt.Common.Query; + +namespace WatchIt.Common.Model.Series; + +public class SeriesRatedQueryParameters : QueryParameters +{ + #region PROPERTIES + + [FromQuery(Name = "title")] + public string? Title { get; set; } + + [FromQuery(Name = "original_title")] + public string? OriginalTitle { get; set; } + + [FromQuery(Name = "description")] + public string? Description { get; set; } + + [FromQuery(Name = "release_date")] + public DateOnly? ReleaseDate { get; set; } + + [FromQuery(Name = "release_date_from")] + public DateOnly? ReleaseDateFrom { get; set; } + + [FromQuery(Name = "release_date_to")] + public DateOnly? ReleaseDateTo { get; set; } + + [FromQuery(Name = "length")] + public short? Length { get; set; } + + [FromQuery(Name = "length_from")] + public short? LengthFrom { get; set; } + + [FromQuery(Name = "length_to")] + public short? LengthTo { get; set; } + + [FromQuery(Name = "has_ended")] + public bool? HasEnded { get; set; } + + [FromQuery(Name = "rating_average")] + public decimal? RatingAverage { get; set; } + + [FromQuery(Name = "rating_average_from")] + public decimal? RatingAverageFrom { get; set; } + + [FromQuery(Name = "rating_average_to")] + public decimal? RatingAverageTo { get; set; } + + [FromQuery(Name = "rating_count")] + public long? RatingCount { get; set; } + + [FromQuery(Name = "rating_count_from")] + public long? RatingCountFrom { get; set; } + + [FromQuery(Name = "rating_count_to")] + public long? RatingCountTo { get; set; } + + [FromQuery(Name = "genre")] + public IEnumerable? Genres { get; set; } + + [FromQuery(Name = "user_rating")] + public decimal? UserRating { get; set; } + + [FromQuery(Name = "user_rating_from")] + public decimal? UserRatingFrom { get; set; } + + [FromQuery(Name = "user_rating_to")] + public decimal? UserRatingTo { get; set; } + + #endregion + + + + #region PRIVATE METHODS + + protected override bool IsMeetingConditions(SeriesRatedResponse item) => + ( + TestStringWithRegex(item.Title, Title) + && + TestStringWithRegex(item.OriginalTitle, OriginalTitle) + && + TestStringWithRegex(item.Description, Description) + && + TestComparable(item.ReleaseDate, ReleaseDate, ReleaseDateFrom, ReleaseDateTo) + && + TestComparable(item.Length, Length, LengthFrom, LengthTo) + && + Test(item.HasEnded, HasEnded) + && + TestComparable(item.Rating.Average, RatingAverage, RatingAverageFrom, RatingAverageTo) + && + TestComparable(item.Rating.Count, RatingCount, RatingCountFrom, RatingCountTo) + && + TestContains(item.Genres.Select(x => x.Id), Genres) + && + TestComparable((decimal)item.UserRating, UserRating, UserRatingFrom, UserRatingTo) + ); + + #endregion +} \ No newline at end of file diff --git a/WatchIt.Common/WatchIt.Common.Model/Series/SeriesRatedResponse.cs b/WatchIt.Common/WatchIt.Common.Model/Series/SeriesRatedResponse.cs new file mode 100644 index 0000000..2e47804 --- /dev/null +++ b/WatchIt.Common/WatchIt.Common.Model/Series/SeriesRatedResponse.cs @@ -0,0 +1,58 @@ +using System.Diagnostics.CodeAnalysis; +using System.Text.Json.Serialization; +using WatchIt.Common.Model.Genres; +using WatchIt.Common.Model.Rating; +using WatchIt.Common.Query; +using WatchIt.Database.Model.Media; +using WatchIt.Database.Model.Rating; + +namespace WatchIt.Common.Model.Series; + +public class SeriesRatedResponse : SeriesResponse, IQueryOrderable +{ + #region PROPERTIES + + [JsonIgnore] + public static IDictionary> OrderableProperties { get; } = new Dictionary> + { + { "id", x => x.Id }, + { "title", x => x.Title }, + { "original_title", x => x.OriginalTitle }, + { "description", x => x.Description }, + { "release_date", x => x.ReleaseDate }, + { "length", x => x.Length }, + { "has_ended", x => x.HasEnded }, + { "rating.average", x => x.Rating.Average }, + { "rating.count", x => x.Rating.Count }, + { "user_rating", x => x.UserRating } + }; + + [JsonPropertyName("user_rating")] + public short UserRating { get; set; } + + #endregion + + + + #region CONSTRUCTORS + + [JsonConstructor] + public SeriesRatedResponse() { } + + [SetsRequiredMembers] + public SeriesRatedResponse(MediaSeries mediaSeries, RatingMedia response) + { + Id = mediaSeries.Media.Id; + Title = mediaSeries.Media.Title; + OriginalTitle = mediaSeries.Media.OriginalTitle; + Description = mediaSeries.Media.Description; + ReleaseDate = mediaSeries.Media.ReleaseDate; + Length = mediaSeries.Media.Length; + HasEnded = mediaSeries.HasEnded; + Rating = RatingResponse.Create(mediaSeries.Media.RatingMedia); + Genres = mediaSeries.Media.Genres.Select(x => new GenreResponse(x)).ToList(); + UserRating = response.Rating; + } + + #endregion +} \ No newline at end of file diff --git a/WatchIt.Common/WatchIt.Common.Model/Series/SeriesResponse.cs b/WatchIt.Common/WatchIt.Common.Model/Series/SeriesResponse.cs index fe3fa4b..17a0f9d 100644 --- a/WatchIt.Common/WatchIt.Common.Model/Series/SeriesResponse.cs +++ b/WatchIt.Common/WatchIt.Common.Model/Series/SeriesResponse.cs @@ -1,5 +1,6 @@ using System.Diagnostics.CodeAnalysis; using System.Text.Json.Serialization; +using WatchIt.Common.Model.Genres; using WatchIt.Common.Model.Rating; using WatchIt.Common.Query; using WatchIt.Database.Model.Media; @@ -30,6 +31,9 @@ public class SeriesResponse : Series, IQueryOrderable [JsonPropertyName("rating")] public RatingResponse Rating { get; set; } + + [JsonPropertyName("genres")] + public IEnumerable Genres { get; set; } #endregion @@ -51,6 +55,7 @@ public class SeriesResponse : Series, IQueryOrderable Length = mediaSeries.Media.Length; HasEnded = mediaSeries.HasEnded; Rating = RatingResponse.Create(mediaSeries.Media.RatingMedia); + Genres = mediaSeries.Media.Genres.Select(x => new GenreResponse(x)).ToList(); } #endregion diff --git a/WatchIt.Common/WatchIt.Common.Query/QueryParameters.cs b/WatchIt.Common/WatchIt.Common.Query/QueryParameters.cs index c574197..4f27d62 100644 --- a/WatchIt.Common/WatchIt.Common.Query/QueryParameters.cs +++ b/WatchIt.Common/WatchIt.Common.Query/QueryParameters.cs @@ -1,4 +1,5 @@ -using System.Globalization; +using System.Collections; +using System.Globalization; using System.Reflection; using System.Text; using System.Text.Json.Serialization; @@ -39,13 +40,16 @@ public abstract class QueryParameters FromQueryAttribute? attribute = property.GetCustomAttributes(true).FirstOrDefault(); if (value is not null && attribute is not null) { - string valueString = (value switch + if (value is IEnumerable enumerable and not string) { - decimal d => d.ToString(CultureInfo.InvariantCulture), - _ => value.ToString() - })!; - string query = $"{attribute.Name}={valueString}"; - queries.Add(query); + IEnumerable arrayQueryElements = enumerable.Cast().Select(x => QueryElementToString(attribute.Name!, x.ToString())); + queries.AddRange(arrayQueryElements); + } + else + { + string query = QueryElementToString(attribute.Name!, value); + queries.Add(query); + } } } @@ -58,6 +62,18 @@ public abstract class QueryParameters #region PRIVATE METHODS + private string QueryElementToString(string name, object value) + { + string valueString = (value switch + { + decimal d => d.ToString(CultureInfo.InvariantCulture), + _ => value.ToString() + })!; + string query = $"{name}={valueString}"; + return query; + } + + protected static bool Test(T? property, T? query) => ( query is null @@ -113,6 +129,15 @@ public abstract class QueryParameters ) ); + protected static bool TestContains(IEnumerable? shouldBeInCollection, IEnumerable? collection) => + ( + collection is null + || + shouldBeInCollection is null + || + shouldBeInCollection.All(collection.Contains) + ); + #endregion } diff --git a/WatchIt.WebAPI/WatchIt.WebAPI.Controllers/AccountsController.cs b/WatchIt.WebAPI/WatchIt.WebAPI.Controllers/AccountsController.cs index c431396..1fceee4 100644 --- a/WatchIt.WebAPI/WatchIt.WebAPI.Controllers/AccountsController.cs +++ b/WatchIt.WebAPI/WatchIt.WebAPI.Controllers/AccountsController.cs @@ -3,6 +3,8 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using WatchIt.Common.Model.Accounts; +using WatchIt.Common.Model.Movies; +using WatchIt.Common.Model.Series; using WatchIt.WebAPI.Services.Controllers.Accounts; namespace WatchIt.WebAPI.Controllers; @@ -49,17 +51,22 @@ public class AccountsController(IAccountsControllerService accountsControllerSer [ProducesResponseType(StatusCodes.Status404NotFound)] public async Task GetAccountInfo([FromRoute]long id) => await accountsControllerService.GetAccountInfo(id); - [HttpGet("info")] - [Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme)] - [ProducesResponseType(typeof(AccountResponse), StatusCodes.Status200OK)] - [ProducesResponseType(StatusCodes.Status401Unauthorized)] - [ProducesResponseType(StatusCodes.Status404NotFound)] - public async Task GetAccountInfo() => await accountsControllerService.GetAccountInfo(); - [HttpPut("info")] [Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme)] [ProducesResponseType(typeof(AccountResponse), StatusCodes.Status200OK)] [ProducesResponseType(StatusCodes.Status401Unauthorized)] [ProducesResponseType(StatusCodes.Status404NotFound)] public async Task PutAccountInfo([FromBody]AccountRequest data) => await accountsControllerService.PutAccountInfo(data); + + [HttpGet("{id}/movies")] + [AllowAnonymous] + [ProducesResponseType(typeof(IEnumerable), StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status404NotFound)] + public async Task GetAccountRatedMovies([FromRoute]long id, MovieRatedQueryParameters query) => await accountsControllerService.GetAccountRatedMovies(id, query); + + [HttpGet("{id}/series")] + [AllowAnonymous] + [ProducesResponseType(typeof(IEnumerable), StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status404NotFound)] + public async Task GetAccountRatedSeries([FromRoute]long id, SeriesRatedQueryParameters query) => await accountsControllerService.GetAccountRatedSeries(id, query); } \ No newline at end of file diff --git a/WatchIt.WebAPI/WatchIt.WebAPI.Services/WatchIt.WebAPI.Services.Controllers/WatchIt.WebAPI.Services.Controllers.Accounts/AccountsControllerService.cs b/WatchIt.WebAPI/WatchIt.WebAPI.Services/WatchIt.WebAPI.Services.Controllers/WatchIt.WebAPI.Services.Controllers.Accounts/AccountsControllerService.cs index af69597..f49a9be 100644 --- a/WatchIt.WebAPI/WatchIt.WebAPI.Services/WatchIt.WebAPI.Services.Controllers/WatchIt.WebAPI.Services.Controllers.Accounts/AccountsControllerService.cs +++ b/WatchIt.WebAPI/WatchIt.WebAPI.Services/WatchIt.WebAPI.Services.Controllers/WatchIt.WebAPI.Services.Controllers.Accounts/AccountsControllerService.cs @@ -5,8 +5,13 @@ using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Logging; using SimpleToolkit.Extensions; using WatchIt.Common.Model.Accounts; +using WatchIt.Common.Model.Media; +using WatchIt.Common.Model.Movies; +using WatchIt.Common.Model.Series; using WatchIt.Database; using WatchIt.Database.Model.Account; +using WatchIt.Database.Model.Media; +using WatchIt.Database.Model.Rating; using WatchIt.WebAPI.Services.Controllers.Common; using WatchIt.WebAPI.Services.Utility.Tokens; using WatchIt.WebAPI.Services.Utility.Tokens.Exceptions; @@ -136,7 +141,6 @@ public class AccountsControllerService( return RequestResult.Ok(picture); } - public async Task GetAccountInfo() => await GetAccountInfo(userService.GetUserId()); public async Task GetAccountInfo(long id) { Account? account = await database.Accounts.FirstOrDefaultAsync(x => x.Id == id); @@ -160,6 +164,32 @@ public class AccountsControllerService( data.UpdateAccount(account); return RequestResult.Ok(); } + + public async Task GetAccountRatedMovies(long id, MovieRatedQueryParameters query) + { + Account? account = await database.Accounts.FirstOrDefaultAsync(x => x.Id == id); + if (account is null) + { + return RequestResult.NotFound(); + } + + IEnumerable response = account.RatingMedia.Join(database.MediaMovies, x => x.MediaId, x => x.Id, (x, y) => new MovieRatedResponse(y, x)); + response = query.PrepareData(response); + return RequestResult.Ok(response); + } + + public async Task GetAccountRatedSeries(long id, SeriesRatedQueryParameters query) + { + Account? account = await database.Accounts.FirstOrDefaultAsync(x => x.Id == id); + if (account is null) + { + return RequestResult.NotFound(); + } + + IEnumerable response = account.RatingMedia.Join(database.MediaSeries, x => x.MediaId, x => x.Id, (x, y) => new SeriesRatedResponse(y, x)); + response = query.PrepareData(response); + return RequestResult.Ok(response); + } #endregion diff --git a/WatchIt.WebAPI/WatchIt.WebAPI.Services/WatchIt.WebAPI.Services.Controllers/WatchIt.WebAPI.Services.Controllers.Accounts/IAccountsControllerService.cs b/WatchIt.WebAPI/WatchIt.WebAPI.Services/WatchIt.WebAPI.Services.Controllers/WatchIt.WebAPI.Services.Controllers.Accounts/IAccountsControllerService.cs index 03098fe..5ce20dd 100644 --- a/WatchIt.WebAPI/WatchIt.WebAPI.Services/WatchIt.WebAPI.Services.Controllers/WatchIt.WebAPI.Services.Controllers.Accounts/IAccountsControllerService.cs +++ b/WatchIt.WebAPI/WatchIt.WebAPI.Services/WatchIt.WebAPI.Services.Controllers/WatchIt.WebAPI.Services.Controllers.Accounts/IAccountsControllerService.cs @@ -1,4 +1,7 @@ using WatchIt.Common.Model.Accounts; +using WatchIt.Common.Model.Media; +using WatchIt.Common.Model.Movies; +using WatchIt.Common.Model.Series; using WatchIt.WebAPI.Services.Controllers.Common; namespace WatchIt.WebAPI.Services.Controllers.Accounts; @@ -10,7 +13,8 @@ public interface IAccountsControllerService Task AuthenticateRefresh(); Task Logout(); Task GetAccountProfilePicture(long id); - Task GetAccountInfo(); Task GetAccountInfo(long id); Task PutAccountInfo(AccountRequest data); + Task GetAccountRatedMovies(long id, MovieRatedQueryParameters query); + Task GetAccountRatedSeries(long id, SeriesRatedQueryParameters query); } \ No newline at end of file diff --git a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/Accounts/AccountsClientService.cs b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/Accounts/AccountsClientService.cs index 70b6ccd..d71bb0f 100644 --- a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/Accounts/AccountsClientService.cs +++ b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/Accounts/AccountsClientService.cs @@ -1,4 +1,6 @@ using WatchIt.Common.Model.Accounts; +using WatchIt.Common.Model.Movies; +using WatchIt.Common.Model.Series; using WatchIt.Common.Services.HttpClient; using WatchIt.Website.Services.Configuration; using WatchIt.Website.Services.Tokens; @@ -78,9 +80,9 @@ public class AccountsClientService(IHttpClientService httpClientService, IConfig .ExecuteAction(); } - public async Task GetAccountInfoById(long id, Action? successAction = null, Action? notFoundAction = null) + public async Task GetAccountInfo(long id, Action? successAction = null, Action? notFoundAction = null) { - string url = GetUrl(EndpointsConfiguration.Accounts.GetAccountInfoById, id); + string url = GetUrl(EndpointsConfiguration.Accounts.GetAccountInfo, id); HttpRequest request = new HttpRequest(HttpMethodType.Get, url); HttpResponse response = await httpClientService.SendRequestAsync(request); @@ -89,18 +91,6 @@ public class AccountsClientService(IHttpClientService httpClientService, IConfig .ExecuteAction(); } - public async Task GetAccountInfo(Action? successAction = null, Action? unauthorizedAction = null, Action? notFoundAction = null) - { - string url = GetUrl(EndpointsConfiguration.Accounts.GetAccountInfo); - HttpRequest request = new HttpRequest(HttpMethodType.Get, url); - - HttpResponse response = await httpClientService.SendRequestAsync(request); - response.RegisterActionFor2XXSuccess(successAction) - .RegisterActionFor401Unauthorized(unauthorizedAction) - .RegisterActionFor404NotFound(notFoundAction) - .ExecuteAction(); - } - public async Task PutAccountInfo(AccountRequest data, Action? successAction = null, Action>? badRequestAction = null, Action? unauthorizedAction = null, Action? notFoundAction = null) { string url = GetUrl(EndpointsConfiguration.Accounts.PutAccountInfo); @@ -117,6 +107,34 @@ public class AccountsClientService(IHttpClientService httpClientService, IConfig .ExecuteAction(); } + public async Task GetAccountRatedMovies(long id, MovieRatedQueryParameters query, Action>? successAction = null, Action? notFoundAction = null) + { + string url = GetUrl(EndpointsConfiguration.Accounts.GetAccountRatedMovies, id); + HttpRequest request = new HttpRequest(HttpMethodType.Get, url) + { + Query = query + }; + + HttpResponse response = await httpClientService.SendRequestAsync(request); + response.RegisterActionFor2XXSuccess(successAction) + .RegisterActionFor404NotFound(notFoundAction) + .ExecuteAction(); + } + + public async Task GetAccountRatedSeries(long id, SeriesRatedQueryParameters query, Action>? successAction = null, Action? notFoundAction = null) + { + string url = GetUrl(EndpointsConfiguration.Accounts.GetAccountRatedSeries, id); + HttpRequest request = new HttpRequest(HttpMethodType.Get, url) + { + Query = query + }; + + HttpResponse response = await httpClientService.SendRequestAsync(request); + response.RegisterActionFor2XXSuccess(successAction) + .RegisterActionFor404NotFound(notFoundAction) + .ExecuteAction(); + } + #endregion diff --git a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/Accounts/IAccountsClientService.cs b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/Accounts/IAccountsClientService.cs index 9410526..7a2b0d7 100644 --- a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/Accounts/IAccountsClientService.cs +++ b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/Accounts/IAccountsClientService.cs @@ -1,4 +1,6 @@ using WatchIt.Common.Model.Accounts; +using WatchIt.Common.Model.Movies; +using WatchIt.Common.Model.Series; namespace WatchIt.Website.Services.Client.Accounts; @@ -9,7 +11,8 @@ public interface IAccountsClientService Task AuthenticateRefresh(Action? successAction = null, Action? unauthorizedAction = null, Action? forbiddenAction = null); Task Logout(Action? successAction = null); Task GetAccountProfilePicture(long id, Action? successAction = null, Action>? badRequestAction = null, Action? notFoundAction = null); - Task GetAccountInfoById(long id, Action? successAction = null, Action? notFoundAction = null); - Task GetAccountInfo(Action? successAction = null, Action? unauthorizedAction = null, Action? notFoundAction = null); + Task GetAccountInfo(long id, Action? successAction = null, Action? notFoundAction = null); Task PutAccountInfo(AccountRequest data, Action? successAction = null, Action>? badRequestAction = null, Action? unauthorizedAction = null, Action? notFoundAction = null); + Task GetAccountRatedMovies(long id, MovieRatedQueryParameters query, Action>? successAction = null, Action? notFoundAction = null); + Task GetAccountRatedSeries(long id, SeriesRatedQueryParameters query, Action>? successAction = null, Action? notFoundAction = null); } \ No newline at end of file diff --git a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Configuration/Model/Accounts.cs b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Configuration/Model/Accounts.cs index 1f648cf..9487bce 100644 --- a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Configuration/Model/Accounts.cs +++ b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Configuration/Model/Accounts.cs @@ -8,7 +8,8 @@ public class Accounts public string AuthenticateRefresh { get; set; } public string Logout { get; set; } public string GetProfilePicture { get; set; } - public string GetAccountInfoById { get; set; } public string GetAccountInfo { get; set; } public string PutAccountInfo { get; set; } + public string GetAccountRatedMovies { get; set; } + public string GetAccountRatedSeries { get; set; } } \ No newline at end of file diff --git a/WatchIt.Website/WatchIt.Website/App.razor b/WatchIt.Website/WatchIt.Website/App.razor index 502723d..fda64f7 100644 --- a/WatchIt.Website/WatchIt.Website/App.razor +++ b/WatchIt.Website/WatchIt.Website/App.razor @@ -13,7 +13,7 @@ - + diff --git a/WatchIt.Website/WatchIt.Website/Components/Pages/DatabasePage/Subcomponents/FilterFormComponent.cs b/WatchIt.Website/WatchIt.Website/Components/Common/ListComponent/FilterFormComponent.cs similarity index 73% rename from WatchIt.Website/WatchIt.Website/Components/Pages/DatabasePage/Subcomponents/FilterFormComponent.cs rename to WatchIt.Website/WatchIt.Website/Components/Common/ListComponent/FilterFormComponent.cs index 1df000c..19fa363 100644 --- a/WatchIt.Website/WatchIt.Website/Components/Pages/DatabasePage/Subcomponents/FilterFormComponent.cs +++ b/WatchIt.Website/WatchIt.Website/Components/Common/ListComponent/FilterFormComponent.cs @@ -1,14 +1,14 @@ using Microsoft.AspNetCore.Components; using WatchIt.Common.Query; -namespace WatchIt.Website.Components.Pages.DatabasePage.Subcomponents; +namespace WatchIt.Website.Components.Common.ListComponent; public abstract class FilterFormComponent : ComponentBase where TItem : IQueryOrderable where TQuery : QueryParameters { #region PARAMETERS [CascadingParameter] - protected DatabasePageComponent Parent { get; set; } + protected ListComponent Parent { get; set; } #endregion diff --git a/WatchIt.Website/WatchIt.Website/Components/Pages/DatabasePage/DatabasePageComponent.razor b/WatchIt.Website/WatchIt.Website/Components/Common/ListComponent/ListComponent.razor similarity index 96% rename from WatchIt.Website/WatchIt.Website/Components/Pages/DatabasePage/DatabasePageComponent.razor rename to WatchIt.Website/WatchIt.Website/Components/Common/ListComponent/ListComponent.razor index 0a3738a..fa20d1a 100644 --- a/WatchIt.Website/WatchIt.Website/Components/Pages/DatabasePage/DatabasePageComponent.razor +++ b/WatchIt.Website/WatchIt.Website/Components/Common/ListComponent/ListComponent.razor @@ -60,6 +60,8 @@ PosterPlaceholder="@(PosterPlaceholder)" PosterDownloadingTask="@(action => PictureDownloadingTask(id, action))" GlobalRating="@(RatingSource(item))" + SecondaryRating="@(SecondaryRatingSource?.Invoke(item))" + SecondaryRatingTitle="@(SecondaryRatingTitle)" GetGlobalRatingMethod="@(action => GetGlobalRatingMethod(id, action))" GetUserRatingMethod="@(GetUserRatingMethod is not null ? (user, actionSuccess, actionNotFound) => GetUserRatingMethod(id, user, actionSuccess, actionNotFound) : null)" PutRatingMethod="@(PutRatingMethod is not null ? (request) => PutRatingMethod(id, request) : null)" diff --git a/WatchIt.Website/WatchIt.Website/Components/Pages/DatabasePage/DatabasePageComponent.razor.cs b/WatchIt.Website/WatchIt.Website/Components/Common/ListComponent/ListComponent.razor.cs similarity index 92% rename from WatchIt.Website/WatchIt.Website/Components/Pages/DatabasePage/DatabasePageComponent.razor.cs rename to WatchIt.Website/WatchIt.Website/Components/Common/ListComponent/ListComponent.razor.cs index 85791ad..ce6093d 100644 --- a/WatchIt.Website/WatchIt.Website/Components/Pages/DatabasePage/DatabasePageComponent.razor.cs +++ b/WatchIt.Website/WatchIt.Website/Components/Common/ListComponent/ListComponent.razor.cs @@ -4,9 +4,9 @@ using WatchIt.Common.Model.Movies; using WatchIt.Common.Model.Rating; using WatchIt.Common.Query; -namespace WatchIt.Website.Components.Pages.DatabasePage; +namespace WatchIt.Website.Components.Common.ListComponent; -public partial class DatabasePageComponent : ComponentBase where TItem : IQueryOrderable where TQuery : QueryParameters +public partial class ListComponent : ComponentBase where TItem : IQueryOrderable where TQuery : QueryParameters { #region SERVICES @@ -23,6 +23,8 @@ public partial class DatabasePageComponent : ComponentBase where [Parameter] public required Func NameSource { get; set; } [Parameter] public Func AdditionalNameInfoSource { get; set; } = _ => null; [Parameter] public required Func RatingSource { get; set; } + [Parameter] public Func? SecondaryRatingSource { get; set; } + [Parameter] public string? SecondaryRatingTitle { get; set; } [Parameter] public required string UrlIdTemplate { get; set; } [Parameter] public required Func, Task> PictureDownloadingTask { get; set; } [Parameter] public required Func>, Task> ItemDownloadingTask { get; set; } diff --git a/WatchIt.Website/WatchIt.Website/Components/Common/Subcomponents/DisplayRatingComponent.razor b/WatchIt.Website/WatchIt.Website/Components/Common/Subcomponents/DisplayRatingComponent.razor index da7a6c5..47a14b9 100644 --- a/WatchIt.Website/WatchIt.Website/Components/Common/Subcomponents/DisplayRatingComponent.razor +++ b/WatchIt.Website/WatchIt.Website/Components/Common/Subcomponents/DisplayRatingComponent.razor @@ -5,14 +5,18 @@ }
- @if (Rating is not null && Rating.Count > 0) + @if (SingleRating is not null) + { + @($"{SingleRating}/10") + } + else if (Rating is not null && Rating.Count > 0) { @($"{Math.Round(Rating.Average, 2)}/10") @(Rating.Count) } else { -
+
@if (Rating is null) {
/10
@@ -40,7 +44,7 @@ font-size: @((1.3 * Scale).ToCultureInvariantString())rem; } - #ratingNoItems { + #ratingSingleLine { font-size: @((1.3 * Scale).ToCultureInvariantString())rem; } diff --git a/WatchIt.Website/WatchIt.Website/Components/Common/Subcomponents/DisplayRatingComponent.razor.cs b/WatchIt.Website/WatchIt.Website/Components/Common/Subcomponents/DisplayRatingComponent.razor.cs index 8f6935e..8c8be62 100644 --- a/WatchIt.Website/WatchIt.Website/Components/Common/Subcomponents/DisplayRatingComponent.razor.cs +++ b/WatchIt.Website/WatchIt.Website/Components/Common/Subcomponents/DisplayRatingComponent.razor.cs @@ -8,6 +8,7 @@ public partial class DisplayRatingComponent : ComponentBase #region PARAMETERS [Parameter] public RatingResponse? Rating { get; set; } + [Parameter] public short? SingleRating { get; set; } [Parameter] public DisplayRatingComponentEmptyMode EmptyMode { get; set; } = DisplayRatingComponentEmptyMode.NoRatings; [Parameter] public double Scale { get; set; } = 1; diff --git a/WatchIt.Website/WatchIt.Website/Components/Common/Subcomponents/ListItemComponent.razor b/WatchIt.Website/WatchIt.Website/Components/Common/Subcomponents/ListItemComponent.razor index 42b9837..b87ecbd 100644 --- a/WatchIt.Website/WatchIt.Website/Components/Common/Subcomponents/ListItemComponent.razor +++ b/WatchIt.Website/WatchIt.Website/Components/Common/Subcomponents/ListItemComponent.razor @@ -12,40 +12,66 @@ @(Name)@(string.IsNullOrWhiteSpace(AdditionalInfo) ? string.Empty : AdditionalInfo)
-
- -
- Global rating: - -
-
- @if (GetUserRatingMethod is not null && PutRatingMethod is not null && DeleteRatingMethod is not null) - { -
-
- Your rating: -
- @if (_user is null) - { - You must be logged in to rate - } - else if (!_userRatingLoaded) - { -
- - Loading... + + + + + @if (SecondaryRating is not null) + { + + } + @if (GetUserRatingMethod is not null && PutRatingMethod is not null && DeleteRatingMethod is not null) + { + + } + + + + + + @if (SecondaryRating is not null) + { + + } + @if (GetUserRatingMethod is not null && PutRatingMethod is not null && DeleteRatingMethod is not null) + { + + } + + +
+ Global rating: + + @(SecondaryRatingTitle): + + Your rating: +
+ + + + +
+ @if (_user is null) + { + You must be logged in to rate + } + else if (!_userRatingLoaded) + { +
+ + Loading... +
+ } + else + { + + }
- } - else - { - - } - - - } - +
diff --git a/WatchIt.Website/WatchIt.Website/Components/Common/Subcomponents/ListItemComponent.razor.cs b/WatchIt.Website/WatchIt.Website/Components/Common/Subcomponents/ListItemComponent.razor.cs index 326dbf1..4189a8e 100644 --- a/WatchIt.Website/WatchIt.Website/Components/Common/Subcomponents/ListItemComponent.razor.cs +++ b/WatchIt.Website/WatchIt.Website/Components/Common/Subcomponents/ListItemComponent.razor.cs @@ -27,6 +27,8 @@ public partial class ListItemComponent : ComponentBase [Parameter] public required Func, Task> PosterDownloadingTask { get; set; } [Parameter] public RatingResponse? GlobalRating { get; set; } + [Parameter] public short? SecondaryRating { get; set; } + [Parameter] public string? SecondaryRatingTitle { get; set; } [Parameter] public required Func, Task> GetGlobalRatingMethod { get; set; } [Parameter] public Func, Action, Task>? GetUserRatingMethod { get; set; } [Parameter] public Func? PutRatingMethod { get; set; } diff --git a/WatchIt.Website/WatchIt.Website/Components/Common/Subcomponents/ListItemComponent.razor.css b/WatchIt.Website/WatchIt.Website/Components/Common/Subcomponents/ListItemComponent.razor.css index 7c26de1..195130b 100644 --- a/WatchIt.Website/WatchIt.Website/Components/Common/Subcomponents/ListItemComponent.razor.css +++ b/WatchIt.Website/WatchIt.Website/Components/Common/Subcomponents/ListItemComponent.razor.css @@ -1,10 +1,39 @@ -/* IDS */ +/* TAGS */ -#ratingNameText { - font-size: 14px; - font-weight: bold; +tbody, td, tfoot, th, thead, tr { + border-color: inherit; + border-style: unset; + border-width: 0; } + + +/* IDS */ + #ratingLoginInfoText { font-size: 13px; +} + +#ratingTable { + width: fit-content; + border-spacing: unset; + border-collapse: separate; + margin-left: -0.5rem !important; +} + +#ratingTable > thead > tr > th:not(:last-child) { + border-right: 1px solid #444; +} + +#ratingTable > tbody > tr > td:not(:last-child) { + border-right: 1px solid #444; +} + + + +/* CLASSES */ + +.rating-name-text { + font-size: 14px; + font-weight: bold; } \ No newline at end of file diff --git a/WatchIt.Website/WatchIt.Website/Components/Pages/DatabasePage/Subcomponents/MoviesFilterFormComponent.razor b/WatchIt.Website/WatchIt.Website/Components/Pages/DatabasePage/Subcomponents/MoviesFilterFormComponent.razor index d24e473..eac3a8d 100644 --- a/WatchIt.Website/WatchIt.Website/Components/Pages/DatabasePage/Subcomponents/MoviesFilterFormComponent.razor +++ b/WatchIt.Website/WatchIt.Website/Components/Pages/DatabasePage/Subcomponents/MoviesFilterFormComponent.razor @@ -1,4 +1,4 @@ -@inherits FilterFormComponent +@inherits WatchIt.Website.Components.Common.ListComponent.FilterFormComponent diff --git a/WatchIt.Website/WatchIt.Website/Components/Pages/DatabasePage/Subcomponents/PersonsFilterFormComponent.razor b/WatchIt.Website/WatchIt.Website/Components/Pages/DatabasePage/Subcomponents/PersonsFilterFormComponent.razor index 7f251bf..1979f14 100644 --- a/WatchIt.Website/WatchIt.Website/Components/Pages/DatabasePage/Subcomponents/PersonsFilterFormComponent.razor +++ b/WatchIt.Website/WatchIt.Website/Components/Pages/DatabasePage/Subcomponents/PersonsFilterFormComponent.razor @@ -1,5 +1,5 @@ @using WatchIt.Common.Model.Genders -@inherits FilterFormComponent +@inherits WatchIt.Website.Components.Common.ListComponent.FilterFormComponent diff --git a/WatchIt.Website/WatchIt.Website/Components/Pages/DatabasePage/Subcomponents/PersonsFilterFormComponent.razor.cs b/WatchIt.Website/WatchIt.Website/Components/Pages/DatabasePage/Subcomponents/PersonsFilterFormComponent.razor.cs index c57a68a..778fb2d 100644 --- a/WatchIt.Website/WatchIt.Website/Components/Pages/DatabasePage/Subcomponents/PersonsFilterFormComponent.razor.cs +++ b/WatchIt.Website/WatchIt.Website/Components/Pages/DatabasePage/Subcomponents/PersonsFilterFormComponent.razor.cs @@ -1,6 +1,7 @@ using Microsoft.AspNetCore.Components; using WatchIt.Common.Model.Genders; using WatchIt.Common.Model.Persons; +using WatchIt.Website.Components.Common.ListComponent; using WatchIt.Website.Services.Client.Genders; namespace WatchIt.Website.Components.Pages.DatabasePage.Subcomponents; diff --git a/WatchIt.Website/WatchIt.Website/Components/Pages/DatabasePage/Subcomponents/SeriesFilterFormComponent.razor b/WatchIt.Website/WatchIt.Website/Components/Pages/DatabasePage/Subcomponents/SeriesFilterFormComponent.razor index 1bad8cc..141a655 100644 --- a/WatchIt.Website/WatchIt.Website/Components/Pages/DatabasePage/Subcomponents/SeriesFilterFormComponent.razor +++ b/WatchIt.Website/WatchIt.Website/Components/Pages/DatabasePage/Subcomponents/SeriesFilterFormComponent.razor @@ -1,4 +1,4 @@ -@inherits FilterFormComponent +@inherits WatchIt.Website.Components.Common.ListComponent.FilterFormComponent
diff --git a/WatchIt.Website/WatchIt.Website/Components/Pages/UserPage/Subcomponents/MoviesRatedFilterFormComponent.razor b/WatchIt.Website/WatchIt.Website/Components/Pages/UserPage/Subcomponents/MoviesRatedFilterFormComponent.razor new file mode 100644 index 0000000..5712d5b --- /dev/null +++ b/WatchIt.Website/WatchIt.Website/Components/Pages/UserPage/Subcomponents/MoviesRatedFilterFormComponent.razor @@ -0,0 +1,74 @@ +@inherits WatchIt.Website.Components.Common.ListComponent.FilterFormComponent + + + + +
+
+
+ Title + +
+
+
+
+ Original title + +
+
+
+
+ Description + +
+
+
+
+ Release date + + - + +
+
+
+
+ Length + + - + +
+
+
+
+ Budget + + - + +
+
+
+
+ Rating (count) + + - + +
+
+
+
+ Rating (average) + + - + +
+
+
+
+ User rating + + - + +
+
+
+
\ No newline at end of file diff --git a/WatchIt.Website/WatchIt.Website/Components/Pages/UserPage/Subcomponents/SeriesRatedFilterFormComponent.razor b/WatchIt.Website/WatchIt.Website/Components/Pages/UserPage/Subcomponents/SeriesRatedFilterFormComponent.razor new file mode 100644 index 0000000..7c23456 --- /dev/null +++ b/WatchIt.Website/WatchIt.Website/Components/Pages/UserPage/Subcomponents/SeriesRatedFilterFormComponent.razor @@ -0,0 +1,77 @@ +@inherits WatchIt.Website.Components.Common.ListComponent.FilterFormComponent + + +
+
+
+ Title + +
+
+
+
+ Original title + +
+
+
+
+ Description + +
+
+
+
+ Release date + + - + +
+
+
+
+ Length + + - + +
+
+
+
+ Has ended +
+ + + + + + +
+
+
+
+
+ Rating (count) + + - + +
+
+
+
+ Rating (average) + + - + +
+
+
+
+ User rating + + - + +
+
+
+
\ No newline at end of file diff --git a/WatchIt.Website/WatchIt.Website/Layout/MainLayout.razor b/WatchIt.Website/WatchIt.Website/Layout/MainLayout.razor index ac67a74..5d34a04 100644 --- a/WatchIt.Website/WatchIt.Website/Layout/MainLayout.razor +++ b/WatchIt.Website/WatchIt.Website/Layout/MainLayout.razor @@ -79,7 +79,7 @@
-
+
@Body
diff --git a/WatchIt.Website/WatchIt.Website/Pages/DatabasePage.razor b/WatchIt.Website/WatchIt.Website/Pages/DatabasePage.razor index c1cbd6a..c5e6630 100644 --- a/WatchIt.Website/WatchIt.Website/Pages/DatabasePage.razor +++ b/WatchIt.Website/WatchIt.Website/Pages/DatabasePage.razor @@ -3,6 +3,7 @@ @using WatchIt.Common.Model.Series @using WatchIt.Website.Components.Pages.DatabasePage @using WatchIt.Website.Components.Pages.DatabasePage.Subcomponents +@using WatchIt.Website.Components.Common.ListComponent @page "/database/{type?}" @@ -30,78 +31,78 @@ @switch (Type) { case "movies": - + - + break; case "series": - + - + break; case "people": - + - + break; } \ No newline at end of file diff --git a/WatchIt.Website/WatchIt.Website/Pages/UserPage.razor b/WatchIt.Website/WatchIt.Website/Pages/UserPage.razor index 430ada9..cc72a42 100644 --- a/WatchIt.Website/WatchIt.Website/Pages/UserPage.razor +++ b/WatchIt.Website/WatchIt.Website/Pages/UserPage.razor @@ -1,5 +1,9 @@ @using System.Text +@using WatchIt.Common.Model.Movies +@using WatchIt.Common.Model.Series @using WatchIt.Website.Components.Pages.UserPage.Panels +@using WatchIt.Website.Components.Common.ListComponent +@using WatchIt.Website.Components.Pages.UserPage.Subcomponents @page "/user/{id:long?}" @@ -56,17 +60,59 @@ Movies TV Series People - Roles + Roles - +
+ + + +
- +
+ + + +
diff --git a/WatchIt.Website/WatchIt.Website/Pages/UserPage.razor.cs b/WatchIt.Website/WatchIt.Website/Pages/UserPage.razor.cs index 7685fa6..7a190ff 100644 --- a/WatchIt.Website/WatchIt.Website/Pages/UserPage.razor.cs +++ b/WatchIt.Website/WatchIt.Website/Pages/UserPage.razor.cs @@ -3,6 +3,7 @@ using WatchIt.Common.Model.Accounts; using WatchIt.Website.Layout; using WatchIt.Website.Services.Authentication; using WatchIt.Website.Services.Client.Accounts; +using WatchIt.Website.Services.Client.Media; namespace WatchIt.Website.Pages; @@ -13,6 +14,7 @@ public partial class UserPage : ComponentBase [Inject] private NavigationManager NavigationManager { get; set; } = default!; [Inject] private IAuthenticationService AuthenticationService { get; set; } = default!; [Inject] private IAccountsClientService AccountsClientService { get; set; } = default!; + [Inject] private IMediaClientService MediaClientService { get; set; } = default!; #endregion @@ -78,7 +80,7 @@ public partial class UserPage : ComponentBase Id = user.Id; } - await AccountsClientService.GetAccountInfoById(Id.Value, data => _accountData = data); + await AccountsClientService.GetAccountInfo(Id.Value, data => _accountData = data); _owner = Id.Value == user?.Id; } diff --git a/WatchIt.Website/WatchIt.Website/appsettings.json b/WatchIt.Website/WatchIt.Website/appsettings.json index 3613545..9116ddb 100644 --- a/WatchIt.Website/WatchIt.Website/appsettings.json +++ b/WatchIt.Website/WatchIt.Website/appsettings.json @@ -22,9 +22,10 @@ "AuthenticateRefresh": "/authenticate-refresh", "Logout": "/logout", "GetProfilePicture": "/{0}/profile-picture", - "GetAccountInfoById": "/{0}/info", - "GetAccountInfo": "/info", - "PutAccountInfo": "/info" + "GetAccountInfo": "/{0}/info", + "PutAccountInfo": "/info", + "GetAccountRatedMovies": "/{0}/movies", + "GetAccountRatedSeries": "/{0}/series" }, "Genders": { "Base": "/genders", From 1154cc547bf25c8204c0ba40a4e91f145d860d19 Mon Sep 17 00:00:00 2001 From: Mateusz Skoczek Date: Fri, 1 Nov 2024 20:44:01 +0100 Subject: [PATCH 07/20] Rated people panel added --- .../Media/MediaResponse.cs | 5 +- .../Movies/MovieRatedResponse.cs | 4 +- .../Movies/MovieResponse.cs | 4 +- .../Persons/PersonRatedQueryParameters.cs | 106 ++++++++++++++++++ .../Persons/PersonRatedResponse.cs | 63 +++++++++++ .../Persons/PersonResponse.cs | 6 +- .../Rating/RatingResponse.cs | 26 +---- .../Rating/RatingResponseBuilder.cs | 35 ++++++ .../Series/SeriesRatedResponse.cs | 4 +- .../Series/SeriesResponse.cs | 4 +- .../AccountsController.cs | 7 ++ .../AccountsControllerService.cs | 20 ++++ .../IAccountsControllerService.cs | 2 + .../MediaControllerService.cs | 4 +- .../PersonsControllerService.cs | 14 ++- .../RolesControllerService.cs | 8 +- .../Accounts/AccountsClientService.cs | 15 +++ .../Accounts/IAccountsClientService.cs | 2 + .../Model/Accounts.cs | 1 + .../Common/ListComponent/ListComponent.razor | 3 +- .../ListComponent/ListComponent.razor.cs | 3 +- .../Subcomponents/ListItemComponent.razor | 19 ++-- .../Subcomponents/ListItemComponent.razor.cs | 3 +- .../PersonsRatedFilterFormComponent.razor | 88 +++++++++++++++ .../PersonsRatedFilterFormComponent.razor.cs | 49 ++++++++ .../WatchIt.Website/Pages/UserPage.razor | 38 +++++-- .../WatchIt.Website/Pages/UserPage.razor.cs | 2 + .../WatchIt.Website/appsettings.json | 3 +- 28 files changed, 479 insertions(+), 59 deletions(-) create mode 100644 WatchIt.Common/WatchIt.Common.Model/Persons/PersonRatedQueryParameters.cs create mode 100644 WatchIt.Common/WatchIt.Common.Model/Persons/PersonRatedResponse.cs create mode 100644 WatchIt.Common/WatchIt.Common.Model/Rating/RatingResponseBuilder.cs create mode 100644 WatchIt.Website/WatchIt.Website/Components/Pages/UserPage/Subcomponents/PersonsRatedFilterFormComponent.razor create mode 100644 WatchIt.Website/WatchIt.Website/Components/Pages/UserPage/Subcomponents/PersonsRatedFilterFormComponent.razor.cs diff --git a/WatchIt.Common/WatchIt.Common.Model/Media/MediaResponse.cs b/WatchIt.Common/WatchIt.Common.Model/Media/MediaResponse.cs index 8a18de1..796c2b5 100644 --- a/WatchIt.Common/WatchIt.Common.Model/Media/MediaResponse.cs +++ b/WatchIt.Common/WatchIt.Common.Model/Media/MediaResponse.cs @@ -3,6 +3,7 @@ using System.Text.Json.Serialization; using WatchIt.Common.Model.Genres; using WatchIt.Common.Model.Rating; using WatchIt.Common.Query; +using WatchIt.Database.Model.Rating; namespace WatchIt.Common.Model.Media; @@ -55,7 +56,9 @@ public class MediaResponse : Media, IQueryOrderable ReleaseDate = media.ReleaseDate; Length = media.Length; Type = mediaType; - Rating = RatingResponse.Create(media.RatingMedia); + Rating = RatingResponseBuilder.Initialize() + .Add(media.RatingMedia, x => x.Rating) + .Build(); Genres = media.Genres.Select(x => new GenreResponse(x)).ToList(); } diff --git a/WatchIt.Common/WatchIt.Common.Model/Movies/MovieRatedResponse.cs b/WatchIt.Common/WatchIt.Common.Model/Movies/MovieRatedResponse.cs index 0e1bd31..b1d6db8 100644 --- a/WatchIt.Common/WatchIt.Common.Model/Movies/MovieRatedResponse.cs +++ b/WatchIt.Common/WatchIt.Common.Model/Movies/MovieRatedResponse.cs @@ -49,7 +49,9 @@ public class MovieRatedResponse : MovieResponse, IQueryOrderable x.Rating) + .Build(); Genres = mediaMovie.Media.Genres.Select(x => new GenreResponse(x)).ToList(); UserRating = response.Rating; } diff --git a/WatchIt.Common/WatchIt.Common.Model/Movies/MovieResponse.cs b/WatchIt.Common/WatchIt.Common.Model/Movies/MovieResponse.cs index 2e25288..a05e782 100644 --- a/WatchIt.Common/WatchIt.Common.Model/Movies/MovieResponse.cs +++ b/WatchIt.Common/WatchIt.Common.Model/Movies/MovieResponse.cs @@ -54,7 +54,9 @@ public class MovieResponse : Movie, IQueryOrderable ReleaseDate = mediaMovie.Media.ReleaseDate; Length = mediaMovie.Media.Length; Budget = mediaMovie.Budget; - Rating = RatingResponse.Create(mediaMovie.Media.RatingMedia); + Rating = RatingResponseBuilder.Initialize() + .Add(mediaMovie.Media.RatingMedia, x => x.Rating) + .Build(); Genres = mediaMovie.Media.Genres.Select(x => new GenreResponse(x)).ToList(); } diff --git a/WatchIt.Common/WatchIt.Common.Model/Persons/PersonRatedQueryParameters.cs b/WatchIt.Common/WatchIt.Common.Model/Persons/PersonRatedQueryParameters.cs new file mode 100644 index 0000000..a31d5d4 --- /dev/null +++ b/WatchIt.Common/WatchIt.Common.Model/Persons/PersonRatedQueryParameters.cs @@ -0,0 +1,106 @@ +using Microsoft.AspNetCore.Mvc; +using WatchIt.Common.Query; + +namespace WatchIt.Common.Model.Persons; + +public class PersonRatedQueryParameters : QueryParameters +{ + #region PROPERTIES + + [FromQuery(Name = "name")] + public string? Name { get; set; } + + [FromQuery(Name = "full_name")] + public string? FullName { get; set; } + + [FromQuery(Name = "description")] + public string? Description { get; set; } + + [FromQuery(Name = "birth_date")] + public DateOnly? BirthDate { get; set; } + + [FromQuery(Name = "birth_date_from")] + public DateOnly? BirthDateFrom { get; set; } + + [FromQuery(Name = "birth_date_to")] + public DateOnly? BirthDateTo { get; set; } + + [FromQuery(Name = "death_date")] + public DateOnly? DeathDate { get; set; } + + [FromQuery(Name = "death_date_from")] + public DateOnly? DeathDateFrom { get; set; } + + [FromQuery(Name = "death_date_to")] + public DateOnly? DeathDateTo { get; set; } + + [FromQuery(Name = "gender_id")] + public short? GenderId { get; set; } + + [FromQuery(Name = "rating_average")] + public decimal? RatingAverage { get; set; } + + [FromQuery(Name = "rating_average_from")] + public decimal? RatingAverageFrom { get; set; } + + [FromQuery(Name = "rating_average_to")] + public decimal? RatingAverageTo { get; set; } + + [FromQuery(Name = "rating_count")] + public long? RatingCount { get; set; } + + [FromQuery(Name = "rating_count_from")] + public long? RatingCountFrom { get; set; } + + [FromQuery(Name = "rating_count_to")] + public long? RatingCountTo { get; set; } + + [FromQuery(Name = "user_rating_average")] + public decimal? UserRatingAverage { get; set; } + + [FromQuery(Name = "user_rating_average_from")] + public decimal? UserRatingAverageFrom { get; set; } + + [FromQuery(Name = "user_rating_average_to")] + public decimal? UserRatingAverageTo { get; set; } + + [FromQuery(Name = "user_rating_count")] + public long? UserRatingCount { get; set; } + + [FromQuery(Name = "user_rating_count_from")] + public long? UserRatingCountFrom { get; set; } + + [FromQuery(Name = "user_rating_count_to")] + public long? UserRatingCountTo { get; set; } + + #endregion + + + + #region PUBLIC METHODS + + protected override bool IsMeetingConditions(PersonRatedResponse item) => + ( + TestStringWithRegex(item.Name, Name) + && + TestStringWithRegex(item.FullName, FullName) + && + TestStringWithRegex(item.Description, Description) + && + TestComparable(item.BirthDate, BirthDate, BirthDateFrom, BirthDateTo) + && + TestComparable(item.DeathDate, DeathDate, DeathDateFrom, DeathDateTo) + && + Test(item.Gender?.Id, GenderId) + && + TestComparable(item.Rating.Average, RatingAverage, RatingAverageFrom, RatingAverageTo) + && + TestComparable(item.Rating.Count, RatingCount, RatingCountFrom, RatingCountTo) + && + TestComparable(item.UserRating.Average, UserRatingAverage, UserRatingAverageFrom, UserRatingAverageTo) + && + TestComparable(item.UserRating.Count, UserRatingCount, UserRatingCountFrom, UserRatingCountTo) + ); + + #endregion +} \ No newline at end of file diff --git a/WatchIt.Common/WatchIt.Common.Model/Persons/PersonRatedResponse.cs b/WatchIt.Common/WatchIt.Common.Model/Persons/PersonRatedResponse.cs new file mode 100644 index 0000000..fa61b37 --- /dev/null +++ b/WatchIt.Common/WatchIt.Common.Model/Persons/PersonRatedResponse.cs @@ -0,0 +1,63 @@ +using System.Diagnostics.CodeAnalysis; +using System.Text.Json.Serialization; +using WatchIt.Common.Model.Genders; +using WatchIt.Common.Model.Rating; +using WatchIt.Common.Query; +using WatchIt.Database.Model.Rating; + +namespace WatchIt.Common.Model.Persons; + +public class PersonRatedResponse : PersonResponse, IQueryOrderable +{ + #region PROPERTIES + + [JsonIgnore] + public static IDictionary> OrderableProperties { get; } = new Dictionary> + { + { "id", x => x.Id }, + { "name", x => x.Name }, + { "full_name", x => x.FullName }, + { "description", x => x.Description }, + { "birth_date", x => x.BirthDate }, + { "death_date", x => x.BirthDate }, + { "gender", x => x.Gender.Name }, + { "rating.average", x => x.Rating.Average }, + { "rating.count", x => x.Rating.Count }, + { "user_rating.average", x => x.UserRating.Average }, + { "user_rating.count", x => x.UserRating.Count } + }; + + [JsonPropertyName("user_rating")] + public RatingResponse UserRating { get; set; } + + #endregion + + + + #region CONSTRUCTORS + + [JsonConstructor] + public PersonRatedResponse() { } + + [SetsRequiredMembers] + public PersonRatedResponse(Database.Model.Person.Person person, IEnumerable actorUserRatings, IEnumerable creatorUserRatings) + { + Id = person.Id; + Name = person.Name; + FullName = person.FullName; + Description = person.Description; + BirthDate = person.BirthDate; + DeathDate = person.DeathDate; + Gender = person.Gender is not null ? new GenderResponse(person.Gender) : null; + Rating = RatingResponseBuilder.Initialize() + .Add(person.PersonActorRoles.SelectMany(x => x.RatingPersonActorRole), x => x.Rating) + .Add(person.PersonCreatorRoles.SelectMany(x => x.RatingPersonCreatorRole), x => x.Rating) + .Build(); + UserRating = RatingResponseBuilder.Initialize() + .Add(actorUserRatings, x => x.Rating) + .Add(creatorUserRatings, x => x.Rating) + .Build(); + } + + #endregion +} \ No newline at end of file diff --git a/WatchIt.Common/WatchIt.Common.Model/Persons/PersonResponse.cs b/WatchIt.Common/WatchIt.Common.Model/Persons/PersonResponse.cs index a81e5ab..1b3a264 100644 --- a/WatchIt.Common/WatchIt.Common.Model/Persons/PersonResponse.cs +++ b/WatchIt.Common/WatchIt.Common.Model/Persons/PersonResponse.cs @@ -3,6 +3,7 @@ using System.Text.Json.Serialization; using WatchIt.Common.Model.Genders; using WatchIt.Common.Model.Rating; using WatchIt.Common.Query; +using WatchIt.Database.Model.Rating; namespace WatchIt.Common.Model.Persons; @@ -53,7 +54,10 @@ public class PersonResponse : Person, IQueryOrderable BirthDate = person.BirthDate; DeathDate = person.DeathDate; Gender = person.Gender is not null ? new GenderResponse(person.Gender) : null; - Rating = RatingResponse.Create(person.PersonActorRoles, person.PersonCreatorRoles); + Rating = RatingResponseBuilder.Initialize() + .Add(person.PersonActorRoles.SelectMany(x => x.RatingPersonActorRole), x => x.Rating) + .Add(person.PersonCreatorRoles.SelectMany(x => x.RatingPersonCreatorRole), x => x.Rating) + .Build(); } #endregion diff --git a/WatchIt.Common/WatchIt.Common.Model/Rating/RatingResponse.cs b/WatchIt.Common/WatchIt.Common.Model/Rating/RatingResponse.cs index 9037814..483f298 100644 --- a/WatchIt.Common/WatchIt.Common.Model/Rating/RatingResponse.cs +++ b/WatchIt.Common/WatchIt.Common.Model/Rating/RatingResponse.cs @@ -25,35 +25,11 @@ public class RatingResponse public RatingResponse() {} [SetsRequiredMembers] - private RatingResponse(long ratingSum, long ratingCount) + internal RatingResponse(long ratingSum, long ratingCount) { Average = ratingCount > 0 ? (decimal)ratingSum / ratingCount : 0; Count = ratingCount; } - public static RatingResponse Create(long ratingSum, long ratingCount) => new RatingResponse(ratingSum, ratingCount); - - public static RatingResponse Create(IEnumerable ratingMedia) => Create(ratingMedia, x => x.Rating); - - public static RatingResponse Create(IEnumerable ratingPersonActorRoles) => Create(ratingPersonActorRoles, x => x.Rating); - - public static RatingResponse Create(IEnumerable ratingPersonCreatorRoles) => Create(ratingPersonCreatorRoles, x => x.Rating); - - public static RatingResponse Create(IEnumerable ratingList, Func ratingSelector) => new RatingResponse(ratingList.Sum(x => ratingSelector(x)), ratingList.Count()); - - public static RatingResponse Create(IEnumerable personActorRoles, IEnumerable personCreatorRoles) - { - IEnumerable ratingsActorRoles = personActorRoles.SelectMany(x => x.RatingPersonActorRole); - IEnumerable ratingsCreatorRoles = personCreatorRoles.SelectMany(x => x.RatingPersonCreatorRole); - return Create(ratingsActorRoles, ratingsCreatorRoles); - } - - public static RatingResponse Create(IEnumerable ratingsActorRoles, IEnumerable ratingsCreatorRoles) - { - long ratingSum = ratingsActorRoles.Sum(x => x.Rating) + ratingsCreatorRoles.Sum(x => x.Rating); - long ratingCount = ratingsActorRoles.Count() + ratingsCreatorRoles.Count(); - return new RatingResponse(ratingSum, ratingCount); - } - #endregion } \ No newline at end of file diff --git a/WatchIt.Common/WatchIt.Common.Model/Rating/RatingResponseBuilder.cs b/WatchIt.Common/WatchIt.Common.Model/Rating/RatingResponseBuilder.cs new file mode 100644 index 0000000..d53b4df --- /dev/null +++ b/WatchIt.Common/WatchIt.Common.Model/Rating/RatingResponseBuilder.cs @@ -0,0 +1,35 @@ +namespace WatchIt.Common.Model.Rating; + +public class RatingResponseBuilder +{ + #region FIELDS + + private long _sum; + private long _count; + + #endregion + + + + #region CONSTRUCTORS + + private RatingResponseBuilder() { } + + public static RatingResponseBuilder Initialize() => new RatingResponseBuilder(); + + #endregion + + + + #region PUBLIC METHODS + + public RatingResponseBuilder Add(IEnumerable collection, Func selector) + { + _sum += collection.Sum(x => selector(x)); + _count += collection.Count(); + return this; + } + public RatingResponse Build() => new RatingResponse(_sum, _count); + + #endregion +} \ No newline at end of file diff --git a/WatchIt.Common/WatchIt.Common.Model/Series/SeriesRatedResponse.cs b/WatchIt.Common/WatchIt.Common.Model/Series/SeriesRatedResponse.cs index 2e47804..0cf7996 100644 --- a/WatchIt.Common/WatchIt.Common.Model/Series/SeriesRatedResponse.cs +++ b/WatchIt.Common/WatchIt.Common.Model/Series/SeriesRatedResponse.cs @@ -49,7 +49,9 @@ public class SeriesRatedResponse : SeriesResponse, IQueryOrderable x.Rating) + .Build(); Genres = mediaSeries.Media.Genres.Select(x => new GenreResponse(x)).ToList(); UserRating = response.Rating; } diff --git a/WatchIt.Common/WatchIt.Common.Model/Series/SeriesResponse.cs b/WatchIt.Common/WatchIt.Common.Model/Series/SeriesResponse.cs index 17a0f9d..7f1c1e3 100644 --- a/WatchIt.Common/WatchIt.Common.Model/Series/SeriesResponse.cs +++ b/WatchIt.Common/WatchIt.Common.Model/Series/SeriesResponse.cs @@ -54,7 +54,9 @@ public class SeriesResponse : Series, IQueryOrderable ReleaseDate = mediaSeries.Media.ReleaseDate; Length = mediaSeries.Media.Length; HasEnded = mediaSeries.HasEnded; - Rating = RatingResponse.Create(mediaSeries.Media.RatingMedia); + Rating = RatingResponseBuilder.Initialize() + .Add(mediaSeries.Media.RatingMedia, x => x.Rating) + .Build(); Genres = mediaSeries.Media.Genres.Select(x => new GenreResponse(x)).ToList(); } diff --git a/WatchIt.WebAPI/WatchIt.WebAPI.Controllers/AccountsController.cs b/WatchIt.WebAPI/WatchIt.WebAPI.Controllers/AccountsController.cs index 1fceee4..3bcb30d 100644 --- a/WatchIt.WebAPI/WatchIt.WebAPI.Controllers/AccountsController.cs +++ b/WatchIt.WebAPI/WatchIt.WebAPI.Controllers/AccountsController.cs @@ -4,6 +4,7 @@ using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using WatchIt.Common.Model.Accounts; using WatchIt.Common.Model.Movies; +using WatchIt.Common.Model.Persons; using WatchIt.Common.Model.Series; using WatchIt.WebAPI.Services.Controllers.Accounts; @@ -69,4 +70,10 @@ public class AccountsController(IAccountsControllerService accountsControllerSer [ProducesResponseType(typeof(IEnumerable), StatusCodes.Status200OK)] [ProducesResponseType(StatusCodes.Status404NotFound)] public async Task GetAccountRatedSeries([FromRoute]long id, SeriesRatedQueryParameters query) => await accountsControllerService.GetAccountRatedSeries(id, query); + + [HttpGet("{id}/persons")] + [AllowAnonymous] + [ProducesResponseType(typeof(IEnumerable), StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status404NotFound)] + public async Task GetAccountRatedPersons([FromRoute]long id, PersonRatedQueryParameters query) => await accountsControllerService.GetAccountRatedPersons(id, query); } \ No newline at end of file diff --git a/WatchIt.WebAPI/WatchIt.WebAPI.Services/WatchIt.WebAPI.Services.Controllers/WatchIt.WebAPI.Services.Controllers.Accounts/AccountsControllerService.cs b/WatchIt.WebAPI/WatchIt.WebAPI.Services/WatchIt.WebAPI.Services.Controllers/WatchIt.WebAPI.Services.Controllers.Accounts/AccountsControllerService.cs index f49a9be..a4151d7 100644 --- a/WatchIt.WebAPI/WatchIt.WebAPI.Services/WatchIt.WebAPI.Services.Controllers/WatchIt.WebAPI.Services.Controllers.Accounts/AccountsControllerService.cs +++ b/WatchIt.WebAPI/WatchIt.WebAPI.Services/WatchIt.WebAPI.Services.Controllers/WatchIt.WebAPI.Services.Controllers.Accounts/AccountsControllerService.cs @@ -7,6 +7,7 @@ using SimpleToolkit.Extensions; using WatchIt.Common.Model.Accounts; using WatchIt.Common.Model.Media; using WatchIt.Common.Model.Movies; +using WatchIt.Common.Model.Persons; using WatchIt.Common.Model.Series; using WatchIt.Database; using WatchIt.Database.Model.Account; @@ -18,6 +19,7 @@ using WatchIt.WebAPI.Services.Utility.Tokens.Exceptions; using WatchIt.WebAPI.Services.Utility.User; using Account = WatchIt.Database.Model.Account.Account; using AccountProfilePicture = WatchIt.Common.Model.Accounts.AccountProfilePicture; +using Person = WatchIt.Database.Model.Person.Person; namespace WatchIt.WebAPI.Services.Controllers.Accounts; @@ -190,6 +192,24 @@ public class AccountsControllerService( response = query.PrepareData(response); return RequestResult.Ok(response); } + + public async Task GetAccountRatedPersons(long id, PersonRatedQueryParameters query) + { + Account? account = await database.Accounts.FirstOrDefaultAsync(x => x.Id == id); + if (account is null) + { + return RequestResult.NotFound(); + } + + IEnumerable actorRolesRatings = account.RatingPersonActorRole; + IEnumerable creatorRolesRatings = account.RatingPersonCreatorRole; + IEnumerable persons = actorRolesRatings.Select(x => x.PersonActorRole.Person) + .Union(creatorRolesRatings.Select(x => x.PersonCreatorRole.Person)); + + IEnumerable response = persons.Select(x => new PersonRatedResponse(x, actorRolesRatings.Where(y => y.PersonActorRole.Person.Id == x.Id), creatorRolesRatings.Where(y => y.PersonCreatorRole.Person.Id == x.Id))); + response = query.PrepareData(response); + return RequestResult.Ok(response); + } #endregion diff --git a/WatchIt.WebAPI/WatchIt.WebAPI.Services/WatchIt.WebAPI.Services.Controllers/WatchIt.WebAPI.Services.Controllers.Accounts/IAccountsControllerService.cs b/WatchIt.WebAPI/WatchIt.WebAPI.Services/WatchIt.WebAPI.Services.Controllers/WatchIt.WebAPI.Services.Controllers.Accounts/IAccountsControllerService.cs index 5ce20dd..500b256 100644 --- a/WatchIt.WebAPI/WatchIt.WebAPI.Services/WatchIt.WebAPI.Services.Controllers/WatchIt.WebAPI.Services.Controllers.Accounts/IAccountsControllerService.cs +++ b/WatchIt.WebAPI/WatchIt.WebAPI.Services/WatchIt.WebAPI.Services.Controllers/WatchIt.WebAPI.Services.Controllers.Accounts/IAccountsControllerService.cs @@ -1,6 +1,7 @@ using WatchIt.Common.Model.Accounts; using WatchIt.Common.Model.Media; using WatchIt.Common.Model.Movies; +using WatchIt.Common.Model.Persons; using WatchIt.Common.Model.Series; using WatchIt.WebAPI.Services.Controllers.Common; @@ -17,4 +18,5 @@ public interface IAccountsControllerService Task PutAccountInfo(AccountRequest data); Task GetAccountRatedMovies(long id, MovieRatedQueryParameters query); Task GetAccountRatedSeries(long id, SeriesRatedQueryParameters query); + Task GetAccountRatedPersons(long id, PersonRatedQueryParameters query); } \ No newline at end of file diff --git a/WatchIt.WebAPI/WatchIt.WebAPI.Services/WatchIt.WebAPI.Services.Controllers/WatchIt.WebAPI.Services.Controllers.Media/MediaControllerService.cs b/WatchIt.WebAPI/WatchIt.WebAPI.Services/WatchIt.WebAPI.Services.Controllers/WatchIt.WebAPI.Services.Controllers.Media/MediaControllerService.cs index 46bde20..ac92c5f 100644 --- a/WatchIt.WebAPI/WatchIt.WebAPI.Services/WatchIt.WebAPI.Services.Controllers/WatchIt.WebAPI.Services.Controllers.Media/MediaControllerService.cs +++ b/WatchIt.WebAPI/WatchIt.WebAPI.Services/WatchIt.WebAPI.Services.Controllers/WatchIt.WebAPI.Services.Controllers.Media/MediaControllerService.cs @@ -118,7 +118,9 @@ public class MediaControllerService(DatabaseContext database, IUserService userS return RequestResult.NotFound(); } - RatingResponse ratingResponse = RatingResponse.Create(item.RatingMedia); + RatingResponse ratingResponse = RatingResponseBuilder.Initialize() + .Add(item.RatingMedia, x => x.Rating) + .Build(); return RequestResult.Ok(ratingResponse); } diff --git a/WatchIt.WebAPI/WatchIt.WebAPI.Services/WatchIt.WebAPI.Services.Controllers/WatchIt.WebAPI.Services.Controllers.Persons/PersonsControllerService.cs b/WatchIt.WebAPI/WatchIt.WebAPI.Services/WatchIt.WebAPI.Services.Controllers/WatchIt.WebAPI.Services.Controllers.Persons/PersonsControllerService.cs index 3a80110..a8857aa 100644 --- a/WatchIt.WebAPI/WatchIt.WebAPI.Services/WatchIt.WebAPI.Services.Controllers/WatchIt.WebAPI.Services.Controllers.Persons/PersonsControllerService.cs +++ b/WatchIt.WebAPI/WatchIt.WebAPI.Services/WatchIt.WebAPI.Services.Controllers/WatchIt.WebAPI.Services.Controllers.Persons/PersonsControllerService.cs @@ -335,7 +335,10 @@ public class PersonsControllerService : IPersonsControllerService return RequestResult.NotFound(); } - RatingResponse ratingResponse = RatingResponse.Create(item.PersonActorRoles, item.PersonCreatorRoles); + RatingResponse ratingResponse = RatingResponseBuilder.Initialize() + .Add(item.PersonActorRoles.SelectMany(x => x.RatingPersonActorRole), x => x.Rating) + .Add(item.PersonCreatorRoles.SelectMany(x => x.RatingPersonCreatorRole), x => x.Rating) + .Build(); return RequestResult.Ok(ratingResponse); } @@ -347,10 +350,11 @@ public class PersonsControllerService : IPersonsControllerService { return RequestResult.NotFound(); } - - IEnumerable actorRoleRatings = item.PersonActorRoles.SelectMany(x => x.RatingPersonActorRole).Where(x => x.AccountId == userId); - IEnumerable creatorRoleRatings = item.PersonCreatorRoles.SelectMany(x => x.RatingPersonCreatorRole).Where(x => x.AccountId == userId); - RatingResponse ratingResponse = RatingResponse.Create(actorRoleRatings, creatorRoleRatings); + + RatingResponse ratingResponse = RatingResponseBuilder.Initialize() + .Add(item.PersonActorRoles.SelectMany(x => x.RatingPersonActorRole).Where(x => x.AccountId == userId), x => x.Rating) + .Add(item.PersonCreatorRoles.SelectMany(x => x.RatingPersonCreatorRole).Where(x => x.AccountId == userId), x => x.Rating) + .Build(); return RequestResult.Ok(ratingResponse); } diff --git a/WatchIt.WebAPI/WatchIt.WebAPI.Services/WatchIt.WebAPI.Services.Controllers/WatchIt.WebAPI.Services.Controllers.Roles/RolesControllerService.cs b/WatchIt.WebAPI/WatchIt.WebAPI.Services/WatchIt.WebAPI.Services.Controllers/WatchIt.WebAPI.Services.Controllers.Roles/RolesControllerService.cs index d9d88c2..b86b622 100644 --- a/WatchIt.WebAPI/WatchIt.WebAPI.Services/WatchIt.WebAPI.Services.Controllers/WatchIt.WebAPI.Services.Controllers.Roles/RolesControllerService.cs +++ b/WatchIt.WebAPI/WatchIt.WebAPI.Services/WatchIt.WebAPI.Services.Controllers/WatchIt.WebAPI.Services.Controllers.Roles/RolesControllerService.cs @@ -97,7 +97,9 @@ public class RolesControllerService : IRolesControllerService return RequestResult.NotFound(); } - RatingResponse ratingResponse = RatingResponse.Create(item.RatingPersonActorRole); + RatingResponse ratingResponse = RatingResponseBuilder.Initialize() + .Add(item.RatingPersonActorRole, x => x.Rating) + .Build(); return RequestResult.Ok(ratingResponse); } @@ -281,7 +283,9 @@ public class RolesControllerService : IRolesControllerService return RequestResult.NotFound(); } - RatingResponse ratingResponse = RatingResponse.Create(item.RatingPersonCreatorRole); + RatingResponse ratingResponse = RatingResponseBuilder.Initialize() + .Add(item.RatingPersonCreatorRole, x => x.Rating) + .Build(); return RequestResult.Ok(ratingResponse); } diff --git a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/Accounts/AccountsClientService.cs b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/Accounts/AccountsClientService.cs index d71bb0f..c246c03 100644 --- a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/Accounts/AccountsClientService.cs +++ b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/Accounts/AccountsClientService.cs @@ -1,5 +1,6 @@ using WatchIt.Common.Model.Accounts; using WatchIt.Common.Model.Movies; +using WatchIt.Common.Model.Persons; using WatchIt.Common.Model.Series; using WatchIt.Common.Services.HttpClient; using WatchIt.Website.Services.Configuration; @@ -135,6 +136,20 @@ public class AccountsClientService(IHttpClientService httpClientService, IConfig .ExecuteAction(); } + public async Task GetAccountRatedPersons(long id, PersonRatedQueryParameters query, Action>? successAction = null, Action? notFoundAction = null) + { + string url = GetUrl(EndpointsConfiguration.Accounts.GetAccountRatedPersons, id); + HttpRequest request = new HttpRequest(HttpMethodType.Get, url) + { + Query = query + }; + + HttpResponse response = await httpClientService.SendRequestAsync(request); + response.RegisterActionFor2XXSuccess(successAction) + .RegisterActionFor404NotFound(notFoundAction) + .ExecuteAction(); + } + #endregion diff --git a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/Accounts/IAccountsClientService.cs b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/Accounts/IAccountsClientService.cs index 7a2b0d7..6f16640 100644 --- a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/Accounts/IAccountsClientService.cs +++ b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/Accounts/IAccountsClientService.cs @@ -1,5 +1,6 @@ using WatchIt.Common.Model.Accounts; using WatchIt.Common.Model.Movies; +using WatchIt.Common.Model.Persons; using WatchIt.Common.Model.Series; namespace WatchIt.Website.Services.Client.Accounts; @@ -15,4 +16,5 @@ public interface IAccountsClientService Task PutAccountInfo(AccountRequest data, Action? successAction = null, Action>? badRequestAction = null, Action? unauthorizedAction = null, Action? notFoundAction = null); Task GetAccountRatedMovies(long id, MovieRatedQueryParameters query, Action>? successAction = null, Action? notFoundAction = null); Task GetAccountRatedSeries(long id, SeriesRatedQueryParameters query, Action>? successAction = null, Action? notFoundAction = null); + Task GetAccountRatedPersons(long id, PersonRatedQueryParameters query, Action>? successAction = null, Action? notFoundAction = null); } \ No newline at end of file diff --git a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Configuration/Model/Accounts.cs b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Configuration/Model/Accounts.cs index 9487bce..5731d34 100644 --- a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Configuration/Model/Accounts.cs +++ b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Configuration/Model/Accounts.cs @@ -12,4 +12,5 @@ public class Accounts public string PutAccountInfo { get; set; } public string GetAccountRatedMovies { get; set; } public string GetAccountRatedSeries { get; set; } + public string GetAccountRatedPersons { get; set; } } \ No newline at end of file diff --git a/WatchIt.Website/WatchIt.Website/Components/Common/ListComponent/ListComponent.razor b/WatchIt.Website/WatchIt.Website/Components/Common/ListComponent/ListComponent.razor index fa20d1a..6b614f6 100644 --- a/WatchIt.Website/WatchIt.Website/Components/Common/ListComponent/ListComponent.razor +++ b/WatchIt.Website/WatchIt.Website/Components/Common/ListComponent/ListComponent.razor @@ -60,7 +60,8 @@ PosterPlaceholder="@(PosterPlaceholder)" PosterDownloadingTask="@(action => PictureDownloadingTask(id, action))" GlobalRating="@(RatingSource(item))" - SecondaryRating="@(SecondaryRatingSource?.Invoke(item))" + SecondaryRatingSingle="@(SecondaryRatingSingleSource?.Invoke(item))" + SecondaryRatingMultiple="@(SecondaryRatingMultipleSource?.Invoke(item))" SecondaryRatingTitle="@(SecondaryRatingTitle)" GetGlobalRatingMethod="@(action => GetGlobalRatingMethod(id, action))" GetUserRatingMethod="@(GetUserRatingMethod is not null ? (user, actionSuccess, actionNotFound) => GetUserRatingMethod(id, user, actionSuccess, actionNotFound) : null)" diff --git a/WatchIt.Website/WatchIt.Website/Components/Common/ListComponent/ListComponent.razor.cs b/WatchIt.Website/WatchIt.Website/Components/Common/ListComponent/ListComponent.razor.cs index ce6093d..5591ee6 100644 --- a/WatchIt.Website/WatchIt.Website/Components/Common/ListComponent/ListComponent.razor.cs +++ b/WatchIt.Website/WatchIt.Website/Components/Common/ListComponent/ListComponent.razor.cs @@ -23,7 +23,8 @@ public partial class ListComponent : ComponentBase where TItem : [Parameter] public required Func NameSource { get; set; } [Parameter] public Func AdditionalNameInfoSource { get; set; } = _ => null; [Parameter] public required Func RatingSource { get; set; } - [Parameter] public Func? SecondaryRatingSource { get; set; } + [Parameter] public Func? SecondaryRatingSingleSource { get; set; } + [Parameter] public Func? SecondaryRatingMultipleSource { get; set; } [Parameter] public string? SecondaryRatingTitle { get; set; } [Parameter] public required string UrlIdTemplate { get; set; } [Parameter] public required Func, Task> PictureDownloadingTask { get; set; } diff --git a/WatchIt.Website/WatchIt.Website/Components/Common/Subcomponents/ListItemComponent.razor b/WatchIt.Website/WatchIt.Website/Components/Common/Subcomponents/ListItemComponent.razor index b87ecbd..1832c07 100644 --- a/WatchIt.Website/WatchIt.Website/Components/Common/Subcomponents/ListItemComponent.razor +++ b/WatchIt.Website/WatchIt.Website/Components/Common/Subcomponents/ListItemComponent.razor @@ -18,7 +18,7 @@ Global rating: - @if (SecondaryRating is not null) + @if (SecondaryRatingSingle is not null || SecondaryRatingMultiple is not null) { @(SecondaryRatingTitle): @@ -39,10 +39,11 @@ EmptyMode="DisplayRatingComponent.DisplayRatingComponentEmptyMode.DoubleDash" Scale="0.85"/> - @if (SecondaryRating is not null) + @if (SecondaryRatingSingle is not null || SecondaryRatingMultiple is not null) { - @@ -53,18 +54,18 @@
@if (_user is null) { - You must be logged in to rate + You must be logged in to rate } else if (!_userRatingLoaded) { -
- - Loading... -
+
+ + Loading... +
} else { - + }
diff --git a/WatchIt.Website/WatchIt.Website/Components/Common/Subcomponents/ListItemComponent.razor.cs b/WatchIt.Website/WatchIt.Website/Components/Common/Subcomponents/ListItemComponent.razor.cs index 4189a8e..373ebd2 100644 --- a/WatchIt.Website/WatchIt.Website/Components/Common/Subcomponents/ListItemComponent.razor.cs +++ b/WatchIt.Website/WatchIt.Website/Components/Common/Subcomponents/ListItemComponent.razor.cs @@ -27,7 +27,8 @@ public partial class ListItemComponent : ComponentBase [Parameter] public required Func, Task> PosterDownloadingTask { get; set; } [Parameter] public RatingResponse? GlobalRating { get; set; } - [Parameter] public short? SecondaryRating { get; set; } + [Parameter] public short? SecondaryRatingSingle { get; set; } + [Parameter] public RatingResponse? SecondaryRatingMultiple { get; set; } [Parameter] public string? SecondaryRatingTitle { get; set; } [Parameter] public required Func, Task> GetGlobalRatingMethod { get; set; } [Parameter] public Func, Action, Task>? GetUserRatingMethod { get; set; } diff --git a/WatchIt.Website/WatchIt.Website/Components/Pages/UserPage/Subcomponents/PersonsRatedFilterFormComponent.razor b/WatchIt.Website/WatchIt.Website/Components/Pages/UserPage/Subcomponents/PersonsRatedFilterFormComponent.razor new file mode 100644 index 0000000..9b59149 --- /dev/null +++ b/WatchIt.Website/WatchIt.Website/Components/Pages/UserPage/Subcomponents/PersonsRatedFilterFormComponent.razor @@ -0,0 +1,88 @@ +@using WatchIt.Common.Model.Genders + +@inherits WatchIt.Website.Components.Common.ListComponent.FilterFormComponent + + + + +
+
+
+ Name + +
+
+
+
+ Full name + +
+
+
+
+ Description + +
+
+
+
+ Birth date + + - + +
+
+
+
+ Death date + + - + +
+
+
+
+ Gender + + + @foreach (GenderResponse gender in _genders) + { + + } + +
+
+
+
+ Rating (count) + + - + +
+
+
+
+ Rating (average) + + - + +
+
+
+
+ User rating (count) + + - + +
+
+
+
+ User rating (average) + + - + +
+
+
+
\ No newline at end of file diff --git a/WatchIt.Website/WatchIt.Website/Components/Pages/UserPage/Subcomponents/PersonsRatedFilterFormComponent.razor.cs b/WatchIt.Website/WatchIt.Website/Components/Pages/UserPage/Subcomponents/PersonsRatedFilterFormComponent.razor.cs new file mode 100644 index 0000000..5f38b2f --- /dev/null +++ b/WatchIt.Website/WatchIt.Website/Components/Pages/UserPage/Subcomponents/PersonsRatedFilterFormComponent.razor.cs @@ -0,0 +1,49 @@ +using Microsoft.AspNetCore.Components; +using WatchIt.Common.Model.Genders; +using WatchIt.Common.Model.Persons; +using WatchIt.Website.Components.Common.ListComponent; +using WatchIt.Website.Services.Client.Genders; + +namespace WatchIt.Website.Components.Pages.UserPage.Subcomponents; + +public partial class PersonsRatedFilterFormComponent : FilterFormComponent +{ + #region SERVICES + + [Inject] private IGendersClientService GendersClientService { get; set; } = default!; + + #endregion + + + + #region FIELDS + + private IEnumerable _genders = []; + + #endregion + + + + #region PRIVATE METHODS + + protected override async Task OnAfterRenderAsync(bool firstRender) + { + if (firstRender) + { + List endTasks = new List(); + + // STEP 0 + endTasks.AddRange( + [ + GendersClientService.GetAllGenders(successAction: data => _genders = data) + ]); + + // END + await Task.WhenAll(endTasks); + + StateHasChanged(); + } + } + + #endregion +} \ No newline at end of file diff --git a/WatchIt.Website/WatchIt.Website/Pages/UserPage.razor b/WatchIt.Website/WatchIt.Website/Pages/UserPage.razor index cc72a42..06cde8a 100644 --- a/WatchIt.Website/WatchIt.Website/Pages/UserPage.razor +++ b/WatchIt.Website/WatchIt.Website/Pages/UserPage.razor @@ -1,9 +1,11 @@ @using System.Text @using WatchIt.Common.Model.Movies +@using WatchIt.Common.Model.Persons @using WatchIt.Common.Model.Series @using WatchIt.Website.Components.Pages.UserPage.Panels @using WatchIt.Website.Components.Common.ListComponent @using WatchIt.Website.Components.Pages.UserPage.Subcomponents +@using WatchIt.Website.Services.Client.Persons @page "/user/{id:long?}" @@ -60,7 +62,6 @@ Movies TV Series People - Roles @@ -75,7 +76,7 @@ NameSource="@(item => item.Title)" AdditionalNameInfoSource="@(item => item.ReleaseDate.HasValue ? $" ({item.ReleaseDate.Value.Year})" : null)" RatingSource="@(item => item.Rating)" - SecondaryRatingSource="@(item => _owner ? null : item.UserRating)" + SecondaryRatingSingleSource="@(item => _owner ? null : item.UserRating)" SecondaryRatingTitle="User rating" UrlIdTemplate="/media/{0}" PictureDownloadingTask="@((id, action) => MediaClientService.GetMediaPoster(id, action))" @@ -99,7 +100,7 @@ NameSource="@(item => item.Title)" AdditionalNameInfoSource="@(item => item.ReleaseDate.HasValue ? $" ({item.ReleaseDate.Value.Year})" : null)" RatingSource="@(item => item.Rating)" - SecondaryRatingSource="@(item => _owner ? null : item.UserRating)" + SecondaryRatingSingleSource="@(item => _owner ? null : item.UserRating)" SecondaryRatingTitle="User rating" UrlIdTemplate="/media/{0}" PictureDownloadingTask="@((id, action) => MediaClientService.GetMediaPoster(id, action))" @@ -115,10 +116,33 @@
- - - - +
+ + + +
diff --git a/WatchIt.Website/WatchIt.Website/Pages/UserPage.razor.cs b/WatchIt.Website/WatchIt.Website/Pages/UserPage.razor.cs index 7a190ff..2a2985c 100644 --- a/WatchIt.Website/WatchIt.Website/Pages/UserPage.razor.cs +++ b/WatchIt.Website/WatchIt.Website/Pages/UserPage.razor.cs @@ -4,6 +4,7 @@ using WatchIt.Website.Layout; using WatchIt.Website.Services.Authentication; using WatchIt.Website.Services.Client.Accounts; using WatchIt.Website.Services.Client.Media; +using WatchIt.Website.Services.Client.Persons; namespace WatchIt.Website.Pages; @@ -15,6 +16,7 @@ public partial class UserPage : ComponentBase [Inject] private IAuthenticationService AuthenticationService { get; set; } = default!; [Inject] private IAccountsClientService AccountsClientService { get; set; } = default!; [Inject] private IMediaClientService MediaClientService { get; set; } = default!; + [Inject] private IPersonsClientService PersonsClientService { get; set; } = default!; #endregion diff --git a/WatchIt.Website/WatchIt.Website/appsettings.json b/WatchIt.Website/WatchIt.Website/appsettings.json index 9116ddb..9d0355d 100644 --- a/WatchIt.Website/WatchIt.Website/appsettings.json +++ b/WatchIt.Website/WatchIt.Website/appsettings.json @@ -25,7 +25,8 @@ "GetAccountInfo": "/{0}/info", "PutAccountInfo": "/info", "GetAccountRatedMovies": "/{0}/movies", - "GetAccountRatedSeries": "/{0}/series" + "GetAccountRatedSeries": "/{0}/series", + "GetAccountRatedPersons": "/{0}/persons" }, "Genders": { "Base": "/genders", From 4b9034fe873412461aa16f4509c0e89379f9553c Mon Sep 17 00:00:00 2001 From: Mateusz Skoczek Date: Sat, 2 Nov 2024 15:22:25 +0100 Subject: [PATCH 08/20] Profile page finished --- .../Movies/MovieRatedQueryParameters.cs | 11 + .../Movies/MovieRatedResponse.cs | 7 +- .../Persons/PersonRatedQueryParameters.cs | 11 + .../Persons/PersonRatedResponse.cs | 9 +- .../Series/SeriesRatedQueryParameters.cs | 11 + .../Series/SeriesRatedResponse.cs | 7 +- .../Rating/RatingMediaConfiguration.cs | 4 + .../RatingMediaSeriesEpisodeConfiguration.cs | 4 + .../RatingMediaSeriesSeasonConfiguration.cs | 4 + .../RatingPersonActorRoleConfiguration.cs | 4 + .../RatingPersonCreatorRoleConfiguration.cs | 4 + .../Rating/RatingMedia.cs | 1 + .../Rating/RatingMediaSeriesEpisode.cs | 1 + .../Rating/RatingMediaSeriesSeason.cs | 1 + .../Rating/RatingPersonActorRole.cs | 1 + .../Rating/RatingPersonCreatorRole.cs | 1 + .../20241102132802_RatingDate.Designer.cs | 1416 +++++++++++++++++ .../Migrations/20241102132802_RatingDate.cs | 92 ++ .../DatabaseContextModelSnapshot.cs | 34 +- WatchIt.Website/WatchIt.Website/App.razor | 2 +- .../HorizontalListPanelComponent.razor} | 12 +- .../HorizontalListPanelComponent.razor.cs} | 12 +- .../HorizontalListItemComponent.razor} | 0 .../HorizontalListItemComponent.razor.cs} | 4 +- .../HorizontalListItemComponent.razor.css} | 0 .../MoviesRatedFilterFormComponent.razor | 8 + .../PersonsRatedFilterFormComponent.razor | 28 +- .../SeriesRatedFilterFormComponent.razor | 8 + .../WatchIt.Website/Pages/HomePage.razor | 49 +- .../WatchIt.Website/Pages/UserPage.razor | 35 +- WatchIt.sln | 241 --- WatchIt.slnx | 50 + 32 files changed, 1770 insertions(+), 302 deletions(-) create mode 100644 WatchIt.Database/WatchIt.Database/Migrations/20241102132802_RatingDate.Designer.cs create mode 100644 WatchIt.Database/WatchIt.Database/Migrations/20241102132802_RatingDate.cs rename WatchIt.Website/WatchIt.Website/Components/{Pages/HomePage/Panels/ViewRankPanelComponent.razor => Common/Panels/HorizontalListPanelComponent.razor} (60%) rename WatchIt.Website/WatchIt.Website/Components/{Pages/HomePage/Panels/ViewRankPanelComponent.razor.cs => Common/Panels/HorizontalListPanelComponent.razor.cs} (73%) rename WatchIt.Website/WatchIt.Website/Components/{Pages/HomePage/Subcomponents/ViewRankItemComponent.razor => Common/Subcomponents/HorizontalListItemComponent.razor} (100%) rename WatchIt.Website/WatchIt.Website/Components/{Pages/HomePage/Subcomponents/ViewRankItemComponent.razor.cs => Common/Subcomponents/HorizontalListItemComponent.razor.cs} (88%) rename WatchIt.Website/WatchIt.Website/Components/{Pages/HomePage/Subcomponents/ViewRankItemComponent.razor.css => Common/Subcomponents/HorizontalListItemComponent.razor.css} (100%) delete mode 100644 WatchIt.sln create mode 100644 WatchIt.slnx diff --git a/WatchIt.Common/WatchIt.Common.Model/Movies/MovieRatedQueryParameters.cs b/WatchIt.Common/WatchIt.Common.Model/Movies/MovieRatedQueryParameters.cs index ef74767..5c5d2b7 100644 --- a/WatchIt.Common/WatchIt.Common.Model/Movies/MovieRatedQueryParameters.cs +++ b/WatchIt.Common/WatchIt.Common.Model/Movies/MovieRatedQueryParameters.cs @@ -73,6 +73,15 @@ public class MovieRatedQueryParameters : QueryParameters [FromQuery(Name = "user_rating_to")] public decimal? UserRatingTo { get; set; } + [FromQuery(Name = "user_rating_date")] + public DateOnly? UserRatingDate { get; set; } + + [FromQuery(Name = "user_rating_date_from")] + public DateOnly? UserRatingDateFrom { get; set; } + + [FromQuery(Name = "user_rating_date_to")] + public DateOnly? UserRatingDateTo { get; set; } + #endregion @@ -98,6 +107,8 @@ public class MovieRatedQueryParameters : QueryParameters TestContains(Genres, item.Genres.Select(x => x.Id)) && TestComparable((decimal)item.UserRating, UserRating, UserRatingFrom, UserRatingTo) + && + TestComparable(item.UserRatingDate, UserRatingDate, UserRatingDateFrom, UserRatingDateTo) ); #endregion diff --git a/WatchIt.Common/WatchIt.Common.Model/Movies/MovieRatedResponse.cs b/WatchIt.Common/WatchIt.Common.Model/Movies/MovieRatedResponse.cs index b1d6db8..5f3fa18 100644 --- a/WatchIt.Common/WatchIt.Common.Model/Movies/MovieRatedResponse.cs +++ b/WatchIt.Common/WatchIt.Common.Model/Movies/MovieRatedResponse.cs @@ -24,12 +24,16 @@ public class MovieRatedResponse : MovieResponse, IQueryOrderable x.Budget }, { "rating.average", x => x.Rating.Average }, { "rating.count", x => x.Rating.Count }, - { "user_rating", x => x.UserRating } + { "user_rating", x => x.UserRating }, + { "user_rating_date", x => x.UserRatingDate } }; [JsonPropertyName("user_rating")] public short UserRating { get; set; } + [JsonPropertyName("user_rating_date")] + public DateTime UserRatingDate { get; set; } + #endregion @@ -54,6 +58,7 @@ public class MovieRatedResponse : MovieResponse, IQueryOrderable new GenreResponse(x)).ToList(); UserRating = response.Rating; + UserRatingDate = response.Date; } #endregion diff --git a/WatchIt.Common/WatchIt.Common.Model/Persons/PersonRatedQueryParameters.cs b/WatchIt.Common/WatchIt.Common.Model/Persons/PersonRatedQueryParameters.cs index a31d5d4..dd1659b 100644 --- a/WatchIt.Common/WatchIt.Common.Model/Persons/PersonRatedQueryParameters.cs +++ b/WatchIt.Common/WatchIt.Common.Model/Persons/PersonRatedQueryParameters.cs @@ -72,6 +72,15 @@ public class PersonRatedQueryParameters : QueryParameters [FromQuery(Name = "user_rating_count_to")] public long? UserRatingCountTo { get; set; } + + [FromQuery(Name = "user_rating_date")] + public DateOnly? UserRatingLastDate { get; set; } + + [FromQuery(Name = "user_rating_date_from")] + public DateOnly? UserRatingLastDateFrom { get; set; } + + [FromQuery(Name = "user_rating_date_to")] + public DateOnly? UserRatingLastDateTo { get; set; } #endregion @@ -100,6 +109,8 @@ public class PersonRatedQueryParameters : QueryParameters TestComparable(item.UserRating.Average, UserRatingAverage, UserRatingAverageFrom, UserRatingAverageTo) && TestComparable(item.UserRating.Count, UserRatingCount, UserRatingCountFrom, UserRatingCountTo) + && + TestComparable(item.UserRatingLastDate, UserRatingLastDate, UserRatingLastDateFrom, UserRatingLastDateTo) ); #endregion diff --git a/WatchIt.Common/WatchIt.Common.Model/Persons/PersonRatedResponse.cs b/WatchIt.Common/WatchIt.Common.Model/Persons/PersonRatedResponse.cs index fa61b37..d328b95 100644 --- a/WatchIt.Common/WatchIt.Common.Model/Persons/PersonRatedResponse.cs +++ b/WatchIt.Common/WatchIt.Common.Model/Persons/PersonRatedResponse.cs @@ -24,11 +24,15 @@ public class PersonRatedResponse : PersonResponse, IQueryOrderable x.Rating.Average }, { "rating.count", x => x.Rating.Count }, { "user_rating.average", x => x.UserRating.Average }, - { "user_rating.count", x => x.UserRating.Count } + { "user_rating.count", x => x.UserRating.Count }, + { "user_rating_last_date", x => x.UserRatingLastDate } }; [JsonPropertyName("user_rating")] public RatingResponse UserRating { get; set; } + + [JsonPropertyName("user_rating_last_date")] + public DateTime UserRatingLastDate { get; set; } #endregion @@ -57,6 +61,9 @@ public class PersonRatedResponse : PersonResponse, IQueryOrderable x.Rating) .Add(creatorUserRatings, x => x.Rating) .Build(); + UserRatingLastDate = actorUserRatings.Select(x => x.Date) + .Union(creatorUserRatings.Select(x => x.Date)) + .Max(); } #endregion diff --git a/WatchIt.Common/WatchIt.Common.Model/Series/SeriesRatedQueryParameters.cs b/WatchIt.Common/WatchIt.Common.Model/Series/SeriesRatedQueryParameters.cs index 7d155ab..b686626 100644 --- a/WatchIt.Common/WatchIt.Common.Model/Series/SeriesRatedQueryParameters.cs +++ b/WatchIt.Common/WatchIt.Common.Model/Series/SeriesRatedQueryParameters.cs @@ -67,6 +67,15 @@ public class SeriesRatedQueryParameters : QueryParameters [FromQuery(Name = "user_rating_to")] public decimal? UserRatingTo { get; set; } + [FromQuery(Name = "user_rating_date")] + public DateOnly? UserRatingDate { get; set; } + + [FromQuery(Name = "user_rating_date_from")] + public DateOnly? UserRatingDateFrom { get; set; } + + [FromQuery(Name = "user_rating_date_to")] + public DateOnly? UserRatingDateTo { get; set; } + #endregion @@ -94,6 +103,8 @@ public class SeriesRatedQueryParameters : QueryParameters TestContains(item.Genres.Select(x => x.Id), Genres) && TestComparable((decimal)item.UserRating, UserRating, UserRatingFrom, UserRatingTo) + && + TestComparable(item.UserRatingDate, UserRatingDate, UserRatingDateFrom, UserRatingDateTo) ); #endregion diff --git a/WatchIt.Common/WatchIt.Common.Model/Series/SeriesRatedResponse.cs b/WatchIt.Common/WatchIt.Common.Model/Series/SeriesRatedResponse.cs index 0cf7996..8ac56a0 100644 --- a/WatchIt.Common/WatchIt.Common.Model/Series/SeriesRatedResponse.cs +++ b/WatchIt.Common/WatchIt.Common.Model/Series/SeriesRatedResponse.cs @@ -24,12 +24,16 @@ public class SeriesRatedResponse : SeriesResponse, IQueryOrderable x.HasEnded }, { "rating.average", x => x.Rating.Average }, { "rating.count", x => x.Rating.Count }, - { "user_rating", x => x.UserRating } + { "user_rating", x => x.UserRating }, + { "user_rating_date", x => x.UserRatingDate } }; [JsonPropertyName("user_rating")] public short UserRating { get; set; } + [JsonPropertyName("user_rating_date")] + public DateTime UserRatingDate { get; set; } + #endregion @@ -54,6 +58,7 @@ public class SeriesRatedResponse : SeriesResponse, IQueryOrderable new GenreResponse(x)).ToList(); UserRating = response.Rating; + UserRatingDate = response.Date; } #endregion diff --git a/WatchIt.Database/WatchIt.Database.Model/WatchIt.Database.Model.Configuration/Rating/RatingMediaConfiguration.cs b/WatchIt.Database/WatchIt.Database.Model/WatchIt.Database.Model.Configuration/Rating/RatingMediaConfiguration.cs index 7791626..67eaf19 100644 --- a/WatchIt.Database/WatchIt.Database.Model/WatchIt.Database.Model.Configuration/Rating/RatingMediaConfiguration.cs +++ b/WatchIt.Database/WatchIt.Database.Model/WatchIt.Database.Model.Configuration/Rating/RatingMediaConfiguration.cs @@ -30,5 +30,9 @@ public class RatingMediaConfiguration : IEntityTypeConfiguration builder.Property(x => x.Rating) .IsRequired(); + + builder.Property(x => x.Date) + .IsRequired() + .HasDefaultValueSql("now()"); } } \ No newline at end of file diff --git a/WatchIt.Database/WatchIt.Database.Model/WatchIt.Database.Model.Configuration/Rating/RatingMediaSeriesEpisodeConfiguration.cs b/WatchIt.Database/WatchIt.Database.Model/WatchIt.Database.Model.Configuration/Rating/RatingMediaSeriesEpisodeConfiguration.cs index df2e5b0..c920705 100644 --- a/WatchIt.Database/WatchIt.Database.Model/WatchIt.Database.Model.Configuration/Rating/RatingMediaSeriesEpisodeConfiguration.cs +++ b/WatchIt.Database/WatchIt.Database.Model/WatchIt.Database.Model.Configuration/Rating/RatingMediaSeriesEpisodeConfiguration.cs @@ -30,5 +30,9 @@ public class RatingMediaSeriesEpisodeConfiguration : IEntityTypeConfiguration x.Rating) .IsRequired(); + + builder.Property(x => x.Date) + .IsRequired() + .HasDefaultValueSql("now()"); } } \ No newline at end of file diff --git a/WatchIt.Database/WatchIt.Database.Model/WatchIt.Database.Model.Configuration/Rating/RatingMediaSeriesSeasonConfiguration.cs b/WatchIt.Database/WatchIt.Database.Model/WatchIt.Database.Model.Configuration/Rating/RatingMediaSeriesSeasonConfiguration.cs index b777a13..6da3070 100644 --- a/WatchIt.Database/WatchIt.Database.Model/WatchIt.Database.Model.Configuration/Rating/RatingMediaSeriesSeasonConfiguration.cs +++ b/WatchIt.Database/WatchIt.Database.Model/WatchIt.Database.Model.Configuration/Rating/RatingMediaSeriesSeasonConfiguration.cs @@ -30,5 +30,9 @@ public class RatingMediaSeriesSeasonConfiguration : IEntityTypeConfiguration x.Rating) .IsRequired(); + + builder.Property(x => x.Date) + .IsRequired() + .HasDefaultValueSql("now()"); } } \ No newline at end of file diff --git a/WatchIt.Database/WatchIt.Database.Model/WatchIt.Database.Model.Configuration/Rating/RatingPersonActorRoleConfiguration.cs b/WatchIt.Database/WatchIt.Database.Model/WatchIt.Database.Model.Configuration/Rating/RatingPersonActorRoleConfiguration.cs index 835914d..681f9f5 100644 --- a/WatchIt.Database/WatchIt.Database.Model/WatchIt.Database.Model.Configuration/Rating/RatingPersonActorRoleConfiguration.cs +++ b/WatchIt.Database/WatchIt.Database.Model/WatchIt.Database.Model.Configuration/Rating/RatingPersonActorRoleConfiguration.cs @@ -32,5 +32,9 @@ public class RatingPersonActorRoleConfiguration : IEntityTypeConfiguration x.Rating) .IsRequired(); + + builder.Property(x => x.Date) + .IsRequired() + .HasDefaultValueSql("now()"); } } \ No newline at end of file diff --git a/WatchIt.Database/WatchIt.Database.Model/WatchIt.Database.Model.Configuration/Rating/RatingPersonCreatorRoleConfiguration.cs b/WatchIt.Database/WatchIt.Database.Model/WatchIt.Database.Model.Configuration/Rating/RatingPersonCreatorRoleConfiguration.cs index 8b871ba..708c2d4 100644 --- a/WatchIt.Database/WatchIt.Database.Model/WatchIt.Database.Model.Configuration/Rating/RatingPersonCreatorRoleConfiguration.cs +++ b/WatchIt.Database/WatchIt.Database.Model/WatchIt.Database.Model.Configuration/Rating/RatingPersonCreatorRoleConfiguration.cs @@ -32,5 +32,9 @@ public class RatingPersonCreatorRoleConfiguration : IEntityTypeConfiguration x.Rating) .IsRequired(); + + builder.Property(x => x.Date) + .IsRequired() + .HasDefaultValueSql("now()"); } } \ No newline at end of file diff --git a/WatchIt.Database/WatchIt.Database.Model/WatchIt.Database.Model/Rating/RatingMedia.cs b/WatchIt.Database/WatchIt.Database.Model/WatchIt.Database.Model/Rating/RatingMedia.cs index f4e3b67..9e7b49e 100644 --- a/WatchIt.Database/WatchIt.Database.Model/WatchIt.Database.Model/Rating/RatingMedia.cs +++ b/WatchIt.Database/WatchIt.Database.Model/WatchIt.Database.Model/Rating/RatingMedia.cs @@ -8,6 +8,7 @@ public class RatingMedia public required long MediaId { get; set; } public required long AccountId { get; set; } public required short Rating { get; set; } + public DateTime Date { get; set; } #endregion diff --git a/WatchIt.Database/WatchIt.Database.Model/WatchIt.Database.Model/Rating/RatingMediaSeriesEpisode.cs b/WatchIt.Database/WatchIt.Database.Model/WatchIt.Database.Model/Rating/RatingMediaSeriesEpisode.cs index 0a00901..6f40392 100644 --- a/WatchIt.Database/WatchIt.Database.Model/WatchIt.Database.Model/Rating/RatingMediaSeriesEpisode.cs +++ b/WatchIt.Database/WatchIt.Database.Model/WatchIt.Database.Model/Rating/RatingMediaSeriesEpisode.cs @@ -10,6 +10,7 @@ public class RatingMediaSeriesEpisode public required Guid MediaSeriesEpisodeId { get; set; } public required long AccountId { get; set; } public required short Rating { get; set; } + public DateTime Date { get; set; } #endregion diff --git a/WatchIt.Database/WatchIt.Database.Model/WatchIt.Database.Model/Rating/RatingMediaSeriesSeason.cs b/WatchIt.Database/WatchIt.Database.Model/WatchIt.Database.Model/Rating/RatingMediaSeriesSeason.cs index f522e07..dae110f 100644 --- a/WatchIt.Database/WatchIt.Database.Model/WatchIt.Database.Model/Rating/RatingMediaSeriesSeason.cs +++ b/WatchIt.Database/WatchIt.Database.Model/WatchIt.Database.Model/Rating/RatingMediaSeriesSeason.cs @@ -10,6 +10,7 @@ public class RatingMediaSeriesSeason public required Guid MediaSeriesSeasonId { get; set; } public required long AccountId { get; set; } public required short Rating { get; set; } + public DateTime Date { get; set; } #endregion diff --git a/WatchIt.Database/WatchIt.Database.Model/WatchIt.Database.Model/Rating/RatingPersonActorRole.cs b/WatchIt.Database/WatchIt.Database.Model/WatchIt.Database.Model/Rating/RatingPersonActorRole.cs index 923c8ba..4624faf 100644 --- a/WatchIt.Database/WatchIt.Database.Model/WatchIt.Database.Model/Rating/RatingPersonActorRole.cs +++ b/WatchIt.Database/WatchIt.Database.Model/WatchIt.Database.Model/Rating/RatingPersonActorRole.cs @@ -10,6 +10,7 @@ public class RatingPersonActorRole public required Guid PersonActorRoleId { get; set; } public required long AccountId { get; set; } public required short Rating { get; set; } + public DateTime Date { get; set; } #endregion diff --git a/WatchIt.Database/WatchIt.Database.Model/WatchIt.Database.Model/Rating/RatingPersonCreatorRole.cs b/WatchIt.Database/WatchIt.Database.Model/WatchIt.Database.Model/Rating/RatingPersonCreatorRole.cs index b0b7ed2..c5b2399 100644 --- a/WatchIt.Database/WatchIt.Database.Model/WatchIt.Database.Model/Rating/RatingPersonCreatorRole.cs +++ b/WatchIt.Database/WatchIt.Database.Model/WatchIt.Database.Model/Rating/RatingPersonCreatorRole.cs @@ -10,6 +10,7 @@ public class RatingPersonCreatorRole public required Guid PersonCreatorRoleId { get; set; } public required long AccountId { get; set; } public required short Rating { get; set; } + public DateTime Date { get; set; } #endregion diff --git a/WatchIt.Database/WatchIt.Database/Migrations/20241102132802_RatingDate.Designer.cs b/WatchIt.Database/WatchIt.Database/Migrations/20241102132802_RatingDate.Designer.cs new file mode 100644 index 0000000..d882d39 --- /dev/null +++ b/WatchIt.Database/WatchIt.Database/Migrations/20241102132802_RatingDate.Designer.cs @@ -0,0 +1,1416 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; +using WatchIt.Database; + +#nullable disable + +namespace WatchIt.Database.Migrations +{ + [DbContext(typeof(DatabaseContext))] + [Migration("20241102132802_RatingDate")] + partial class RatingDate + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "8.0.5") + .HasAnnotation("Proxies:ChangeTracking", false) + .HasAnnotation("Proxies:CheckEquality", false) + .HasAnnotation("Proxies:LazyLoading", true) + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("WatchIt.Database.Model.Account.Account", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("BackgroundPictureId") + .HasColumnType("uuid"); + + b.Property("CreationDate") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.Property("Description") + .HasMaxLength(1000) + .HasColumnType("character varying(1000)"); + + b.Property("Email") + .IsRequired() + .HasMaxLength(320) + .HasColumnType("character varying(320)"); + + b.Property("GenderId") + .HasColumnType("smallint"); + + b.Property("IsAdmin") + .ValueGeneratedOnAdd() + .HasColumnType("boolean") + .HasDefaultValue(false); + + b.Property("LastActive") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.Property("LeftSalt") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("character varying(20)"); + + b.Property("Password") + .IsRequired() + .HasMaxLength(1000) + .HasColumnType("bytea"); + + b.Property("ProfilePictureId") + .HasColumnType("uuid"); + + b.Property("RightSalt") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("character varying(20)"); + + b.Property("Username") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("character varying(50)"); + + b.HasKey("Id"); + + b.HasIndex("BackgroundPictureId"); + + b.HasIndex("GenderId"); + + b.HasIndex("Id") + .IsUnique(); + + b.HasIndex("ProfilePictureId") + .IsUnique(); + + b.ToTable("Accounts"); + + b.HasData( + new + { + Id = 1L, + CreationDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + Email = "root@watch.it", + IsAdmin = true, + LastActive = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + LeftSalt = "YuJiv1\"R'*0odl8${\\|S", + Password = new byte[] { 215, 154, 186, 191, 12, 223, 76, 105, 137, 67, 41, 138, 26, 3, 38, 36, 0, 71, 40, 84, 153, 152, 105, 239, 55, 60, 164, 15, 99, 175, 133, 175, 227, 245, 102, 9, 171, 119, 16, 234, 97, 179, 70, 29, 120, 112, 241, 91, 209, 91, 228, 164, 52, 244, 36, 207, 147, 60, 124, 66, 77, 252, 129, 151 }, + RightSalt = "oT2N=y7^5,2o'+N>d}~!", + Username = "root" + }); + }); + + modelBuilder.Entity("WatchIt.Database.Model.Account.AccountProfilePicture", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("Image") + .IsRequired() + .HasMaxLength(-1) + .HasColumnType("bytea"); + + b.Property("MimeType") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("character varying(50)"); + + b.Property("UploadDate") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.HasKey("Id"); + + b.HasIndex("Id") + .IsUnique(); + + b.ToTable("AccountProfilePictures"); + }); + + modelBuilder.Entity("WatchIt.Database.Model.Account.AccountRefreshToken", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("AccountId") + .HasColumnType("bigint"); + + b.Property("ExpirationDate") + .HasColumnType("timestamp with time zone"); + + b.Property("IsExtendable") + .HasColumnType("boolean"); + + b.HasKey("Id"); + + b.HasIndex("AccountId"); + + b.HasIndex("Id") + .IsUnique(); + + b.ToTable("AccountRefreshTokens"); + }); + + modelBuilder.Entity("WatchIt.Database.Model.Common.Country", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("smallint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("IsHistorical") + .ValueGeneratedOnAdd() + .HasColumnType("boolean") + .HasDefaultValue(false); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("character varying(100)"); + + b.HasKey("Id"); + + b.HasIndex("Id") + .IsUnique(); + + b.ToTable("Countries"); + + b.HasData( + new + { + Id = (short)1, + IsHistorical = false, + Name = "Afghanistan" + }, + new + { + Id = (short)2, + IsHistorical = false, + Name = "Albania" + }); + }); + + modelBuilder.Entity("WatchIt.Database.Model.Common.Gender", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("smallint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("Id") + .IsUnique(); + + b.ToTable("Genders"); + + b.HasData( + new + { + Id = (short)1, + Name = "Male" + }, + new + { + Id = (short)2, + Name = "Female" + }); + }); + + modelBuilder.Entity("WatchIt.Database.Model.Common.Genre", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("smallint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Description") + .HasMaxLength(1000) + .HasColumnType("character varying(1000)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("character varying(100)"); + + b.HasKey("Id"); + + b.HasIndex("Id") + .IsUnique(); + + b.ToTable("Genres"); + + b.HasData( + new + { + Id = (short)1, + Name = "Comedy" + }, + new + { + Id = (short)2, + Name = "Thriller" + }, + new + { + Id = (short)3, + Name = "Horror" + }, + new + { + Id = (short)4, + Name = "Action" + }, + new + { + Id = (short)5, + Name = "Drama" + }); + }); + + modelBuilder.Entity("WatchIt.Database.Model.Media.Media", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Description") + .HasMaxLength(1000) + .HasColumnType("character varying(1000)"); + + b.Property("Length") + .HasColumnType("smallint"); + + b.Property("MediaPosterImageId") + .HasColumnType("uuid"); + + b.Property("OriginalTitle") + .HasMaxLength(250) + .HasColumnType("character varying(250)"); + + b.Property("ReleaseDate") + .HasColumnType("date"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(250) + .HasColumnType("character varying(250)"); + + b.HasKey("Id"); + + b.HasIndex("Id") + .IsUnique(); + + b.HasIndex("MediaPosterImageId") + .IsUnique(); + + b.ToTable("Media"); + }); + + modelBuilder.Entity("WatchIt.Database.Model.Media.MediaGenre", b => + { + b.Property("GenreId") + .HasColumnType("smallint"); + + b.Property("MediaId") + .HasColumnType("bigint"); + + b.HasKey("GenreId", "MediaId"); + + b.HasIndex("MediaId"); + + b.ToTable("MediaGenres"); + }); + + modelBuilder.Entity("WatchIt.Database.Model.Media.MediaMovie", b => + { + b.Property("Id") + .HasColumnType("bigint"); + + b.Property("Budget") + .HasColumnType("money"); + + b.HasKey("Id"); + + b.HasIndex("Id") + .IsUnique(); + + b.ToTable("MediaMovies"); + }); + + modelBuilder.Entity("WatchIt.Database.Model.Media.MediaPhotoImage", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("Image") + .IsRequired() + .HasMaxLength(-1) + .HasColumnType("bytea"); + + b.Property("MediaId") + .HasColumnType("bigint"); + + b.Property("MimeType") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("character varying(50)"); + + b.Property("UploadDate") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.HasKey("Id"); + + b.HasIndex("Id") + .IsUnique(); + + b.HasIndex("MediaId"); + + b.ToTable("MediaPhotoImages"); + }); + + modelBuilder.Entity("WatchIt.Database.Model.Media.MediaPhotoImageBackground", b => + { + b.Property("Id") + .HasColumnType("uuid"); + + b.Property("FirstGradientColor") + .IsRequired() + .HasMaxLength(3) + .HasColumnType("bytea"); + + b.Property("IsUniversalBackground") + .ValueGeneratedOnAdd() + .HasColumnType("boolean") + .HasDefaultValue(false); + + b.Property("SecondGradientColor") + .IsRequired() + .HasMaxLength(3) + .HasColumnType("bytea"); + + b.HasKey("Id"); + + b.HasIndex("Id") + .IsUnique(); + + b.ToTable("MediaPhotoImageBackgrounds"); + }); + + modelBuilder.Entity("WatchIt.Database.Model.Media.MediaPosterImage", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("Image") + .IsRequired() + .HasMaxLength(-1) + .HasColumnType("bytea"); + + b.Property("MimeType") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("character varying(50)"); + + b.Property("UploadDate") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.HasKey("Id"); + + b.HasIndex("Id") + .IsUnique(); + + b.ToTable("MediaPosterImages"); + }); + + modelBuilder.Entity("WatchIt.Database.Model.Media.MediaProductionCountry", b => + { + b.Property("CountryId") + .HasColumnType("smallint"); + + b.Property("MediaId") + .HasColumnType("bigint"); + + b.HasKey("CountryId", "MediaId"); + + b.HasIndex("MediaId"); + + b.ToTable("MediaProductionCountries"); + }); + + modelBuilder.Entity("WatchIt.Database.Model.Media.MediaSeries", b => + { + b.Property("Id") + .HasColumnType("bigint"); + + b.Property("HasEnded") + .ValueGeneratedOnAdd() + .HasColumnType("boolean") + .HasDefaultValue(false); + + b.HasKey("Id"); + + b.HasIndex("Id") + .IsUnique(); + + b.ToTable("MediaSeries"); + }); + + modelBuilder.Entity("WatchIt.Database.Model.Media.MediaSeriesEpisode", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("IsSpecial") + .ValueGeneratedOnAdd() + .HasColumnType("boolean") + .HasDefaultValue(false); + + b.Property("MediaSeriesSeasonId") + .HasColumnType("uuid"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("Number") + .HasColumnType("smallint"); + + b.HasKey("Id"); + + b.HasIndex("Id") + .IsUnique(); + + b.HasIndex("MediaSeriesSeasonId"); + + b.ToTable("MediaSeriesEpisodes"); + }); + + modelBuilder.Entity("WatchIt.Database.Model.Media.MediaSeriesSeason", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("MediaSeriesId") + .HasColumnType("bigint"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("Number") + .HasColumnType("smallint"); + + b.HasKey("Id"); + + b.HasIndex("Id") + .IsUnique(); + + b.HasIndex("MediaSeriesId"); + + b.ToTable("MediaSeriesSeasons"); + }); + + modelBuilder.Entity("WatchIt.Database.Model.Person.Person", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("BirthDate") + .HasColumnType("date"); + + b.Property("DeathDate") + .HasColumnType("date"); + + b.Property("Description") + .HasMaxLength(1000) + .HasColumnType("character varying(1000)"); + + b.Property("FullName") + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("GenderId") + .HasColumnType("smallint"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("character varying(100)"); + + b.Property("PersonPhotoId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("GenderId"); + + b.HasIndex("Id") + .IsUnique(); + + b.HasIndex("PersonPhotoId") + .IsUnique(); + + b.ToTable("Persons"); + }); + + modelBuilder.Entity("WatchIt.Database.Model.Person.PersonActorRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("MediaId") + .HasColumnType("bigint"); + + b.Property("PersonActorRoleTypeId") + .HasColumnType("smallint"); + + b.Property("PersonId") + .HasColumnType("bigint"); + + b.Property("RoleName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("character varying(100)"); + + b.HasKey("Id"); + + b.HasIndex("Id") + .IsUnique(); + + b.HasIndex("MediaId"); + + b.HasIndex("PersonActorRoleTypeId"); + + b.HasIndex("PersonId"); + + b.ToTable("PersonActorRoles"); + }); + + modelBuilder.Entity("WatchIt.Database.Model.Person.PersonActorRoleType", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("smallint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("character varying(100)"); + + b.HasKey("Id"); + + b.HasIndex("Id") + .IsUnique(); + + b.ToTable("PersonActorRoleTypes"); + + b.HasData( + new + { + Id = (short)1, + Name = "Actor" + }, + new + { + Id = (short)2, + Name = "Supporting actor" + }, + new + { + Id = (short)3, + Name = "Voice actor" + }); + }); + + modelBuilder.Entity("WatchIt.Database.Model.Person.PersonCreatorRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("MediaId") + .HasColumnType("bigint"); + + b.Property("PersonCreatorRoleTypeId") + .HasColumnType("smallint"); + + b.Property("PersonId") + .HasColumnType("bigint"); + + b.HasKey("Id"); + + b.HasIndex("Id") + .IsUnique(); + + b.HasIndex("MediaId"); + + b.HasIndex("PersonCreatorRoleTypeId"); + + b.HasIndex("PersonId"); + + b.ToTable("PersonCreatorRoles"); + }); + + modelBuilder.Entity("WatchIt.Database.Model.Person.PersonCreatorRoleType", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("smallint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("character varying(100)"); + + b.HasKey("Id"); + + b.HasIndex("Id") + .IsUnique(); + + b.ToTable("PersonCreatorRoleTypes"); + + b.HasData( + new + { + Id = (short)1, + Name = "Director" + }, + new + { + Id = (short)2, + Name = "Producer" + }, + new + { + Id = (short)3, + Name = "Screenwriter" + }); + }); + + modelBuilder.Entity("WatchIt.Database.Model.Person.PersonPhotoImage", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("Image") + .IsRequired() + .HasMaxLength(-1) + .HasColumnType("bytea"); + + b.Property("MimeType") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("character varying(50)"); + + b.Property("UploadDate") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.HasKey("Id"); + + b.HasIndex("Id") + .IsUnique(); + + b.ToTable("PersonPhotoImages"); + }); + + modelBuilder.Entity("WatchIt.Database.Model.Rating.RatingMedia", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("AccountId") + .HasColumnType("bigint"); + + b.Property("Date") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.Property("MediaId") + .HasColumnType("bigint"); + + b.Property("Rating") + .HasColumnType("smallint"); + + b.HasKey("Id"); + + b.HasIndex("AccountId"); + + b.HasIndex("Id") + .IsUnique(); + + b.HasIndex("MediaId"); + + b.ToTable("RatingsMedia"); + }); + + modelBuilder.Entity("WatchIt.Database.Model.Rating.RatingMediaSeriesEpisode", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("AccountId") + .HasColumnType("bigint"); + + b.Property("Date") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.Property("MediaSeriesEpisodeId") + .HasColumnType("uuid"); + + b.Property("Rating") + .HasColumnType("smallint"); + + b.HasKey("Id"); + + b.HasIndex("AccountId"); + + b.HasIndex("Id") + .IsUnique(); + + b.HasIndex("MediaSeriesEpisodeId"); + + b.ToTable("RatingsMediaSeriesEpisode"); + }); + + modelBuilder.Entity("WatchIt.Database.Model.Rating.RatingMediaSeriesSeason", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("AccountId") + .HasColumnType("bigint"); + + b.Property("Date") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.Property("MediaSeriesSeasonId") + .HasColumnType("uuid"); + + b.Property("Rating") + .HasColumnType("smallint"); + + b.HasKey("Id"); + + b.HasIndex("AccountId"); + + b.HasIndex("Id") + .IsUnique(); + + b.HasIndex("MediaSeriesSeasonId"); + + b.ToTable("RatingsMediaSeriesSeason"); + }); + + modelBuilder.Entity("WatchIt.Database.Model.Rating.RatingPersonActorRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("AccountId") + .HasColumnType("bigint"); + + b.Property("Date") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.Property("PersonActorRoleId") + .HasColumnType("uuid"); + + b.Property("Rating") + .HasColumnType("smallint"); + + b.HasKey("Id"); + + b.HasIndex("AccountId"); + + b.HasIndex("Id") + .IsUnique(); + + b.HasIndex("PersonActorRoleId"); + + b.ToTable("RatingsPersonActorRole", (string)null); + }); + + modelBuilder.Entity("WatchIt.Database.Model.Rating.RatingPersonCreatorRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("AccountId") + .HasColumnType("bigint"); + + b.Property("Date") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.Property("PersonCreatorRoleId") + .HasColumnType("uuid"); + + b.Property("Rating") + .HasColumnType("smallint"); + + b.HasKey("Id"); + + b.HasIndex("AccountId"); + + b.HasIndex("Id") + .IsUnique(); + + b.HasIndex("PersonCreatorRoleId"); + + b.ToTable("RatingsPersonCreatorRole", (string)null); + }); + + modelBuilder.Entity("WatchIt.Database.Model.ViewCount.ViewCountMedia", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("Date") + .ValueGeneratedOnAdd() + .HasColumnType("date") + .HasDefaultValueSql("now()"); + + b.Property("MediaId") + .HasColumnType("bigint"); + + b.Property("ViewCount") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasDefaultValue(0L); + + b.HasKey("Id"); + + b.HasIndex("Id") + .IsUnique(); + + b.HasIndex("MediaId"); + + b.ToTable("ViewCountsMedia", (string)null); + }); + + modelBuilder.Entity("WatchIt.Database.Model.ViewCount.ViewCountPerson", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("Date") + .ValueGeneratedOnAdd() + .HasColumnType("date") + .HasDefaultValueSql("now()"); + + b.Property("PersonId") + .HasColumnType("bigint"); + + b.Property("ViewCount") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasDefaultValue(0L); + + b.HasKey("Id"); + + b.HasIndex("Id") + .IsUnique(); + + b.HasIndex("PersonId"); + + b.ToTable("ViewCountsPerson", (string)null); + }); + + modelBuilder.Entity("WatchIt.Database.Model.Account.Account", b => + { + b.HasOne("WatchIt.Database.Model.Media.MediaPhotoImage", "BackgroundPicture") + .WithMany() + .HasForeignKey("BackgroundPictureId"); + + b.HasOne("WatchIt.Database.Model.Common.Gender", "Gender") + .WithMany() + .HasForeignKey("GenderId"); + + b.HasOne("WatchIt.Database.Model.Account.AccountProfilePicture", "ProfilePicture") + .WithOne("Account") + .HasForeignKey("WatchIt.Database.Model.Account.Account", "ProfilePictureId"); + + b.Navigation("BackgroundPicture"); + + b.Navigation("Gender"); + + b.Navigation("ProfilePicture"); + }); + + modelBuilder.Entity("WatchIt.Database.Model.Account.AccountRefreshToken", b => + { + b.HasOne("WatchIt.Database.Model.Account.Account", "Account") + .WithMany("AccountRefreshTokens") + .HasForeignKey("AccountId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Account"); + }); + + modelBuilder.Entity("WatchIt.Database.Model.Media.Media", b => + { + b.HasOne("WatchIt.Database.Model.Media.MediaPosterImage", "MediaPosterImage") + .WithOne("Media") + .HasForeignKey("WatchIt.Database.Model.Media.Media", "MediaPosterImageId"); + + b.Navigation("MediaPosterImage"); + }); + + modelBuilder.Entity("WatchIt.Database.Model.Media.MediaGenre", b => + { + b.HasOne("WatchIt.Database.Model.Common.Genre", "Genre") + .WithMany("MediaGenres") + .HasForeignKey("GenreId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("WatchIt.Database.Model.Media.Media", "Media") + .WithMany("MediaGenres") + .HasForeignKey("MediaId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Genre"); + + b.Navigation("Media"); + }); + + modelBuilder.Entity("WatchIt.Database.Model.Media.MediaMovie", b => + { + b.HasOne("WatchIt.Database.Model.Media.Media", "Media") + .WithOne() + .HasForeignKey("WatchIt.Database.Model.Media.MediaMovie", "Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Media"); + }); + + modelBuilder.Entity("WatchIt.Database.Model.Media.MediaPhotoImage", b => + { + b.HasOne("WatchIt.Database.Model.Media.Media", "Media") + .WithMany("MediaPhotoImages") + .HasForeignKey("MediaId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Media"); + }); + + modelBuilder.Entity("WatchIt.Database.Model.Media.MediaPhotoImageBackground", b => + { + b.HasOne("WatchIt.Database.Model.Media.MediaPhotoImage", "MediaPhotoImage") + .WithOne("MediaPhotoImageBackground") + .HasForeignKey("WatchIt.Database.Model.Media.MediaPhotoImageBackground", "Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("MediaPhotoImage"); + }); + + modelBuilder.Entity("WatchIt.Database.Model.Media.MediaProductionCountry", b => + { + b.HasOne("WatchIt.Database.Model.Common.Country", "Country") + .WithMany("MediaProductionCountries") + .HasForeignKey("CountryId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("WatchIt.Database.Model.Media.Media", "Media") + .WithMany("MediaProductionCountries") + .HasForeignKey("MediaId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Country"); + + b.Navigation("Media"); + }); + + modelBuilder.Entity("WatchIt.Database.Model.Media.MediaSeries", b => + { + b.HasOne("WatchIt.Database.Model.Media.Media", "Media") + .WithOne() + .HasForeignKey("WatchIt.Database.Model.Media.MediaSeries", "Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Media"); + }); + + modelBuilder.Entity("WatchIt.Database.Model.Media.MediaSeriesEpisode", b => + { + b.HasOne("WatchIt.Database.Model.Media.MediaSeriesSeason", "MediaSeriesSeason") + .WithMany("MediaSeriesEpisodes") + .HasForeignKey("MediaSeriesSeasonId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("MediaSeriesSeason"); + }); + + modelBuilder.Entity("WatchIt.Database.Model.Media.MediaSeriesSeason", b => + { + b.HasOne("WatchIt.Database.Model.Media.MediaSeries", "MediaSeries") + .WithMany("MediaSeriesSeasons") + .HasForeignKey("MediaSeriesId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("MediaSeries"); + }); + + modelBuilder.Entity("WatchIt.Database.Model.Person.Person", b => + { + b.HasOne("WatchIt.Database.Model.Common.Gender", "Gender") + .WithMany() + .HasForeignKey("GenderId"); + + b.HasOne("WatchIt.Database.Model.Person.PersonPhotoImage", "PersonPhoto") + .WithOne("Person") + .HasForeignKey("WatchIt.Database.Model.Person.Person", "PersonPhotoId"); + + b.Navigation("Gender"); + + b.Navigation("PersonPhoto"); + }); + + modelBuilder.Entity("WatchIt.Database.Model.Person.PersonActorRole", b => + { + b.HasOne("WatchIt.Database.Model.Media.Media", "Media") + .WithMany("PersonActorRoles") + .HasForeignKey("MediaId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("WatchIt.Database.Model.Person.PersonActorRoleType", "PersonActorRoleType") + .WithMany() + .HasForeignKey("PersonActorRoleTypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("WatchIt.Database.Model.Person.Person", "Person") + .WithMany("PersonActorRoles") + .HasForeignKey("PersonId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Media"); + + b.Navigation("Person"); + + b.Navigation("PersonActorRoleType"); + }); + + modelBuilder.Entity("WatchIt.Database.Model.Person.PersonCreatorRole", b => + { + b.HasOne("WatchIt.Database.Model.Media.Media", "Media") + .WithMany("PersonCreatorRoles") + .HasForeignKey("MediaId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("WatchIt.Database.Model.Person.PersonCreatorRoleType", "PersonCreatorRoleType") + .WithMany() + .HasForeignKey("PersonCreatorRoleTypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("WatchIt.Database.Model.Person.Person", "Person") + .WithMany("PersonCreatorRoles") + .HasForeignKey("PersonId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Media"); + + b.Navigation("Person"); + + b.Navigation("PersonCreatorRoleType"); + }); + + modelBuilder.Entity("WatchIt.Database.Model.Rating.RatingMedia", b => + { + b.HasOne("WatchIt.Database.Model.Account.Account", "Account") + .WithMany("RatingMedia") + .HasForeignKey("AccountId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("WatchIt.Database.Model.Media.Media", "Media") + .WithMany("RatingMedia") + .HasForeignKey("MediaId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Account"); + + b.Navigation("Media"); + }); + + modelBuilder.Entity("WatchIt.Database.Model.Rating.RatingMediaSeriesEpisode", b => + { + b.HasOne("WatchIt.Database.Model.Account.Account", "Account") + .WithMany("RatingMediaSeriesEpisode") + .HasForeignKey("AccountId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("WatchIt.Database.Model.Media.MediaSeriesEpisode", "MediaSeriesEpisode") + .WithMany("RatingMediaSeriesEpisode") + .HasForeignKey("MediaSeriesEpisodeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Account"); + + b.Navigation("MediaSeriesEpisode"); + }); + + modelBuilder.Entity("WatchIt.Database.Model.Rating.RatingMediaSeriesSeason", b => + { + b.HasOne("WatchIt.Database.Model.Account.Account", "Account") + .WithMany("RatingMediaSeriesSeason") + .HasForeignKey("AccountId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("WatchIt.Database.Model.Media.MediaSeriesSeason", "MediaSeriesSeason") + .WithMany("RatingMediaSeriesSeason") + .HasForeignKey("MediaSeriesSeasonId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Account"); + + b.Navigation("MediaSeriesSeason"); + }); + + modelBuilder.Entity("WatchIt.Database.Model.Rating.RatingPersonActorRole", b => + { + b.HasOne("WatchIt.Database.Model.Account.Account", "Account") + .WithMany("RatingPersonActorRole") + .HasForeignKey("AccountId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("WatchIt.Database.Model.Person.PersonActorRole", "PersonActorRole") + .WithMany("RatingPersonActorRole") + .HasForeignKey("PersonActorRoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Account"); + + b.Navigation("PersonActorRole"); + }); + + modelBuilder.Entity("WatchIt.Database.Model.Rating.RatingPersonCreatorRole", b => + { + b.HasOne("WatchIt.Database.Model.Account.Account", "Account") + .WithMany("RatingPersonCreatorRole") + .HasForeignKey("AccountId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("WatchIt.Database.Model.Person.PersonCreatorRole", "PersonCreatorRole") + .WithMany("RatingPersonCreatorRole") + .HasForeignKey("PersonCreatorRoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Account"); + + b.Navigation("PersonCreatorRole"); + }); + + modelBuilder.Entity("WatchIt.Database.Model.ViewCount.ViewCountMedia", b => + { + b.HasOne("WatchIt.Database.Model.Media.Media", "Media") + .WithMany("ViewCountsMedia") + .HasForeignKey("MediaId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Media"); + }); + + modelBuilder.Entity("WatchIt.Database.Model.ViewCount.ViewCountPerson", b => + { + b.HasOne("WatchIt.Database.Model.Person.Person", "Person") + .WithMany("ViewCountsPerson") + .HasForeignKey("PersonId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Person"); + }); + + modelBuilder.Entity("WatchIt.Database.Model.Account.Account", b => + { + b.Navigation("AccountRefreshTokens"); + + b.Navigation("RatingMedia"); + + b.Navigation("RatingMediaSeriesEpisode"); + + b.Navigation("RatingMediaSeriesSeason"); + + b.Navigation("RatingPersonActorRole"); + + b.Navigation("RatingPersonCreatorRole"); + }); + + modelBuilder.Entity("WatchIt.Database.Model.Account.AccountProfilePicture", b => + { + b.Navigation("Account") + .IsRequired(); + }); + + modelBuilder.Entity("WatchIt.Database.Model.Common.Country", b => + { + b.Navigation("MediaProductionCountries"); + }); + + modelBuilder.Entity("WatchIt.Database.Model.Common.Genre", b => + { + b.Navigation("MediaGenres"); + }); + + modelBuilder.Entity("WatchIt.Database.Model.Media.Media", b => + { + b.Navigation("MediaGenres"); + + b.Navigation("MediaPhotoImages"); + + b.Navigation("MediaProductionCountries"); + + b.Navigation("PersonActorRoles"); + + b.Navigation("PersonCreatorRoles"); + + b.Navigation("RatingMedia"); + + b.Navigation("ViewCountsMedia"); + }); + + modelBuilder.Entity("WatchIt.Database.Model.Media.MediaPhotoImage", b => + { + b.Navigation("MediaPhotoImageBackground"); + }); + + modelBuilder.Entity("WatchIt.Database.Model.Media.MediaPosterImage", b => + { + b.Navigation("Media") + .IsRequired(); + }); + + modelBuilder.Entity("WatchIt.Database.Model.Media.MediaSeries", b => + { + b.Navigation("MediaSeriesSeasons"); + }); + + modelBuilder.Entity("WatchIt.Database.Model.Media.MediaSeriesEpisode", b => + { + b.Navigation("RatingMediaSeriesEpisode"); + }); + + modelBuilder.Entity("WatchIt.Database.Model.Media.MediaSeriesSeason", b => + { + b.Navigation("MediaSeriesEpisodes"); + + b.Navigation("RatingMediaSeriesSeason"); + }); + + modelBuilder.Entity("WatchIt.Database.Model.Person.Person", b => + { + b.Navigation("PersonActorRoles"); + + b.Navigation("PersonCreatorRoles"); + + b.Navigation("ViewCountsPerson"); + }); + + modelBuilder.Entity("WatchIt.Database.Model.Person.PersonActorRole", b => + { + b.Navigation("RatingPersonActorRole"); + }); + + modelBuilder.Entity("WatchIt.Database.Model.Person.PersonCreatorRole", b => + { + b.Navigation("RatingPersonCreatorRole"); + }); + + modelBuilder.Entity("WatchIt.Database.Model.Person.PersonPhotoImage", b => + { + b.Navigation("Person") + .IsRequired(); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/WatchIt.Database/WatchIt.Database/Migrations/20241102132802_RatingDate.cs b/WatchIt.Database/WatchIt.Database/Migrations/20241102132802_RatingDate.cs new file mode 100644 index 0000000..8262578 --- /dev/null +++ b/WatchIt.Database/WatchIt.Database/Migrations/20241102132802_RatingDate.cs @@ -0,0 +1,92 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace WatchIt.Database.Migrations +{ + /// + public partial class RatingDate : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "Date", + table: "RatingsPersonCreatorRole", + type: "timestamp with time zone", + nullable: false, + defaultValueSql: "now()"); + + migrationBuilder.AddColumn( + name: "Date", + table: "RatingsPersonActorRole", + type: "timestamp with time zone", + nullable: false, + defaultValueSql: "now()"); + + migrationBuilder.AddColumn( + name: "Date", + table: "RatingsMediaSeriesSeason", + type: "timestamp with time zone", + nullable: false, + defaultValueSql: "now()"); + + migrationBuilder.AddColumn( + name: "Date", + table: "RatingsMediaSeriesEpisode", + type: "timestamp with time zone", + nullable: false, + defaultValueSql: "now()"); + + migrationBuilder.AddColumn( + name: "Date", + table: "RatingsMedia", + type: "timestamp with time zone", + nullable: false, + defaultValueSql: "now()"); + + migrationBuilder.AlterColumn( + name: "RoleName", + table: "PersonActorRoles", + type: "character varying(100)", + maxLength: 100, + nullable: false, + oldClrType: typeof(string), + oldType: "text"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "Date", + table: "RatingsPersonCreatorRole"); + + migrationBuilder.DropColumn( + name: "Date", + table: "RatingsPersonActorRole"); + + migrationBuilder.DropColumn( + name: "Date", + table: "RatingsMediaSeriesSeason"); + + migrationBuilder.DropColumn( + name: "Date", + table: "RatingsMediaSeriesEpisode"); + + migrationBuilder.DropColumn( + name: "Date", + table: "RatingsMedia"); + + migrationBuilder.AlterColumn( + name: "RoleName", + table: "PersonActorRoles", + type: "text", + nullable: false, + oldClrType: typeof(string), + oldType: "character varying(100)", + oldMaxLength: 100); + } + } +} diff --git a/WatchIt.Database/WatchIt.Database/Migrations/DatabaseContextModelSnapshot.cs b/WatchIt.Database/WatchIt.Database/Migrations/DatabaseContextModelSnapshot.cs index dce4d31..40c20dc 100644 --- a/WatchIt.Database/WatchIt.Database/Migrations/DatabaseContextModelSnapshot.cs +++ b/WatchIt.Database/WatchIt.Database/Migrations/DatabaseContextModelSnapshot.cs @@ -108,9 +108,9 @@ namespace WatchIt.Database.Migrations Email = "root@watch.it", IsAdmin = true, LastActive = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), - LeftSalt = "@(0PF{b6Ot?HO*:yF5`L", - Password = new byte[] { 254, 122, 19, 59, 187, 100, 174, 87, 55, 108, 14, 10, 123, 186, 129, 243, 145, 136, 152, 220, 72, 170, 196, 93, 54, 88, 192, 115, 128, 76, 133, 9, 181, 99, 181, 8, 102, 123, 197, 251, 85, 167, 146, 28, 116, 249, 118, 87, 146, 8, 194, 238, 127, 19, 33, 28, 14, 222, 218, 170, 74, 40, 223, 232 }, - RightSalt = "=pt,3T0#CfC1[}Zfp{/u", + LeftSalt = "YuJiv1\"R'*0odl8${\\|S", + Password = new byte[] { 215, 154, 186, 191, 12, 223, 76, 105, 137, 67, 41, 138, 26, 3, 38, 36, 0, 71, 40, 84, 153, 152, 105, 239, 55, 60, 164, 15, 99, 175, 133, 175, 227, 245, 102, 9, 171, 119, 16, 234, 97, 179, 70, 29, 120, 112, 241, 91, 209, 91, 228, 164, 52, 244, 36, 207, 147, 60, 124, 66, 77, 252, 129, 151 }, + RightSalt = "oT2N=y7^5,2o'+N>d}~!", Username = "root" }); }); @@ -607,7 +607,8 @@ namespace WatchIt.Database.Migrations b.Property("RoleName") .IsRequired() - .HasColumnType("text"); + .HasMaxLength(100) + .HasColumnType("character varying(100)"); b.HasKey("Id"); @@ -766,6 +767,11 @@ namespace WatchIt.Database.Migrations b.Property("AccountId") .HasColumnType("bigint"); + b.Property("Date") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + b.Property("MediaId") .HasColumnType("bigint"); @@ -793,6 +799,11 @@ namespace WatchIt.Database.Migrations b.Property("AccountId") .HasColumnType("bigint"); + b.Property("Date") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + b.Property("MediaSeriesEpisodeId") .HasColumnType("uuid"); @@ -820,6 +831,11 @@ namespace WatchIt.Database.Migrations b.Property("AccountId") .HasColumnType("bigint"); + b.Property("Date") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + b.Property("MediaSeriesSeasonId") .HasColumnType("uuid"); @@ -847,6 +863,11 @@ namespace WatchIt.Database.Migrations b.Property("AccountId") .HasColumnType("bigint"); + b.Property("Date") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + b.Property("PersonActorRoleId") .HasColumnType("uuid"); @@ -874,6 +895,11 @@ namespace WatchIt.Database.Migrations b.Property("AccountId") .HasColumnType("bigint"); + b.Property("Date") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + b.Property("PersonCreatorRoleId") .HasColumnType("uuid"); diff --git a/WatchIt.Website/WatchIt.Website/App.razor b/WatchIt.Website/WatchIt.Website/App.razor index fda64f7..5ceca05 100644 --- a/WatchIt.Website/WatchIt.Website/App.razor +++ b/WatchIt.Website/WatchIt.Website/App.razor @@ -13,7 +13,7 @@ - + diff --git a/WatchIt.Website/WatchIt.Website/Components/Pages/HomePage/Panels/ViewRankPanelComponent.razor b/WatchIt.Website/WatchIt.Website/Components/Common/Panels/HorizontalListPanelComponent.razor similarity index 60% rename from WatchIt.Website/WatchIt.Website/Components/Pages/HomePage/Panels/ViewRankPanelComponent.razor rename to WatchIt.Website/WatchIt.Website/Components/Common/Panels/HorizontalListPanelComponent.razor index 572eb03..a5485a0 100644 --- a/WatchIt.Website/WatchIt.Website/Components/Pages/HomePage/Panels/ViewRankPanelComponent.razor +++ b/WatchIt.Website/WatchIt.Website/Components/Common/Panels/HorizontalListPanelComponent.razor @@ -1,12 +1,10 @@ -@using WatchIt.Website.Components.Pages.HomePage.Subcomponents - @typeparam TItem
- Top @(Count) @(Name) this week by popularity + @(Title) @if (_loaded) {
@@ -18,10 +16,10 @@ { @{int iCopy = i;} - + }
diff --git a/WatchIt.Website/WatchIt.Website/Components/Pages/HomePage/Panels/ViewRankPanelComponent.razor.cs b/WatchIt.Website/WatchIt.Website/Components/Common/Panels/HorizontalListPanelComponent.razor.cs similarity index 73% rename from WatchIt.Website/WatchIt.Website/Components/Pages/HomePage/Panels/ViewRankPanelComponent.razor.cs rename to WatchIt.Website/WatchIt.Website/Components/Common/Panels/HorizontalListPanelComponent.razor.cs index 61d983d..971d659 100644 --- a/WatchIt.Website/WatchIt.Website/Components/Pages/HomePage/Panels/ViewRankPanelComponent.razor.cs +++ b/WatchIt.Website/WatchIt.Website/Components/Common/Panels/HorizontalListPanelComponent.razor.cs @@ -3,19 +3,19 @@ using Microsoft.AspNetCore.Components; using WatchIt.Common.Model; using WatchIt.Common.Query; -namespace WatchIt.Website.Components.Pages.HomePage.Panels; +namespace WatchIt.Website.Components.Common.Panels; -public partial class ViewRankPanelComponent : ComponentBase +public partial class HorizontalListPanelComponent : ComponentBase { #region PARAMETERS [Parameter] public int Count { get; set; } = 5; - [Parameter] public required string Name {get; set; } - [Parameter] public required Func>, Task> GetViewRankAction { get; set; } + [Parameter] public required string Title {get; set; } + [Parameter] public required Func>, Task> GetItemsAction { get; set; } [Parameter] public required string ItemUrlFormatString { get; set; } [Parameter] public required Func IdSource { get; set; } [Parameter] public required Func NameSource { get; set; } - [Parameter] public required string PosterPlaceholder {get; set; } + [Parameter] public required string PosterPlaceholder { get; set; } [Parameter] public required Func, Task> GetPictureAction { get; set; } #endregion @@ -43,7 +43,7 @@ public partial class ViewRankPanelComponent : ComponentBase // STEP 0 endTasks.AddRange( [ - GetViewRankAction(Count, data => _items = data) + GetItemsAction(data => _items = data) ]); // END diff --git a/WatchIt.Website/WatchIt.Website/Components/Pages/HomePage/Subcomponents/ViewRankItemComponent.razor b/WatchIt.Website/WatchIt.Website/Components/Common/Subcomponents/HorizontalListItemComponent.razor similarity index 100% rename from WatchIt.Website/WatchIt.Website/Components/Pages/HomePage/Subcomponents/ViewRankItemComponent.razor rename to WatchIt.Website/WatchIt.Website/Components/Common/Subcomponents/HorizontalListItemComponent.razor diff --git a/WatchIt.Website/WatchIt.Website/Components/Pages/HomePage/Subcomponents/ViewRankItemComponent.razor.cs b/WatchIt.Website/WatchIt.Website/Components/Common/Subcomponents/HorizontalListItemComponent.razor.cs similarity index 88% rename from WatchIt.Website/WatchIt.Website/Components/Pages/HomePage/Subcomponents/ViewRankItemComponent.razor.cs rename to WatchIt.Website/WatchIt.Website/Components/Common/Subcomponents/HorizontalListItemComponent.razor.cs index 16ec507..f80bcf4 100644 --- a/WatchIt.Website/WatchIt.Website/Components/Pages/HomePage/Subcomponents/ViewRankItemComponent.razor.cs +++ b/WatchIt.Website/WatchIt.Website/Components/Common/Subcomponents/HorizontalListItemComponent.razor.cs @@ -1,9 +1,9 @@ using Microsoft.AspNetCore.Components; using WatchIt.Common.Model; -namespace WatchIt.Website.Components.Pages.HomePage.Subcomponents; +namespace WatchIt.Website.Components.Common.Subcomponents; -public partial class ViewRankItemComponent : ComponentBase +public partial class HorizontalListItemComponent : ComponentBase { #region PARAMETERS diff --git a/WatchIt.Website/WatchIt.Website/Components/Pages/HomePage/Subcomponents/ViewRankItemComponent.razor.css b/WatchIt.Website/WatchIt.Website/Components/Common/Subcomponents/HorizontalListItemComponent.razor.css similarity index 100% rename from WatchIt.Website/WatchIt.Website/Components/Pages/HomePage/Subcomponents/ViewRankItemComponent.razor.css rename to WatchIt.Website/WatchIt.Website/Components/Common/Subcomponents/HorizontalListItemComponent.razor.css diff --git a/WatchIt.Website/WatchIt.Website/Components/Pages/UserPage/Subcomponents/MoviesRatedFilterFormComponent.razor b/WatchIt.Website/WatchIt.Website/Components/Pages/UserPage/Subcomponents/MoviesRatedFilterFormComponent.razor index 5712d5b..a5ddc12 100644 --- a/WatchIt.Website/WatchIt.Website/Components/Pages/UserPage/Subcomponents/MoviesRatedFilterFormComponent.razor +++ b/WatchIt.Website/WatchIt.Website/Components/Pages/UserPage/Subcomponents/MoviesRatedFilterFormComponent.razor @@ -70,5 +70,13 @@
+
+
+ User rating date + + - + +
+
\ No newline at end of file diff --git a/WatchIt.Website/WatchIt.Website/Components/Pages/UserPage/Subcomponents/PersonsRatedFilterFormComponent.razor b/WatchIt.Website/WatchIt.Website/Components/Pages/UserPage/Subcomponents/PersonsRatedFilterFormComponent.razor index 9b59149..e1fe738 100644 --- a/WatchIt.Website/WatchIt.Website/Components/Pages/UserPage/Subcomponents/PersonsRatedFilterFormComponent.razor +++ b/WatchIt.Website/WatchIt.Website/Components/Pages/UserPage/Subcomponents/PersonsRatedFilterFormComponent.razor @@ -8,25 +8,25 @@
- Name + Name
- Full name + Full name
- Description + Description
- Birth date + Birth date - @@ -34,7 +34,7 @@
- Death date + Death date - @@ -42,7 +42,7 @@
- Gender + Gender @foreach (GenderResponse gender in _genders) @@ -54,7 +54,7 @@
- Rating (count) + Rating (count) - @@ -62,7 +62,7 @@
- Rating (average) + Rating (average) - @@ -70,7 +70,7 @@
- User rating (count) + User rating (count) - @@ -78,11 +78,19 @@
- User rating (average) + User rating (average) -
+
+
+ User rating (date) + + - + +
+
\ No newline at end of file diff --git a/WatchIt.Website/WatchIt.Website/Components/Pages/UserPage/Subcomponents/SeriesRatedFilterFormComponent.razor b/WatchIt.Website/WatchIt.Website/Components/Pages/UserPage/Subcomponents/SeriesRatedFilterFormComponent.razor index 7c23456..2a93f8d 100644 --- a/WatchIt.Website/WatchIt.Website/Components/Pages/UserPage/Subcomponents/SeriesRatedFilterFormComponent.razor +++ b/WatchIt.Website/WatchIt.Website/Components/Pages/UserPage/Subcomponents/SeriesRatedFilterFormComponent.razor @@ -73,5 +73,13 @@
+
+
+ User rating date + + - + +
+
\ No newline at end of file diff --git a/WatchIt.Website/WatchIt.Website/Pages/HomePage.razor b/WatchIt.Website/WatchIt.Website/Pages/HomePage.razor index 7a43a22..459cd3c 100644 --- a/WatchIt.Website/WatchIt.Website/Pages/HomePage.razor +++ b/WatchIt.Website/WatchIt.Website/Pages/HomePage.razor @@ -1,7 +1,6 @@ @using WatchIt.Common.Model.Movies @using WatchIt.Common.Model.Persons @using WatchIt.Common.Model.Series -@using WatchIt.Website.Components.Pages.HomePage.Panels @page "/" @@ -10,28 +9,28 @@
- - - + + +
\ No newline at end of file diff --git a/WatchIt.Website/WatchIt.Website/Pages/UserPage.razor b/WatchIt.Website/WatchIt.Website/Pages/UserPage.razor index 06cde8a..1e1d3cf 100644 --- a/WatchIt.Website/WatchIt.Website/Pages/UserPage.razor +++ b/WatchIt.Website/WatchIt.Website/Pages/UserPage.razor @@ -65,7 +65,35 @@ - +
+ + + +
@@ -81,7 +109,7 @@ UrlIdTemplate="/media/{0}" PictureDownloadingTask="@((id, action) => MediaClientService.GetMediaPoster(id, action))" ItemDownloadingTask="@((query, action) => AccountsClientService.GetAccountRatedMovies(Id!.Value, query, action))" - SortingOptions="@(new Dictionary { { "user_rating", "User rating" }, { "rating.count", "Number of ratings" }, { "rating.average", "Average rating" }, { "title", "Title" }, { "release_date", "Release date" } })" + SortingOptions="@(new Dictionary { { "user_rating", "User rating" }, { "user_rating_date", "User rating date" }, { "rating.count", "Number of ratings" }, { "rating.average", "Average rating" }, { "title", "Title" }, { "release_date", "Release date" } })" PosterPlaceholder="/assets/media_poster.png" GetGlobalRatingMethod="@((id, action) => MediaClientService.GetMediaRating(id, action))" GetUserRatingMethod="@((id, userId, successAction, notfoundAction) => MediaClientService.GetMediaRatingByUser(id, userId, successAction, notfoundAction))" @@ -105,7 +133,7 @@ UrlIdTemplate="/media/{0}" PictureDownloadingTask="@((id, action) => MediaClientService.GetMediaPoster(id, action))" ItemDownloadingTask="@((query, action) => AccountsClientService.GetAccountRatedSeries(Id!.Value, query, action))" - SortingOptions="@(new Dictionary { { "user_rating", "User rating" }, { "rating.count", "Number of ratings" }, { "rating.average", "Average rating" }, { "title", "Title" }, { "release_date", "Release date" } })" + SortingOptions="@(new Dictionary { { "user_rating", "User rating" }, { "user_rating_date", "User rating date" }, { "rating.count", "Number of ratings" }, { "rating.average", "Average rating" }, { "title", "Title" }, { "release_date", "Release date" } })" PosterPlaceholder="/assets/media_poster.png" GetGlobalRatingMethod="@((id, action) => MediaClientService.GetMediaRating(id, action))" GetUserRatingMethod="@((id, userId, successAction, notfoundAction) => MediaClientService.GetMediaRatingByUser(id, userId, successAction, notfoundAction))" @@ -132,6 +160,7 @@ { { "user_rating.average", "Average user rating" }, { "user_rating.count", "Number of user ratings" }, + { "user_rating_last_date", "User rating date" }, { "rating.average", "Average rating" }, { "rating.count", "Number of ratings" }, { "name", "Name" }, diff --git a/WatchIt.sln b/WatchIt.sln deleted file mode 100644 index 38b4a56..0000000 --- a/WatchIt.sln +++ /dev/null @@ -1,241 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "WatchIt.Website", "WatchIt.Website", "{4CB91BF6-87F1-4088-A943-62548CD1F9F4}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "WatchIt.Database", "WatchIt.Database", "{15BAFF8D-02CA-4B6D-BB81-E0AA135FEDAF}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "WatchIt.WebAPI", "WatchIt.WebAPI", "{301EEE5B-B54C-491F-ADDA-58E3F4448684}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WatchIt.Database", "WatchIt.Database\WatchIt.Database\WatchIt.Database.csproj", "{23383776-1F27-4B5D-8C7C-57BFF75FA473}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WatchIt.WebAPI.WorkerServices", "WatchIt.WebAPI\WatchIt.WebAPI.WorkerServices\WatchIt.WebAPI.WorkerServices.csproj", "{0EAD71FB-ED04-4054-9071-61A14FC89B27}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WatchIt.WebAPI", "WatchIt.WebAPI\WatchIt.WebAPI\WatchIt.WebAPI.csproj", "{E8907CA7-18D5-4DB0-AEAB-911B85DDA63D}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "WatchIt.Database.Model", "WatchIt.Database.Model", "{2BCB1F43-033A-4CED-A88C-4126B7CAE107}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WatchIt.Database.Model", "WatchIt.Database\WatchIt.Database.Model\WatchIt.Database.Model\WatchIt.Database.Model.csproj", "{23F6E4EC-3105-4E94-905B-E6939C528224}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WatchIt.Database.Model.Configuration", "WatchIt.Database\WatchIt.Database.Model\WatchIt.Database.Model.Configuration\WatchIt.Database.Model.Configuration.csproj", "{698BD418-94F5-4500-80B8-79B1955C9C9F}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WatchIt.Database.Model.Seeding", "WatchIt.Database\WatchIt.Database.Model\WatchIt.Database.Model.Seeding\WatchIt.Database.Model.Seeding.csproj", "{11470B68-F26D-4F15-90CC-25B11A1A36AB}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WatchIt.WebAPI.Controllers", "WatchIt.WebAPI\WatchIt.WebAPI.Controllers\WatchIt.WebAPI.Controllers.csproj", "{B5EA38DF-F396-44DF-80EE-7639EDBEF8BC}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WatchIt.WebAPI.Validators", "WatchIt.WebAPI\WatchIt.WebAPI.Validators\WatchIt.WebAPI.Validators.csproj", "{C05705D7-6E53-4BF1-840F-BC5FAB7C1C4E}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "WatchIt.WebAPI.Services", "WatchIt.WebAPI.Services", "{9A652B6B-EF78-4029-91A4-AD48168CBF2B}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "WatchIt.WebAPI.Services.Controllers", "WatchIt.WebAPI.Services.Controllers", "{CEC468DB-CC49-47D3-9E3E-1CC9530C3CE7}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WatchIt.WebAPI.Services.Controllers.Common", "WatchIt.WebAPI\WatchIt.WebAPI.Services\WatchIt.WebAPI.Services.Controllers\WatchIt.WebAPI.Services.Controllers.Common\WatchIt.WebAPI.Services.Controllers.Common.csproj", "{A0AA9F70-44A6-49DA-ACC4-ACF0E2F16316}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "WatchIt.Common", "WatchIt.Common", "{E98C42C1-26E5-4939-8C22-72C253DE874B}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WatchIt.Common.Model", "WatchIt.Common\WatchIt.Common.Model\WatchIt.Common.Model.csproj", "{C7FF493E-C2E4-4498-8212-D4CBD8C234B9}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WatchIt.WebAPI.Services.Controllers.Accounts", "WatchIt.WebAPI\WatchIt.WebAPI.Services\WatchIt.WebAPI.Services.Controllers\WatchIt.WebAPI.Services.Controllers.Accounts\WatchIt.WebAPI.Services.Controllers.Accounts.csproj", "{BB1ACEB6-6834-44D0-8382-DE4E3B297632}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "WatchIt.WebAPI.Services.Utility", "WatchIt.WebAPI.Services.Utility", "{BD014A3C-E574-4ADF-A2E4-9B2D754A854D}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WatchIt.WebAPI.Services.Utility.Tokens", "WatchIt.WebAPI\WatchIt.WebAPI.Services\WatchIt.WebAPI.Services.Utility\WatchIt.WebAPI.Services.Utility.Tokens\WatchIt.WebAPI.Services.Utility.Tokens.csproj", "{261C0D38-4D5C-4775-9BF9-819FE30D6ECB}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WatchIt.WebAPI.Services.Utility.Configuration", "WatchIt.WebAPI\WatchIt.WebAPI.Services\WatchIt.WebAPI.Services.Utility\WatchIt.WebAPI.Services.Utility.Configuration\WatchIt.WebAPI.Services.Utility.Configuration.csproj", "{3B5A06E2-6A5A-4BBF-944D-0E08141A94DA}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WatchIt.WebAPI.Services.Utility.User", "WatchIt.WebAPI\WatchIt.WebAPI.Services\WatchIt.WebAPI.Services.Utility\WatchIt.WebAPI.Services.Utility.User\WatchIt.WebAPI.Services.Utility.User.csproj", "{55777911-8032-4607-B533-12941A52019F}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WatchIt.WebAPI.Services.Controllers.Genres", "WatchIt.WebAPI\WatchIt.WebAPI.Services\WatchIt.WebAPI.Services.Controllers\WatchIt.WebAPI.Services.Controllers.Genres\WatchIt.WebAPI.Services.Controllers.Genres.csproj", "{2EC6FD28-C580-45FA-B6A7-92A6BF0CCC54}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WatchIt.Website", "WatchIt.Website\WatchIt.Website\WatchIt.Website.csproj", "{46CE78A1-3EC3-4112-AAAD-26EEB8D8B194}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WatchIt.WebAPI.Services.Controllers.Movies", "WatchIt.WebAPI\WatchIt.WebAPI.Services\WatchIt.WebAPI.Services.Controllers\WatchIt.WebAPI.Services.Controllers.Movies\WatchIt.WebAPI.Services.Controllers.Movies.csproj", "{69BB6A9E-B673-42AB-A516-6B2513E21FDC}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "WatchIt.Website.Services", "WatchIt.Website.Services", "{A82972D0-9A60-4B3F-AE46-9F304D79137F}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "WatchIt.Common.Services", "WatchIt.Common.Services", "{882A9795-4AC0-4556-9750-6582B2701EFA}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WatchIt.Common.Query", "WatchIt.Common\WatchIt.Common.Query\WatchIt.Common.Query.csproj", "{6C3AE7B4-18C5-42D3-B254-460027E50143}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WatchIt.Common.Services.HttpClient", "WatchIt.Common\WatchIt.Common.Services\WatchIt.Common.Services.HttpClient\WatchIt.Common.Services.HttpClient.csproj", "{A4A75CCA-0DEE-4F1E-9816-60674CA807FA}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WatchIt.Website.Services.Configuration", "WatchIt.Website\WatchIt.Website.Services\WatchIt.Website.Services.Configuration\WatchIt.Website.Services.Configuration.csproj", "{0DBBE7EA-05FE-481F-8814-6FA0BC9E571F}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WatchIt.WebAPI.Services.Controllers.Media", "WatchIt.WebAPI\WatchIt.WebAPI.Services\WatchIt.WebAPI.Services.Controllers\WatchIt.WebAPI.Services.Controllers.Media\WatchIt.WebAPI.Services.Controllers.Media.csproj", "{3156AD7B-D6EC-4EB6-AEE8-4FBAF14C18E4}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WatchIt.WebAPI.Services.Controllers.Series", "WatchIt.WebAPI\WatchIt.WebAPI.Services\WatchIt.WebAPI.Services.Controllers\WatchIt.WebAPI.Services.Controllers.Series\WatchIt.WebAPI.Services.Controllers.Series.csproj", "{F8FCEF7B-72EA-48BC-AC68-E11244B067DD}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WatchIt.WebAPI.Services.Controllers.Photos", "WatchIt.WebAPI\WatchIt.WebAPI.Services\WatchIt.WebAPI.Services.Controllers\WatchIt.WebAPI.Services.Controllers.Photos\WatchIt.WebAPI.Services.Controllers.Photos.csproj", "{ABDF8471-2FAB-4930-B016-7DD3E48AE6B8}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WatchIt.WebAPI.Services.Controllers.Persons", "WatchIt.WebAPI\WatchIt.WebAPI.Services\WatchIt.WebAPI.Services.Controllers\WatchIt.WebAPI.Services.Controllers.Persons\WatchIt.WebAPI.Services.Controllers.Persons.csproj", "{335686F5-65B8-4D66-AAA8-C5032906451D}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WatchIt.WebAPI.Services.Controllers.Genders", "WatchIt.WebAPI\WatchIt.WebAPI.Services\WatchIt.WebAPI.Services.Controllers\WatchIt.WebAPI.Services.Controllers.Genders\WatchIt.WebAPI.Services.Controllers.Genders.csproj", "{13BE36AB-2120-4F1B-815A-6F5E3F589EE8}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WatchIt.WebAPI.Services.Controllers.Roles", "WatchIt.WebAPI\WatchIt.WebAPI.Services\WatchIt.WebAPI.Services.Controllers\WatchIt.WebAPI.Services.Controllers.Roles\WatchIt.WebAPI.Services.Controllers.Roles.csproj", "{847D157A-E486-4FB6-9AA3-43931A60FB5F}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WatchIt.Website.Services.Tokens", "WatchIt.Website\WatchIt.Website.Services\WatchIt.Website.Services.Tokens\WatchIt.Website.Services.Tokens.csproj", "{188CE560-A1DC-459D-BF41-1B62E5C0D7B5}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WatchIt.Website.Services.Authentication", "WatchIt.Website\WatchIt.Website.Services\WatchIt.Website.Services.Authentication\WatchIt.Website.Services.Authentication.csproj", "{B647BAB2-D261-40A0-95AF-95E8A2F00ED1}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WatchIt.Website.Services.Client", "WatchIt.Website\WatchIt.Website.Services\WatchIt.Website.Services.Client\WatchIt.Website.Services.Client.csproj", "{C9FCD231-3BC9-4453-8949-F521D2D71BCF}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(NestedProjects) = preSolution - {23383776-1F27-4B5D-8C7C-57BFF75FA473} = {15BAFF8D-02CA-4B6D-BB81-E0AA135FEDAF} - {0EAD71FB-ED04-4054-9071-61A14FC89B27} = {301EEE5B-B54C-491F-ADDA-58E3F4448684} - {E8907CA7-18D5-4DB0-AEAB-911B85DDA63D} = {301EEE5B-B54C-491F-ADDA-58E3F4448684} - {2BCB1F43-033A-4CED-A88C-4126B7CAE107} = {15BAFF8D-02CA-4B6D-BB81-E0AA135FEDAF} - {23F6E4EC-3105-4E94-905B-E6939C528224} = {2BCB1F43-033A-4CED-A88C-4126B7CAE107} - {698BD418-94F5-4500-80B8-79B1955C9C9F} = {2BCB1F43-033A-4CED-A88C-4126B7CAE107} - {11470B68-F26D-4F15-90CC-25B11A1A36AB} = {2BCB1F43-033A-4CED-A88C-4126B7CAE107} - {B5EA38DF-F396-44DF-80EE-7639EDBEF8BC} = {301EEE5B-B54C-491F-ADDA-58E3F4448684} - {C05705D7-6E53-4BF1-840F-BC5FAB7C1C4E} = {301EEE5B-B54C-491F-ADDA-58E3F4448684} - {9A652B6B-EF78-4029-91A4-AD48168CBF2B} = {301EEE5B-B54C-491F-ADDA-58E3F4448684} - {CEC468DB-CC49-47D3-9E3E-1CC9530C3CE7} = {9A652B6B-EF78-4029-91A4-AD48168CBF2B} - {A0AA9F70-44A6-49DA-ACC4-ACF0E2F16316} = {CEC468DB-CC49-47D3-9E3E-1CC9530C3CE7} - {C7FF493E-C2E4-4498-8212-D4CBD8C234B9} = {E98C42C1-26E5-4939-8C22-72C253DE874B} - {BB1ACEB6-6834-44D0-8382-DE4E3B297632} = {CEC468DB-CC49-47D3-9E3E-1CC9530C3CE7} - {BD014A3C-E574-4ADF-A2E4-9B2D754A854D} = {9A652B6B-EF78-4029-91A4-AD48168CBF2B} - {261C0D38-4D5C-4775-9BF9-819FE30D6ECB} = {BD014A3C-E574-4ADF-A2E4-9B2D754A854D} - {3B5A06E2-6A5A-4BBF-944D-0E08141A94DA} = {BD014A3C-E574-4ADF-A2E4-9B2D754A854D} - {55777911-8032-4607-B533-12941A52019F} = {BD014A3C-E574-4ADF-A2E4-9B2D754A854D} - {2EC6FD28-C580-45FA-B6A7-92A6BF0CCC54} = {CEC468DB-CC49-47D3-9E3E-1CC9530C3CE7} - {46CE78A1-3EC3-4112-AAAD-26EEB8D8B194} = {4CB91BF6-87F1-4088-A943-62548CD1F9F4} - {69BB6A9E-B673-42AB-A516-6B2513E21FDC} = {CEC468DB-CC49-47D3-9E3E-1CC9530C3CE7} - {A82972D0-9A60-4B3F-AE46-9F304D79137F} = {4CB91BF6-87F1-4088-A943-62548CD1F9F4} - {882A9795-4AC0-4556-9750-6582B2701EFA} = {E98C42C1-26E5-4939-8C22-72C253DE874B} - {6C3AE7B4-18C5-42D3-B254-460027E50143} = {E98C42C1-26E5-4939-8C22-72C253DE874B} - {A4A75CCA-0DEE-4F1E-9816-60674CA807FA} = {882A9795-4AC0-4556-9750-6582B2701EFA} - {3156AD7B-D6EC-4EB6-AEE8-4FBAF14C18E4} = {CEC468DB-CC49-47D3-9E3E-1CC9530C3CE7} - {F8FCEF7B-72EA-48BC-AC68-E11244B067DD} = {CEC468DB-CC49-47D3-9E3E-1CC9530C3CE7} - {ABDF8471-2FAB-4930-B016-7DD3E48AE6B8} = {CEC468DB-CC49-47D3-9E3E-1CC9530C3CE7} - {335686F5-65B8-4D66-AAA8-C5032906451D} = {CEC468DB-CC49-47D3-9E3E-1CC9530C3CE7} - {13BE36AB-2120-4F1B-815A-6F5E3F589EE8} = {CEC468DB-CC49-47D3-9E3E-1CC9530C3CE7} - {847D157A-E486-4FB6-9AA3-43931A60FB5F} = {CEC468DB-CC49-47D3-9E3E-1CC9530C3CE7} - {188CE560-A1DC-459D-BF41-1B62E5C0D7B5} = {A82972D0-9A60-4B3F-AE46-9F304D79137F} - {B647BAB2-D261-40A0-95AF-95E8A2F00ED1} = {A82972D0-9A60-4B3F-AE46-9F304D79137F} - {0DBBE7EA-05FE-481F-8814-6FA0BC9E571F} = {A82972D0-9A60-4B3F-AE46-9F304D79137F} - {C9FCD231-3BC9-4453-8949-F521D2D71BCF} = {A82972D0-9A60-4B3F-AE46-9F304D79137F} - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {23383776-1F27-4B5D-8C7C-57BFF75FA473}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {23383776-1F27-4B5D-8C7C-57BFF75FA473}.Debug|Any CPU.Build.0 = Debug|Any CPU - {23383776-1F27-4B5D-8C7C-57BFF75FA473}.Release|Any CPU.ActiveCfg = Release|Any CPU - {23383776-1F27-4B5D-8C7C-57BFF75FA473}.Release|Any CPU.Build.0 = Release|Any CPU - {0EAD71FB-ED04-4054-9071-61A14FC89B27}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {0EAD71FB-ED04-4054-9071-61A14FC89B27}.Debug|Any CPU.Build.0 = Debug|Any CPU - {0EAD71FB-ED04-4054-9071-61A14FC89B27}.Release|Any CPU.ActiveCfg = Release|Any CPU - {0EAD71FB-ED04-4054-9071-61A14FC89B27}.Release|Any CPU.Build.0 = Release|Any CPU - {E8907CA7-18D5-4DB0-AEAB-911B85DDA63D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {E8907CA7-18D5-4DB0-AEAB-911B85DDA63D}.Debug|Any CPU.Build.0 = Debug|Any CPU - {E8907CA7-18D5-4DB0-AEAB-911B85DDA63D}.Release|Any CPU.ActiveCfg = Release|Any CPU - {E8907CA7-18D5-4DB0-AEAB-911B85DDA63D}.Release|Any CPU.Build.0 = Release|Any CPU - {23F6E4EC-3105-4E94-905B-E6939C528224}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {23F6E4EC-3105-4E94-905B-E6939C528224}.Debug|Any CPU.Build.0 = Debug|Any CPU - {23F6E4EC-3105-4E94-905B-E6939C528224}.Release|Any CPU.ActiveCfg = Release|Any CPU - {23F6E4EC-3105-4E94-905B-E6939C528224}.Release|Any CPU.Build.0 = Release|Any CPU - {698BD418-94F5-4500-80B8-79B1955C9C9F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {698BD418-94F5-4500-80B8-79B1955C9C9F}.Debug|Any CPU.Build.0 = Debug|Any CPU - {698BD418-94F5-4500-80B8-79B1955C9C9F}.Release|Any CPU.ActiveCfg = Release|Any CPU - {698BD418-94F5-4500-80B8-79B1955C9C9F}.Release|Any CPU.Build.0 = Release|Any CPU - {11470B68-F26D-4F15-90CC-25B11A1A36AB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {11470B68-F26D-4F15-90CC-25B11A1A36AB}.Debug|Any CPU.Build.0 = Debug|Any CPU - {11470B68-F26D-4F15-90CC-25B11A1A36AB}.Release|Any CPU.ActiveCfg = Release|Any CPU - {11470B68-F26D-4F15-90CC-25B11A1A36AB}.Release|Any CPU.Build.0 = Release|Any CPU - {B5EA38DF-F396-44DF-80EE-7639EDBEF8BC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B5EA38DF-F396-44DF-80EE-7639EDBEF8BC}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B5EA38DF-F396-44DF-80EE-7639EDBEF8BC}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B5EA38DF-F396-44DF-80EE-7639EDBEF8BC}.Release|Any CPU.Build.0 = Release|Any CPU - {C05705D7-6E53-4BF1-840F-BC5FAB7C1C4E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {C05705D7-6E53-4BF1-840F-BC5FAB7C1C4E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {C05705D7-6E53-4BF1-840F-BC5FAB7C1C4E}.Release|Any CPU.ActiveCfg = Release|Any CPU - {C05705D7-6E53-4BF1-840F-BC5FAB7C1C4E}.Release|Any CPU.Build.0 = Release|Any CPU - {A0AA9F70-44A6-49DA-ACC4-ACF0E2F16316}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {A0AA9F70-44A6-49DA-ACC4-ACF0E2F16316}.Debug|Any CPU.Build.0 = Debug|Any CPU - {A0AA9F70-44A6-49DA-ACC4-ACF0E2F16316}.Release|Any CPU.ActiveCfg = Release|Any CPU - {A0AA9F70-44A6-49DA-ACC4-ACF0E2F16316}.Release|Any CPU.Build.0 = Release|Any CPU - {C7FF493E-C2E4-4498-8212-D4CBD8C234B9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {C7FF493E-C2E4-4498-8212-D4CBD8C234B9}.Debug|Any CPU.Build.0 = Debug|Any CPU - {C7FF493E-C2E4-4498-8212-D4CBD8C234B9}.Release|Any CPU.ActiveCfg = Release|Any CPU - {C7FF493E-C2E4-4498-8212-D4CBD8C234B9}.Release|Any CPU.Build.0 = Release|Any CPU - {BB1ACEB6-6834-44D0-8382-DE4E3B297632}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {BB1ACEB6-6834-44D0-8382-DE4E3B297632}.Debug|Any CPU.Build.0 = Debug|Any CPU - {BB1ACEB6-6834-44D0-8382-DE4E3B297632}.Release|Any CPU.ActiveCfg = Release|Any CPU - {BB1ACEB6-6834-44D0-8382-DE4E3B297632}.Release|Any CPU.Build.0 = Release|Any CPU - {261C0D38-4D5C-4775-9BF9-819FE30D6ECB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {261C0D38-4D5C-4775-9BF9-819FE30D6ECB}.Debug|Any CPU.Build.0 = Debug|Any CPU - {261C0D38-4D5C-4775-9BF9-819FE30D6ECB}.Release|Any CPU.ActiveCfg = Release|Any CPU - {261C0D38-4D5C-4775-9BF9-819FE30D6ECB}.Release|Any CPU.Build.0 = Release|Any CPU - {3B5A06E2-6A5A-4BBF-944D-0E08141A94DA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {3B5A06E2-6A5A-4BBF-944D-0E08141A94DA}.Debug|Any CPU.Build.0 = Debug|Any CPU - {3B5A06E2-6A5A-4BBF-944D-0E08141A94DA}.Release|Any CPU.ActiveCfg = Release|Any CPU - {3B5A06E2-6A5A-4BBF-944D-0E08141A94DA}.Release|Any CPU.Build.0 = Release|Any CPU - {55777911-8032-4607-B533-12941A52019F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {55777911-8032-4607-B533-12941A52019F}.Debug|Any CPU.Build.0 = Debug|Any CPU - {55777911-8032-4607-B533-12941A52019F}.Release|Any CPU.ActiveCfg = Release|Any CPU - {55777911-8032-4607-B533-12941A52019F}.Release|Any CPU.Build.0 = Release|Any CPU - {2EC6FD28-C580-45FA-B6A7-92A6BF0CCC54}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {2EC6FD28-C580-45FA-B6A7-92A6BF0CCC54}.Debug|Any CPU.Build.0 = Debug|Any CPU - {2EC6FD28-C580-45FA-B6A7-92A6BF0CCC54}.Release|Any CPU.ActiveCfg = Release|Any CPU - {2EC6FD28-C580-45FA-B6A7-92A6BF0CCC54}.Release|Any CPU.Build.0 = Release|Any CPU - {46CE78A1-3EC3-4112-AAAD-26EEB8D8B194}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {46CE78A1-3EC3-4112-AAAD-26EEB8D8B194}.Debug|Any CPU.Build.0 = Debug|Any CPU - {46CE78A1-3EC3-4112-AAAD-26EEB8D8B194}.Release|Any CPU.ActiveCfg = Release|Any CPU - {46CE78A1-3EC3-4112-AAAD-26EEB8D8B194}.Release|Any CPU.Build.0 = Release|Any CPU - {69BB6A9E-B673-42AB-A516-6B2513E21FDC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {69BB6A9E-B673-42AB-A516-6B2513E21FDC}.Debug|Any CPU.Build.0 = Debug|Any CPU - {69BB6A9E-B673-42AB-A516-6B2513E21FDC}.Release|Any CPU.ActiveCfg = Release|Any CPU - {69BB6A9E-B673-42AB-A516-6B2513E21FDC}.Release|Any CPU.Build.0 = Release|Any CPU - {6C3AE7B4-18C5-42D3-B254-460027E50143}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {6C3AE7B4-18C5-42D3-B254-460027E50143}.Debug|Any CPU.Build.0 = Debug|Any CPU - {6C3AE7B4-18C5-42D3-B254-460027E50143}.Release|Any CPU.ActiveCfg = Release|Any CPU - {6C3AE7B4-18C5-42D3-B254-460027E50143}.Release|Any CPU.Build.0 = Release|Any CPU - {A4A75CCA-0DEE-4F1E-9816-60674CA807FA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {A4A75CCA-0DEE-4F1E-9816-60674CA807FA}.Debug|Any CPU.Build.0 = Debug|Any CPU - {A4A75CCA-0DEE-4F1E-9816-60674CA807FA}.Release|Any CPU.ActiveCfg = Release|Any CPU - {A4A75CCA-0DEE-4F1E-9816-60674CA807FA}.Release|Any CPU.Build.0 = Release|Any CPU - {0DBBE7EA-05FE-481F-8814-6FA0BC9E571F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {0DBBE7EA-05FE-481F-8814-6FA0BC9E571F}.Debug|Any CPU.Build.0 = Debug|Any CPU - {0DBBE7EA-05FE-481F-8814-6FA0BC9E571F}.Release|Any CPU.ActiveCfg = Release|Any CPU - {0DBBE7EA-05FE-481F-8814-6FA0BC9E571F}.Release|Any CPU.Build.0 = Release|Any CPU - {3156AD7B-D6EC-4EB6-AEE8-4FBAF14C18E4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {3156AD7B-D6EC-4EB6-AEE8-4FBAF14C18E4}.Debug|Any CPU.Build.0 = Debug|Any CPU - {3156AD7B-D6EC-4EB6-AEE8-4FBAF14C18E4}.Release|Any CPU.ActiveCfg = Release|Any CPU - {3156AD7B-D6EC-4EB6-AEE8-4FBAF14C18E4}.Release|Any CPU.Build.0 = Release|Any CPU - {F8FCEF7B-72EA-48BC-AC68-E11244B067DD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {F8FCEF7B-72EA-48BC-AC68-E11244B067DD}.Debug|Any CPU.Build.0 = Debug|Any CPU - {F8FCEF7B-72EA-48BC-AC68-E11244B067DD}.Release|Any CPU.ActiveCfg = Release|Any CPU - {F8FCEF7B-72EA-48BC-AC68-E11244B067DD}.Release|Any CPU.Build.0 = Release|Any CPU - {ABDF8471-2FAB-4930-B016-7DD3E48AE6B8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {ABDF8471-2FAB-4930-B016-7DD3E48AE6B8}.Debug|Any CPU.Build.0 = Debug|Any CPU - {ABDF8471-2FAB-4930-B016-7DD3E48AE6B8}.Release|Any CPU.ActiveCfg = Release|Any CPU - {ABDF8471-2FAB-4930-B016-7DD3E48AE6B8}.Release|Any CPU.Build.0 = Release|Any CPU - {335686F5-65B8-4D66-AAA8-C5032906451D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {335686F5-65B8-4D66-AAA8-C5032906451D}.Debug|Any CPU.Build.0 = Debug|Any CPU - {335686F5-65B8-4D66-AAA8-C5032906451D}.Release|Any CPU.ActiveCfg = Release|Any CPU - {335686F5-65B8-4D66-AAA8-C5032906451D}.Release|Any CPU.Build.0 = Release|Any CPU - {13BE36AB-2120-4F1B-815A-6F5E3F589EE8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {13BE36AB-2120-4F1B-815A-6F5E3F589EE8}.Debug|Any CPU.Build.0 = Debug|Any CPU - {13BE36AB-2120-4F1B-815A-6F5E3F589EE8}.Release|Any CPU.ActiveCfg = Release|Any CPU - {13BE36AB-2120-4F1B-815A-6F5E3F589EE8}.Release|Any CPU.Build.0 = Release|Any CPU - {847D157A-E486-4FB6-9AA3-43931A60FB5F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {847D157A-E486-4FB6-9AA3-43931A60FB5F}.Debug|Any CPU.Build.0 = Debug|Any CPU - {847D157A-E486-4FB6-9AA3-43931A60FB5F}.Release|Any CPU.ActiveCfg = Release|Any CPU - {847D157A-E486-4FB6-9AA3-43931A60FB5F}.Release|Any CPU.Build.0 = Release|Any CPU - {188CE560-A1DC-459D-BF41-1B62E5C0D7B5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {188CE560-A1DC-459D-BF41-1B62E5C0D7B5}.Debug|Any CPU.Build.0 = Debug|Any CPU - {188CE560-A1DC-459D-BF41-1B62E5C0D7B5}.Release|Any CPU.ActiveCfg = Release|Any CPU - {188CE560-A1DC-459D-BF41-1B62E5C0D7B5}.Release|Any CPU.Build.0 = Release|Any CPU - {B647BAB2-D261-40A0-95AF-95E8A2F00ED1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B647BAB2-D261-40A0-95AF-95E8A2F00ED1}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B647BAB2-D261-40A0-95AF-95E8A2F00ED1}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B647BAB2-D261-40A0-95AF-95E8A2F00ED1}.Release|Any CPU.Build.0 = Release|Any CPU - {C9FCD231-3BC9-4453-8949-F521D2D71BCF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {C9FCD231-3BC9-4453-8949-F521D2D71BCF}.Debug|Any CPU.Build.0 = Debug|Any CPU - {C9FCD231-3BC9-4453-8949-F521D2D71BCF}.Release|Any CPU.ActiveCfg = Release|Any CPU - {C9FCD231-3BC9-4453-8949-F521D2D71BCF}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection -EndGlobal diff --git a/WatchIt.slnx b/WatchIt.slnx new file mode 100644 index 0000000..ed0e24e --- /dev/null +++ b/WatchIt.slnx @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From ad9fa4fe199dab43071729565c823a24021675a7 Mon Sep 17 00:00:00 2001 From: Mateusz Skoczek Date: Sat, 2 Nov 2024 18:24:37 +0100 Subject: [PATCH 09/20] Update dev_pr.yml --- .github/workflows/dev_pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dev_pr.yml b/.github/workflows/dev_pr.yml index 99c2f76..8a66de2 100644 --- a/.github/workflows/dev_pr.yml +++ b/.github/workflows/dev_pr.yml @@ -17,7 +17,7 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v4 with: - dotnet-version: 8.0.x + dotnet-version: 9.0.x - name: Restore dependencies run: dotnet restore - name: Build From 95b271c9f13bd8bfc6e2fd27985956f54af37ed2 Mon Sep 17 00:00:00 2001 From: Mateusz Skoczek Date: Sat, 2 Nov 2024 18:40:53 +0100 Subject: [PATCH 10/20] Update dev_pr.yml --- .github/workflows/dev_pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dev_pr.yml b/.github/workflows/dev_pr.yml index 8a66de2..0b5c47e 100644 --- a/.github/workflows/dev_pr.yml +++ b/.github/workflows/dev_pr.yml @@ -19,7 +19,7 @@ jobs: with: dotnet-version: 9.0.x - name: Restore dependencies - run: dotnet restore + run: dotnet restore WatchIt.slnx - name: Build run: dotnet build --no-restore - name: Test From 6bb876b92b2acf06a5aaa2d70d0918c811e56ca9 Mon Sep 17 00:00:00 2001 From: Mateusz Skoczek Date: Sat, 2 Nov 2024 18:45:42 +0100 Subject: [PATCH 11/20] Restore sln --- .github/workflows/dev_pr.yml | 4 +- WatchIt.sln | 241 +++++++++++++++++++++++++++++++++++ 2 files changed, 243 insertions(+), 2 deletions(-) create mode 100644 WatchIt.sln diff --git a/.github/workflows/dev_pr.yml b/.github/workflows/dev_pr.yml index 0b5c47e..99c2f76 100644 --- a/.github/workflows/dev_pr.yml +++ b/.github/workflows/dev_pr.yml @@ -17,9 +17,9 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v4 with: - dotnet-version: 9.0.x + dotnet-version: 8.0.x - name: Restore dependencies - run: dotnet restore WatchIt.slnx + run: dotnet restore - name: Build run: dotnet build --no-restore - name: Test diff --git a/WatchIt.sln b/WatchIt.sln new file mode 100644 index 0000000..99c5e6d --- /dev/null +++ b/WatchIt.sln @@ -0,0 +1,241 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "WatchIt.Common", "WatchIt.Common", "{0EDF709C-99F4-3EE5-9136-4C92A768A3F8}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WatchIt.Common.Model", "WatchIt.Common\WatchIt.Common.Model\WatchIt.Common.Model.csproj", "{F9E593F3-49A5-3F24-D468-932375E9971D}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WatchIt.Common.Query", "WatchIt.Common\WatchIt.Common.Query\WatchIt.Common.Query.csproj", "{5E9025E1-41C3-A27B-99BE-5AAB5CF7EE27}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "WatchIt.Common.Services", "WatchIt.Common.Services", "{DC2B5349-B77C-59FD-0E4D-E6749FACB96D}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WatchIt.Common.Services.HttpClient", "WatchIt.Common\WatchIt.Common.Services\WatchIt.Common.Services.HttpClient\WatchIt.Common.Services.HttpClient.csproj", "{BCD06E73-4DF3-68A2-1A5A-F4870D5AEF84}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "WatchIt.Database", "WatchIt.Database", "{227CC20A-F08E-180E-2EE3-ADA5DB2A8891}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WatchIt.Database", "WatchIt.Database\WatchIt.Database\WatchIt.Database.csproj", "{B045DE15-B896-BB0E-3D0A-F2B55D2704FF}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "WatchIt.Database.Model", "WatchIt.Database.Model", "{90A007E0-353E-9587-79F1-149A51AEA943}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WatchIt.Database.Model.Configuration", "WatchIt.Database\WatchIt.Database.Model\WatchIt.Database.Model.Configuration\WatchIt.Database.Model.Configuration.csproj", "{C046FE28-DA43-139C-BA9E-289844A7CC9A}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WatchIt.Database.Model.Seeding", "WatchIt.Database\WatchIt.Database.Model\WatchIt.Database.Model.Seeding\WatchIt.Database.Model.Seeding.csproj", "{3E2F07F5-838A-6141-5B48-D879F2B645E0}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WatchIt.Database.Model", "WatchIt.Database\WatchIt.Database.Model\WatchIt.Database.Model\WatchIt.Database.Model.csproj", "{8B33B44E-0245-511C-C2AD-D47E6153670D}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "WatchIt.WebAPI", "WatchIt.WebAPI", "{580BCC26-D6F3-27C7-CD4B-4CDBB56CF3A3}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WatchIt.WebAPI.Controllers", "WatchIt.WebAPI\WatchIt.WebAPI.Controllers\WatchIt.WebAPI.Controllers.csproj", "{1E179F33-2D2F-752B-4AE6-5C72B29B4123}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WatchIt.WebAPI.Validators", "WatchIt.WebAPI\WatchIt.WebAPI.Validators\WatchIt.WebAPI.Validators.csproj", "{AD58457B-9326-03B8-5831-ED515464503A}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WatchIt.WebAPI.WorkerServices", "WatchIt.WebAPI\WatchIt.WebAPI.WorkerServices\WatchIt.WebAPI.WorkerServices.csproj", "{0F30275E-5CE6-D2A6-4D2C-01B0ECF8EC3C}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WatchIt.WebAPI", "WatchIt.WebAPI\WatchIt.WebAPI\WatchIt.WebAPI.csproj", "{935F490B-5A14-87EA-A6F7-C808E8233619}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "WatchIt.WebAPI.Services", "WatchIt.WebAPI.Services", "{57D9D146-511A-42D7-C1C5-0D18D3E1ADAF}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "WatchIt.WebAPI.Services.Controllers", "WatchIt.WebAPI.Services.Controllers", "{8D8C51C4-760C-9908-3CE3-2A00341BA9B3}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WatchIt.WebAPI.Services.Controllers.Accounts", "WatchIt.WebAPI\WatchIt.WebAPI.Services\WatchIt.WebAPI.Services.Controllers\WatchIt.WebAPI.Services.Controllers.Accounts\WatchIt.WebAPI.Services.Controllers.Accounts.csproj", "{3C42534E-57D6-1270-FD53-1F85E7D1B136}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WatchIt.WebAPI.Services.Controllers.Common", "WatchIt.WebAPI\WatchIt.WebAPI.Services\WatchIt.WebAPI.Services.Controllers\WatchIt.WebAPI.Services.Controllers.Common\WatchIt.WebAPI.Services.Controllers.Common.csproj", "{5D9EB880-7F26-85D2-0606-FFBA669CA8FB}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WatchIt.WebAPI.Services.Controllers.Genders", "WatchIt.WebAPI\WatchIt.WebAPI.Services\WatchIt.WebAPI.Services.Controllers\WatchIt.WebAPI.Services.Controllers.Genders\WatchIt.WebAPI.Services.Controllers.Genders.csproj", "{195DE0A1-20F2-DE84-330E-64EF72C116A1}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WatchIt.WebAPI.Services.Controllers.Genres", "WatchIt.WebAPI\WatchIt.WebAPI.Services\WatchIt.WebAPI.Services.Controllers\WatchIt.WebAPI.Services.Controllers.Genres\WatchIt.WebAPI.Services.Controllers.Genres.csproj", "{B400518F-D1EE-66BF-31C8-033E502F04C2}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WatchIt.WebAPI.Services.Controllers.Media", "WatchIt.WebAPI\WatchIt.WebAPI.Services\WatchIt.WebAPI.Services.Controllers\WatchIt.WebAPI.Services.Controllers.Media\WatchIt.WebAPI.Services.Controllers.Media.csproj", "{F5813724-3299-71CB-B219-1133BFB3CE49}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WatchIt.WebAPI.Services.Controllers.Movies", "WatchIt.WebAPI\WatchIt.WebAPI.Services\WatchIt.WebAPI.Services.Controllers\WatchIt.WebAPI.Services.Controllers.Movies\WatchIt.WebAPI.Services.Controllers.Movies.csproj", "{CE807E91-B0E6-0E34-4842-4BCD74C15A71}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WatchIt.WebAPI.Services.Controllers.Persons", "WatchIt.WebAPI\WatchIt.WebAPI.Services\WatchIt.WebAPI.Services.Controllers\WatchIt.WebAPI.Services.Controllers.Persons\WatchIt.WebAPI.Services.Controllers.Persons.csproj", "{F4521C82-C834-1392-313E-A23DD3C91379}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WatchIt.WebAPI.Services.Controllers.Photos", "WatchIt.WebAPI\WatchIt.WebAPI.Services\WatchIt.WebAPI.Services.Controllers\WatchIt.WebAPI.Services.Controllers.Photos\WatchIt.WebAPI.Services.Controllers.Photos.csproj", "{3103A43A-694B-46B4-904D-84FCBAB3DDBE}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WatchIt.WebAPI.Services.Controllers.Roles", "WatchIt.WebAPI\WatchIt.WebAPI.Services\WatchIt.WebAPI.Services.Controllers\WatchIt.WebAPI.Services.Controllers.Roles\WatchIt.WebAPI.Services.Controllers.Roles.csproj", "{F6AAC506-626B-A519-AAA9-DED4C1511B7D}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WatchIt.WebAPI.Services.Controllers.Series", "WatchIt.WebAPI\WatchIt.WebAPI.Services\WatchIt.WebAPI.Services.Controllers\WatchIt.WebAPI.Services.Controllers.Series\WatchIt.WebAPI.Services.Controllers.Series.csproj", "{5FB4B0AA-09A7-11A8-D45F-73946CBDF400}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "WatchIt.WebAPI.Services.Utility", "WatchIt.WebAPI.Services.Utility", "{0D7F6705-9114-1C0D-61F6-E76D43BBFD95}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WatchIt.WebAPI.Services.Utility.Configuration", "WatchIt.WebAPI\WatchIt.WebAPI.Services\WatchIt.WebAPI.Services.Utility\WatchIt.WebAPI.Services.Utility.Configuration\WatchIt.WebAPI.Services.Utility.Configuration.csproj", "{654F560F-B171-9B66-30C2-FA728CB812E1}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WatchIt.WebAPI.Services.Utility.Tokens", "WatchIt.WebAPI\WatchIt.WebAPI.Services\WatchIt.WebAPI.Services.Utility\WatchIt.WebAPI.Services.Utility.Tokens\WatchIt.WebAPI.Services.Utility.Tokens.csproj", "{115E0CB8-501B-F73A-B4E5-343DC9C0FC93}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WatchIt.WebAPI.Services.Utility.User", "WatchIt.WebAPI\WatchIt.WebAPI.Services\WatchIt.WebAPI.Services.Utility\WatchIt.WebAPI.Services.Utility.User\WatchIt.WebAPI.Services.Utility.User.csproj", "{872394DD-5F95-2FD2-E30D-7E2B021F055B}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "WatchIt.Website", "WatchIt.Website", "{A476FF40-6AD9-F237-094D-BC9CD170091F}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WatchIt.Website", "WatchIt.Website\WatchIt.Website\WatchIt.Website.csproj", "{53AB0957-9473-8422-8FB2-2611339FAACC}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "WatchIt.Website.Services", "WatchIt.Website.Services", "{AE403159-2725-6961-6E01-1CB0FBD8C1DF}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WatchIt.Website.Services.Authentication", "WatchIt.Website\WatchIt.Website.Services\WatchIt.Website.Services.Authentication\WatchIt.Website.Services.Authentication.csproj", "{27B65069-12AD-68A4-238F-58FA84F24813}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WatchIt.Website.Services.Client", "WatchIt.Website\WatchIt.Website.Services\WatchIt.Website.Services.Client\WatchIt.Website.Services.Client.csproj", "{F176F958-3A95-DDBC-8036-2B7E49B3254E}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WatchIt.Website.Services.Configuration", "WatchIt.Website\WatchIt.Website.Services\WatchIt.Website.Services.Configuration\WatchIt.Website.Services.Configuration.csproj", "{979B1DA2-CEA0-95C6-3E85-9329D28A41D1}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WatchIt.Website.Services.Tokens", "WatchIt.Website\WatchIt.Website.Services\WatchIt.Website.Services.Tokens\WatchIt.Website.Services.Tokens.csproj", "{95A0DC72-B175-3174-5EE2-F1E3473DE428}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {F9E593F3-49A5-3F24-D468-932375E9971D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F9E593F3-49A5-3F24-D468-932375E9971D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F9E593F3-49A5-3F24-D468-932375E9971D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F9E593F3-49A5-3F24-D468-932375E9971D}.Release|Any CPU.Build.0 = Release|Any CPU + {5E9025E1-41C3-A27B-99BE-5AAB5CF7EE27}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5E9025E1-41C3-A27B-99BE-5AAB5CF7EE27}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5E9025E1-41C3-A27B-99BE-5AAB5CF7EE27}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5E9025E1-41C3-A27B-99BE-5AAB5CF7EE27}.Release|Any CPU.Build.0 = Release|Any CPU + {BCD06E73-4DF3-68A2-1A5A-F4870D5AEF84}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {BCD06E73-4DF3-68A2-1A5A-F4870D5AEF84}.Debug|Any CPU.Build.0 = Debug|Any CPU + {BCD06E73-4DF3-68A2-1A5A-F4870D5AEF84}.Release|Any CPU.ActiveCfg = Release|Any CPU + {BCD06E73-4DF3-68A2-1A5A-F4870D5AEF84}.Release|Any CPU.Build.0 = Release|Any CPU + {B045DE15-B896-BB0E-3D0A-F2B55D2704FF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B045DE15-B896-BB0E-3D0A-F2B55D2704FF}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B045DE15-B896-BB0E-3D0A-F2B55D2704FF}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B045DE15-B896-BB0E-3D0A-F2B55D2704FF}.Release|Any CPU.Build.0 = Release|Any CPU + {C046FE28-DA43-139C-BA9E-289844A7CC9A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C046FE28-DA43-139C-BA9E-289844A7CC9A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C046FE28-DA43-139C-BA9E-289844A7CC9A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C046FE28-DA43-139C-BA9E-289844A7CC9A}.Release|Any CPU.Build.0 = Release|Any CPU + {3E2F07F5-838A-6141-5B48-D879F2B645E0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3E2F07F5-838A-6141-5B48-D879F2B645E0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3E2F07F5-838A-6141-5B48-D879F2B645E0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3E2F07F5-838A-6141-5B48-D879F2B645E0}.Release|Any CPU.Build.0 = Release|Any CPU + {8B33B44E-0245-511C-C2AD-D47E6153670D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8B33B44E-0245-511C-C2AD-D47E6153670D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8B33B44E-0245-511C-C2AD-D47E6153670D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8B33B44E-0245-511C-C2AD-D47E6153670D}.Release|Any CPU.Build.0 = Release|Any CPU + {1E179F33-2D2F-752B-4AE6-5C72B29B4123}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1E179F33-2D2F-752B-4AE6-5C72B29B4123}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1E179F33-2D2F-752B-4AE6-5C72B29B4123}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1E179F33-2D2F-752B-4AE6-5C72B29B4123}.Release|Any CPU.Build.0 = Release|Any CPU + {AD58457B-9326-03B8-5831-ED515464503A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {AD58457B-9326-03B8-5831-ED515464503A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {AD58457B-9326-03B8-5831-ED515464503A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {AD58457B-9326-03B8-5831-ED515464503A}.Release|Any CPU.Build.0 = Release|Any CPU + {0F30275E-5CE6-D2A6-4D2C-01B0ECF8EC3C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0F30275E-5CE6-D2A6-4D2C-01B0ECF8EC3C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0F30275E-5CE6-D2A6-4D2C-01B0ECF8EC3C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0F30275E-5CE6-D2A6-4D2C-01B0ECF8EC3C}.Release|Any CPU.Build.0 = Release|Any CPU + {935F490B-5A14-87EA-A6F7-C808E8233619}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {935F490B-5A14-87EA-A6F7-C808E8233619}.Debug|Any CPU.Build.0 = Debug|Any CPU + {935F490B-5A14-87EA-A6F7-C808E8233619}.Release|Any CPU.ActiveCfg = Release|Any CPU + {935F490B-5A14-87EA-A6F7-C808E8233619}.Release|Any CPU.Build.0 = Release|Any CPU + {3C42534E-57D6-1270-FD53-1F85E7D1B136}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3C42534E-57D6-1270-FD53-1F85E7D1B136}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3C42534E-57D6-1270-FD53-1F85E7D1B136}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3C42534E-57D6-1270-FD53-1F85E7D1B136}.Release|Any CPU.Build.0 = Release|Any CPU + {5D9EB880-7F26-85D2-0606-FFBA669CA8FB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5D9EB880-7F26-85D2-0606-FFBA669CA8FB}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5D9EB880-7F26-85D2-0606-FFBA669CA8FB}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5D9EB880-7F26-85D2-0606-FFBA669CA8FB}.Release|Any CPU.Build.0 = Release|Any CPU + {195DE0A1-20F2-DE84-330E-64EF72C116A1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {195DE0A1-20F2-DE84-330E-64EF72C116A1}.Debug|Any CPU.Build.0 = Debug|Any CPU + {195DE0A1-20F2-DE84-330E-64EF72C116A1}.Release|Any CPU.ActiveCfg = Release|Any CPU + {195DE0A1-20F2-DE84-330E-64EF72C116A1}.Release|Any CPU.Build.0 = Release|Any CPU + {B400518F-D1EE-66BF-31C8-033E502F04C2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B400518F-D1EE-66BF-31C8-033E502F04C2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B400518F-D1EE-66BF-31C8-033E502F04C2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B400518F-D1EE-66BF-31C8-033E502F04C2}.Release|Any CPU.Build.0 = Release|Any CPU + {F5813724-3299-71CB-B219-1133BFB3CE49}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F5813724-3299-71CB-B219-1133BFB3CE49}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F5813724-3299-71CB-B219-1133BFB3CE49}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F5813724-3299-71CB-B219-1133BFB3CE49}.Release|Any CPU.Build.0 = Release|Any CPU + {CE807E91-B0E6-0E34-4842-4BCD74C15A71}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {CE807E91-B0E6-0E34-4842-4BCD74C15A71}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CE807E91-B0E6-0E34-4842-4BCD74C15A71}.Release|Any CPU.ActiveCfg = Release|Any CPU + {CE807E91-B0E6-0E34-4842-4BCD74C15A71}.Release|Any CPU.Build.0 = Release|Any CPU + {F4521C82-C834-1392-313E-A23DD3C91379}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F4521C82-C834-1392-313E-A23DD3C91379}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F4521C82-C834-1392-313E-A23DD3C91379}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F4521C82-C834-1392-313E-A23DD3C91379}.Release|Any CPU.Build.0 = Release|Any CPU + {3103A43A-694B-46B4-904D-84FCBAB3DDBE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3103A43A-694B-46B4-904D-84FCBAB3DDBE}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3103A43A-694B-46B4-904D-84FCBAB3DDBE}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3103A43A-694B-46B4-904D-84FCBAB3DDBE}.Release|Any CPU.Build.0 = Release|Any CPU + {F6AAC506-626B-A519-AAA9-DED4C1511B7D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F6AAC506-626B-A519-AAA9-DED4C1511B7D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F6AAC506-626B-A519-AAA9-DED4C1511B7D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F6AAC506-626B-A519-AAA9-DED4C1511B7D}.Release|Any CPU.Build.0 = Release|Any CPU + {5FB4B0AA-09A7-11A8-D45F-73946CBDF400}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5FB4B0AA-09A7-11A8-D45F-73946CBDF400}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5FB4B0AA-09A7-11A8-D45F-73946CBDF400}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5FB4B0AA-09A7-11A8-D45F-73946CBDF400}.Release|Any CPU.Build.0 = Release|Any CPU + {654F560F-B171-9B66-30C2-FA728CB812E1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {654F560F-B171-9B66-30C2-FA728CB812E1}.Debug|Any CPU.Build.0 = Debug|Any CPU + {654F560F-B171-9B66-30C2-FA728CB812E1}.Release|Any CPU.ActiveCfg = Release|Any CPU + {654F560F-B171-9B66-30C2-FA728CB812E1}.Release|Any CPU.Build.0 = Release|Any CPU + {115E0CB8-501B-F73A-B4E5-343DC9C0FC93}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {115E0CB8-501B-F73A-B4E5-343DC9C0FC93}.Debug|Any CPU.Build.0 = Debug|Any CPU + {115E0CB8-501B-F73A-B4E5-343DC9C0FC93}.Release|Any CPU.ActiveCfg = Release|Any CPU + {115E0CB8-501B-F73A-B4E5-343DC9C0FC93}.Release|Any CPU.Build.0 = Release|Any CPU + {872394DD-5F95-2FD2-E30D-7E2B021F055B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {872394DD-5F95-2FD2-E30D-7E2B021F055B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {872394DD-5F95-2FD2-E30D-7E2B021F055B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {872394DD-5F95-2FD2-E30D-7E2B021F055B}.Release|Any CPU.Build.0 = Release|Any CPU + {53AB0957-9473-8422-8FB2-2611339FAACC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {53AB0957-9473-8422-8FB2-2611339FAACC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {53AB0957-9473-8422-8FB2-2611339FAACC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {53AB0957-9473-8422-8FB2-2611339FAACC}.Release|Any CPU.Build.0 = Release|Any CPU + {27B65069-12AD-68A4-238F-58FA84F24813}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {27B65069-12AD-68A4-238F-58FA84F24813}.Debug|Any CPU.Build.0 = Debug|Any CPU + {27B65069-12AD-68A4-238F-58FA84F24813}.Release|Any CPU.ActiveCfg = Release|Any CPU + {27B65069-12AD-68A4-238F-58FA84F24813}.Release|Any CPU.Build.0 = Release|Any CPU + {F176F958-3A95-DDBC-8036-2B7E49B3254E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F176F958-3A95-DDBC-8036-2B7E49B3254E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F176F958-3A95-DDBC-8036-2B7E49B3254E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F176F958-3A95-DDBC-8036-2B7E49B3254E}.Release|Any CPU.Build.0 = Release|Any CPU + {979B1DA2-CEA0-95C6-3E85-9329D28A41D1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {979B1DA2-CEA0-95C6-3E85-9329D28A41D1}.Debug|Any CPU.Build.0 = Debug|Any CPU + {979B1DA2-CEA0-95C6-3E85-9329D28A41D1}.Release|Any CPU.ActiveCfg = Release|Any CPU + {979B1DA2-CEA0-95C6-3E85-9329D28A41D1}.Release|Any CPU.Build.0 = Release|Any CPU + {95A0DC72-B175-3174-5EE2-F1E3473DE428}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {95A0DC72-B175-3174-5EE2-F1E3473DE428}.Debug|Any CPU.Build.0 = Debug|Any CPU + {95A0DC72-B175-3174-5EE2-F1E3473DE428}.Release|Any CPU.ActiveCfg = Release|Any CPU + {95A0DC72-B175-3174-5EE2-F1E3473DE428}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {F9E593F3-49A5-3F24-D468-932375E9971D} = {0EDF709C-99F4-3EE5-9136-4C92A768A3F8} + {5E9025E1-41C3-A27B-99BE-5AAB5CF7EE27} = {0EDF709C-99F4-3EE5-9136-4C92A768A3F8} + {DC2B5349-B77C-59FD-0E4D-E6749FACB96D} = {0EDF709C-99F4-3EE5-9136-4C92A768A3F8} + {BCD06E73-4DF3-68A2-1A5A-F4870D5AEF84} = {DC2B5349-B77C-59FD-0E4D-E6749FACB96D} + {B045DE15-B896-BB0E-3D0A-F2B55D2704FF} = {227CC20A-F08E-180E-2EE3-ADA5DB2A8891} + {90A007E0-353E-9587-79F1-149A51AEA943} = {227CC20A-F08E-180E-2EE3-ADA5DB2A8891} + {C046FE28-DA43-139C-BA9E-289844A7CC9A} = {90A007E0-353E-9587-79F1-149A51AEA943} + {3E2F07F5-838A-6141-5B48-D879F2B645E0} = {90A007E0-353E-9587-79F1-149A51AEA943} + {8B33B44E-0245-511C-C2AD-D47E6153670D} = {90A007E0-353E-9587-79F1-149A51AEA943} + {1E179F33-2D2F-752B-4AE6-5C72B29B4123} = {580BCC26-D6F3-27C7-CD4B-4CDBB56CF3A3} + {AD58457B-9326-03B8-5831-ED515464503A} = {580BCC26-D6F3-27C7-CD4B-4CDBB56CF3A3} + {0F30275E-5CE6-D2A6-4D2C-01B0ECF8EC3C} = {580BCC26-D6F3-27C7-CD4B-4CDBB56CF3A3} + {935F490B-5A14-87EA-A6F7-C808E8233619} = {580BCC26-D6F3-27C7-CD4B-4CDBB56CF3A3} + {57D9D146-511A-42D7-C1C5-0D18D3E1ADAF} = {580BCC26-D6F3-27C7-CD4B-4CDBB56CF3A3} + {8D8C51C4-760C-9908-3CE3-2A00341BA9B3} = {57D9D146-511A-42D7-C1C5-0D18D3E1ADAF} + {0D7F6705-9114-1C0D-61F6-E76D43BBFD95} = {57D9D146-511A-42D7-C1C5-0D18D3E1ADAF} + {3C42534E-57D6-1270-FD53-1F85E7D1B136} = {8D8C51C4-760C-9908-3CE3-2A00341BA9B3} + {5D9EB880-7F26-85D2-0606-FFBA669CA8FB} = {8D8C51C4-760C-9908-3CE3-2A00341BA9B3} + {195DE0A1-20F2-DE84-330E-64EF72C116A1} = {8D8C51C4-760C-9908-3CE3-2A00341BA9B3} + {B400518F-D1EE-66BF-31C8-033E502F04C2} = {8D8C51C4-760C-9908-3CE3-2A00341BA9B3} + {F5813724-3299-71CB-B219-1133BFB3CE49} = {8D8C51C4-760C-9908-3CE3-2A00341BA9B3} + {CE807E91-B0E6-0E34-4842-4BCD74C15A71} = {8D8C51C4-760C-9908-3CE3-2A00341BA9B3} + {F4521C82-C834-1392-313E-A23DD3C91379} = {8D8C51C4-760C-9908-3CE3-2A00341BA9B3} + {3103A43A-694B-46B4-904D-84FCBAB3DDBE} = {8D8C51C4-760C-9908-3CE3-2A00341BA9B3} + {F6AAC506-626B-A519-AAA9-DED4C1511B7D} = {8D8C51C4-760C-9908-3CE3-2A00341BA9B3} + {5FB4B0AA-09A7-11A8-D45F-73946CBDF400} = {8D8C51C4-760C-9908-3CE3-2A00341BA9B3} + {654F560F-B171-9B66-30C2-FA728CB812E1} = {0D7F6705-9114-1C0D-61F6-E76D43BBFD95} + {115E0CB8-501B-F73A-B4E5-343DC9C0FC93} = {0D7F6705-9114-1C0D-61F6-E76D43BBFD95} + {872394DD-5F95-2FD2-E30D-7E2B021F055B} = {0D7F6705-9114-1C0D-61F6-E76D43BBFD95} + {53AB0957-9473-8422-8FB2-2611339FAACC} = {A476FF40-6AD9-F237-094D-BC9CD170091F} + {AE403159-2725-6961-6E01-1CB0FBD8C1DF} = {A476FF40-6AD9-F237-094D-BC9CD170091F} + {27B65069-12AD-68A4-238F-58FA84F24813} = {AE403159-2725-6961-6E01-1CB0FBD8C1DF} + {F176F958-3A95-DDBC-8036-2B7E49B3254E} = {AE403159-2725-6961-6E01-1CB0FBD8C1DF} + {979B1DA2-CEA0-95C6-3E85-9329D28A41D1} = {AE403159-2725-6961-6E01-1CB0FBD8C1DF} + {95A0DC72-B175-3174-5EE2-F1E3473DE428} = {AE403159-2725-6961-6E01-1CB0FBD8C1DF} + EndGlobalSection +EndGlobal From 88e8e330aa3762c316fb7ed7115e2c54ae9b4fa0 Mon Sep 17 00:00:00 2001 From: Mateusz Skoczek Date: Sun, 3 Nov 2024 14:21:30 +0100 Subject: [PATCH 12/20] some fixes --- .../Panels/HorizontalListPanelComponent.razor | 2 +- .../HorizontalListPanelComponent.razor.cs | 1 + .../HorizontalListItemComponent.razor | 13 +++-- .../HorizontalListItemComponent.razor.cs | 2 +- .../WatchIt.Website/Layout/MainLayout.razor | 1 + .../WatchIt.Website/Pages/MediaEditPage.razor | 13 ++++- .../WatchIt.Website/Pages/UserPage.razor | 9 ++-- WatchIt.slnx | 50 ------------------- 8 files changed, 31 insertions(+), 60 deletions(-) delete mode 100644 WatchIt.slnx diff --git a/WatchIt.Website/WatchIt.Website/Components/Common/Panels/HorizontalListPanelComponent.razor b/WatchIt.Website/WatchIt.Website/Components/Common/Panels/HorizontalListPanelComponent.razor index a5485a0..f1e5efe 100644 --- a/WatchIt.Website/WatchIt.Website/Components/Common/Panels/HorizontalListPanelComponent.razor +++ b/WatchIt.Website/WatchIt.Website/Components/Common/Panels/HorizontalListPanelComponent.razor @@ -16,7 +16,7 @@ { @{int iCopy = i;} - diff --git a/WatchIt.Website/WatchIt.Website/Components/Common/Panels/HorizontalListPanelComponent.razor.cs b/WatchIt.Website/WatchIt.Website/Components/Common/Panels/HorizontalListPanelComponent.razor.cs index 971d659..326590d 100644 --- a/WatchIt.Website/WatchIt.Website/Components/Common/Panels/HorizontalListPanelComponent.razor.cs +++ b/WatchIt.Website/WatchIt.Website/Components/Common/Panels/HorizontalListPanelComponent.razor.cs @@ -17,6 +17,7 @@ public partial class HorizontalListPanelComponent : ComponentBase [Parameter] public required Func NameSource { get; set; } [Parameter] public required string PosterPlaceholder { get; set; } [Parameter] public required Func, Task> GetPictureAction { get; set; } + [Parameter] public bool HidePlace { get; set; } #endregion diff --git a/WatchIt.Website/WatchIt.Website/Components/Common/Subcomponents/HorizontalListItemComponent.razor b/WatchIt.Website/WatchIt.Website/Components/Common/Subcomponents/HorizontalListItemComponent.razor index 89c1a89..4030e10 100644 --- a/WatchIt.Website/WatchIt.Website/Components/Common/Subcomponents/HorizontalListItemComponent.razor +++ b/WatchIt.Website/WatchIt.Website/Components/Common/Subcomponents/HorizontalListItemComponent.razor @@ -2,11 +2,16 @@
-
-
@(Place)
-
+ @if (Place.HasValue) + { +
+
@(Place)
+
+ }
-
@(Name)
+
+
@(Name)
+
diff --git a/WatchIt.Website/WatchIt.Website/Components/Common/Subcomponents/HorizontalListItemComponent.razor.cs b/WatchIt.Website/WatchIt.Website/Components/Common/Subcomponents/HorizontalListItemComponent.razor.cs index f80bcf4..73b4506 100644 --- a/WatchIt.Website/WatchIt.Website/Components/Common/Subcomponents/HorizontalListItemComponent.razor.cs +++ b/WatchIt.Website/WatchIt.Website/Components/Common/Subcomponents/HorizontalListItemComponent.razor.cs @@ -7,7 +7,7 @@ public partial class HorizontalListItemComponent : ComponentBase { #region PARAMETERS - [Parameter] public required int Place { get; set; } + [Parameter] public int? Place { get; set; } [Parameter] public required string Name { get; set; } [Parameter] public required string PosterPlaceholder { get; set; } [Parameter] public required Func, Task> GetPosterAction { get; set; } diff --git a/WatchIt.Website/WatchIt.Website/Layout/MainLayout.razor b/WatchIt.Website/WatchIt.Website/Layout/MainLayout.razor index 5d34a04..f4c1daa 100644 --- a/WatchIt.Website/WatchIt.Website/Layout/MainLayout.razor +++ b/WatchIt.Website/WatchIt.Website/Layout/MainLayout.razor @@ -62,6 +62,7 @@ Your profile + User settings @if (_user.IsAdmin) { diff --git a/WatchIt.Website/WatchIt.Website/Pages/MediaEditPage.razor b/WatchIt.Website/WatchIt.Website/Pages/MediaEditPage.razor index 86a3d61..f0aa505 100644 --- a/WatchIt.Website/WatchIt.Website/Pages/MediaEditPage.razor +++ b/WatchIt.Website/WatchIt.Website/Pages/MediaEditPage.razor @@ -51,7 +51,18 @@
diff --git a/WatchIt.Website/WatchIt.Website/Pages/UserPage.razor b/WatchIt.Website/WatchIt.Website/Pages/UserPage.razor index 1e1d3cf..12503ca 100644 --- a/WatchIt.Website/WatchIt.Website/Pages/UserPage.razor +++ b/WatchIt.Website/WatchIt.Website/Pages/UserPage.razor @@ -74,7 +74,8 @@ IdSource="@(item => item.Id)" NameSource="@(item => item.ReleaseDate.HasValue ? $"{item.Title} ({item.ReleaseDate.Value.Year})" : item.Title)" PosterPlaceholder="/assets/media_poster.png" - GetPictureAction="@((id, action) => MediaClientService.GetMediaPoster(id, action))"/> + GetPictureAction="@((id, action) => MediaClientService.GetMediaPoster(id, action))" + HidePlace="@(true)"/> + GetPictureAction="@((id, action) => MediaClientService.GetMediaPoster(id, action))" + HidePlace="@(true)"/> + GetPictureAction="@((id, action) => PersonsClientService.GetPersonPhoto(id, action))" + HidePlace="@(true)"/>
diff --git a/WatchIt.slnx b/WatchIt.slnx deleted file mode 100644 index ed0e24e..0000000 --- a/WatchIt.slnx +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file From 3604c066e77abb4650d520ee161e433fcdd941bf Mon Sep 17 00:00:00 2001 From: Mateusz Skoczek Date: Sun, 3 Nov 2024 23:01:34 +0100 Subject: [PATCH 13/20] profile picture and basic info editors added --- ...equest.cs => AccountProfileInfoRequest.cs} | 21 ++++- .../Accounts/AccountProfilePictureRequest.cs | 33 +++++++ .../AccountsController.cs | 23 +++-- .../AccountsControllerService.cs | 50 ++++++++++- .../IAccountsControllerService.cs | 4 +- ... => AccountProfileInfoRequestValidator.cs} | 8 +- .../AccountProfilePictureRequestValidator.cs | 13 +++ .../Accounts/AccountsClientService.cs | 35 +++++++- .../Accounts/IAccountsClientService.cs | 4 +- .../Model/Accounts.cs | 6 +- WatchIt.Website/WatchIt.Website/App.razor | 4 +- .../Panels/PictureEditorPanelComponent.razor | 2 +- .../PictureEditorPanelComponent.razor.cs | 4 + .../AccountPictureComponent.razor | 8 +- .../AccountPictureComponent.razor.cs | 25 +++--- .../Subcomponents/PictureComponent.razor | 2 +- .../Subcomponents/PictureComponent.razor.cs | 8 ++ .../ProfileEditFormPanelComponent.razor | 60 +++++++++++++ .../ProfileEditFormPanelComponent.razor.cs | 86 +++++++++++++++++++ .../ProfileEditHeaderPanelComponent.razor | 5 ++ .../ProfileEditHeaderPanelComponent.razor.css | 0 .../UserEditPageHeaderPanelComponent.razor | 9 ++ .../UserEditPageHeaderPanelComponent.razor.cs | 38 ++++++++ ...UserEditPageHeaderPanelComponent.razor.css | 9 ++ .../Panels/UserPageHeaderPanelComponent.razor | 22 ++--- .../UserPageHeaderPanelComponent.razor.cs | 4 +- .../WatchIt.Website/Layout/MainLayout.razor | 4 +- .../Layout/MainLayout.razor.cs | 17 ++++ .../WatchIt.Website/Pages/UserEditPage.razor | 83 +++++++++++++++++- .../Pages/UserEditPage.razor.cs | 61 +++++++++++++ .../WatchIt.Website/Pages/UserPage.razor | 2 +- .../WatchIt.Website/Pages/UserPage.razor.cs | 3 +- .../WatchIt.Website/appsettings.json | 8 +- .../WatchIt.Website/wwwroot/css/panel.css | 10 ++- 34 files changed, 607 insertions(+), 64 deletions(-) rename WatchIt.Common/WatchIt.Common.Model/Accounts/{AccountRequest.cs => AccountProfileInfoRequest.cs} (50%) create mode 100644 WatchIt.Common/WatchIt.Common.Model/Accounts/AccountProfilePictureRequest.cs rename WatchIt.WebAPI/WatchIt.WebAPI.Validators/Accounts/{AccountRequestValidator.cs => AccountProfileInfoRequestValidator.cs} (52%) create mode 100644 WatchIt.WebAPI/WatchIt.WebAPI.Validators/Accounts/AccountProfilePictureRequestValidator.cs create mode 100644 WatchIt.Website/WatchIt.Website/Components/Pages/UserEditPage/Panels/ProfileEditFormPanelComponent.razor create mode 100644 WatchIt.Website/WatchIt.Website/Components/Pages/UserEditPage/Panels/ProfileEditFormPanelComponent.razor.cs create mode 100644 WatchIt.Website/WatchIt.Website/Components/Pages/UserEditPage/Panels/ProfileEditHeaderPanelComponent.razor create mode 100644 WatchIt.Website/WatchIt.Website/Components/Pages/UserEditPage/Panels/ProfileEditHeaderPanelComponent.razor.css create mode 100644 WatchIt.Website/WatchIt.Website/Components/Pages/UserEditPage/Panels/UserEditPageHeaderPanelComponent.razor create mode 100644 WatchIt.Website/WatchIt.Website/Components/Pages/UserEditPage/Panels/UserEditPageHeaderPanelComponent.razor.cs create mode 100644 WatchIt.Website/WatchIt.Website/Components/Pages/UserEditPage/Panels/UserEditPageHeaderPanelComponent.razor.css diff --git a/WatchIt.Common/WatchIt.Common.Model/Accounts/AccountRequest.cs b/WatchIt.Common/WatchIt.Common.Model/Accounts/AccountProfileInfoRequest.cs similarity index 50% rename from WatchIt.Common/WatchIt.Common.Model/Accounts/AccountRequest.cs rename to WatchIt.Common/WatchIt.Common.Model/Accounts/AccountProfileInfoRequest.cs index 30b1d7b..e26f615 100644 --- a/WatchIt.Common/WatchIt.Common.Model/Accounts/AccountRequest.cs +++ b/WatchIt.Common/WatchIt.Common.Model/Accounts/AccountProfileInfoRequest.cs @@ -2,9 +2,12 @@ using System.Text.Json.Serialization; namespace WatchIt.Common.Model.Accounts; -public class AccountRequest : Account +public class AccountProfileInfoRequest { #region PROPERTIES + + [JsonPropertyName("description")] + public string? Description { get; set; } [JsonPropertyName("gender_id")] public short? GenderId { get; set; } @@ -13,12 +16,24 @@ public class AccountRequest : Account + #region CONSTRUCTORS + + public AccountProfileInfoRequest() { } + + public AccountProfileInfoRequest(AccountResponse accountResponse) + { + Description = accountResponse.Description; + GenderId = accountResponse.Gender?.Id; + } + + #endregion + + + #region PUBLIC METHODS public void UpdateAccount(Database.Model.Account.Account account) { - account.Username = Username; - account.Email = Email; account.Description = Description; account.GenderId = GenderId; } diff --git a/WatchIt.Common/WatchIt.Common.Model/Accounts/AccountProfilePictureRequest.cs b/WatchIt.Common/WatchIt.Common.Model/Accounts/AccountProfilePictureRequest.cs new file mode 100644 index 0000000..1fbea18 --- /dev/null +++ b/WatchIt.Common/WatchIt.Common.Model/Accounts/AccountProfilePictureRequest.cs @@ -0,0 +1,33 @@ +using System.Diagnostics.CodeAnalysis; + +namespace WatchIt.Common.Model.Accounts; + +public class AccountProfilePictureRequest : AccountProfilePicture +{ + #region CONSTRUCTORS + + public AccountProfilePictureRequest() {} + + [SetsRequiredMembers] + public AccountProfilePictureRequest(Picture image) + { + Image = image.Image; + MimeType = image.MimeType; + } + + #endregion + + + public Database.Model.Account.AccountProfilePicture CreateMediaPosterImage() => new Database.Model.Account.AccountProfilePicture + { + Image = Image, + MimeType = MimeType, + }; + + public void UpdateMediaPosterImage(Database.Model.Account.AccountProfilePicture item) + { + item.Image = Image; + item.MimeType = MimeType; + item.UploadDate = DateTime.UtcNow; + } +} \ No newline at end of file diff --git a/WatchIt.WebAPI/WatchIt.WebAPI.Controllers/AccountsController.cs b/WatchIt.WebAPI/WatchIt.WebAPI.Controllers/AccountsController.cs index 3bcb30d..02fa953 100644 --- a/WatchIt.WebAPI/WatchIt.WebAPI.Controllers/AccountsController.cs +++ b/WatchIt.WebAPI/WatchIt.WebAPI.Controllers/AccountsController.cs @@ -27,7 +27,7 @@ public class AccountsController(IAccountsControllerService accountsControllerSer [ProducesResponseType(typeof(void), StatusCodes.Status401Unauthorized)] public async Task Authenticate([FromBody]AuthenticateRequest body) => await accountsControllerService.Authenticate(body); - [HttpPost("authenticate-refresh")] + [HttpPost("authenticate_refresh")] [Authorize(AuthenticationSchemes = "refresh")] [ProducesResponseType(typeof(AuthenticateResponse), StatusCodes.Status200OK)] [ProducesResponseType(typeof(void), StatusCodes.Status401Unauthorized)] @@ -39,25 +39,38 @@ public class AccountsController(IAccountsControllerService accountsControllerSer [ProducesResponseType(typeof(void), StatusCodes.Status204NoContent)] public async Task Logout() => await accountsControllerService.Logout(); - [HttpGet("{id}/profile-picture")] + [HttpGet("{id}/profile_picture")] [AllowAnonymous] [ProducesResponseType(typeof(AccountProfilePictureResponse), StatusCodes.Status200OK)] [ProducesResponseType(typeof(ValidationProblemDetails), StatusCodes.Status400BadRequest)] [ProducesResponseType(StatusCodes.Status404NotFound)] public async Task GetAccountProfilePicture([FromRoute(Name = "id")]long id) => await accountsControllerService.GetAccountProfilePicture(id); + [HttpPut("profile_picture")] + [Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme)] + [ProducesResponseType(typeof(AccountProfilePictureResponse), StatusCodes.Status200OK)] + [ProducesResponseType(typeof(ValidationProblemDetails), StatusCodes.Status400BadRequest)] + [ProducesResponseType(typeof(void), StatusCodes.Status401Unauthorized)] + public async Task PutAccountProfilePicture([FromBody]AccountProfilePictureRequest body) => await accountsControllerService.PutAccountProfilePicture(body); + + [HttpDelete("profile_picture")] + [Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme)] + [ProducesResponseType(typeof(void), StatusCodes.Status204NoContent)] + [ProducesResponseType(typeof(void), StatusCodes.Status401Unauthorized)] + public async Task DeleteAccountProfilePicture() => await accountsControllerService.DeleteAccountProfilePicture(); + [HttpGet("{id}/info")] [AllowAnonymous] [ProducesResponseType(typeof(AccountResponse), StatusCodes.Status200OK)] [ProducesResponseType(StatusCodes.Status404NotFound)] public async Task GetAccountInfo([FromRoute]long id) => await accountsControllerService.GetAccountInfo(id); - [HttpPut("info")] + [HttpPut("profile_info")] [Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme)] - [ProducesResponseType(typeof(AccountResponse), StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status200OK)] [ProducesResponseType(StatusCodes.Status401Unauthorized)] [ProducesResponseType(StatusCodes.Status404NotFound)] - public async Task PutAccountInfo([FromBody]AccountRequest data) => await accountsControllerService.PutAccountInfo(data); + public async Task PutAccountProfileInfo([FromBody]AccountProfileInfoRequest data) => await accountsControllerService.PutAccountProfileInfo(data); [HttpGet("{id}/movies")] [AllowAnonymous] diff --git a/WatchIt.WebAPI/WatchIt.WebAPI.Services/WatchIt.WebAPI.Services.Controllers/WatchIt.WebAPI.Services.Controllers.Accounts/AccountsControllerService.cs b/WatchIt.WebAPI/WatchIt.WebAPI.Services/WatchIt.WebAPI.Services.Controllers/WatchIt.WebAPI.Services.Controllers.Accounts/AccountsControllerService.cs index a4151d7..da1d7a9 100644 --- a/WatchIt.WebAPI/WatchIt.WebAPI.Services/WatchIt.WebAPI.Services.Controllers/WatchIt.WebAPI.Services.Controllers.Accounts/AccountsControllerService.cs +++ b/WatchIt.WebAPI/WatchIt.WebAPI.Services/WatchIt.WebAPI.Services.Controllers/WatchIt.WebAPI.Services.Controllers.Accounts/AccountsControllerService.cs @@ -142,6 +142,48 @@ public class AccountsControllerService( AccountProfilePictureResponse picture = new AccountProfilePictureResponse(account.ProfilePicture); return RequestResult.Ok(picture); } + + public async Task PutAccountProfilePicture(AccountProfilePictureRequest data) + { + Account account = await database.Accounts.FirstAsync(x => x.Id == userService.GetUserId()); + Database.Model.Account.AccountProfilePicture? picture = account.ProfilePicture; + + if (picture is null) + { + picture = data.CreateMediaPosterImage(); + await database.AccountProfilePictures.AddAsync(picture); + await database.SaveChangesAsync(); + + account.ProfilePictureId = picture.Id; + } + else + { + data.UpdateMediaPosterImage(picture); + } + + await database.SaveChangesAsync(); + + AccountProfilePictureResponse returnData = new AccountProfilePictureResponse(picture); + return RequestResult.Ok(returnData); + } + + public async Task DeleteAccountProfilePicture() + { + Account account = await database.Accounts.FirstAsync(x => x.Id == userService.GetUserId()); + Database.Model.Account.AccountProfilePicture? picture = account.ProfilePicture; + + if (picture is not null) + { + account.ProfilePictureId = null; + await database.SaveChangesAsync(); + + database.AccountProfilePictures.Attach(picture); + database.AccountProfilePictures.Remove(picture); + await database.SaveChangesAsync(); + } + + return RequestResult.NoContent(); + } public async Task GetAccountInfo(long id) { @@ -151,11 +193,11 @@ public class AccountsControllerService( return RequestResult.NotFound(); } - AccountResponse response = new AccountResponse(account); - return RequestResult.Ok(response); + AccountResponse profileInfoResponse = new AccountResponse(account); + return RequestResult.Ok(profileInfoResponse); } - public async Task PutAccountInfo(AccountRequest data) + public async Task PutAccountProfileInfo(AccountProfileInfoRequest data) { Account? account = await database.Accounts.FirstOrDefaultAsync(x => x.Id == userService.GetUserId()); if (account is null) @@ -164,6 +206,8 @@ public class AccountsControllerService( } data.UpdateAccount(account); + await database.SaveChangesAsync(); + return RequestResult.Ok(); } diff --git a/WatchIt.WebAPI/WatchIt.WebAPI.Services/WatchIt.WebAPI.Services.Controllers/WatchIt.WebAPI.Services.Controllers.Accounts/IAccountsControllerService.cs b/WatchIt.WebAPI/WatchIt.WebAPI.Services/WatchIt.WebAPI.Services.Controllers/WatchIt.WebAPI.Services.Controllers.Accounts/IAccountsControllerService.cs index 500b256..4fb51a0 100644 --- a/WatchIt.WebAPI/WatchIt.WebAPI.Services/WatchIt.WebAPI.Services.Controllers/WatchIt.WebAPI.Services.Controllers.Accounts/IAccountsControllerService.cs +++ b/WatchIt.WebAPI/WatchIt.WebAPI.Services/WatchIt.WebAPI.Services.Controllers/WatchIt.WebAPI.Services.Controllers.Accounts/IAccountsControllerService.cs @@ -14,8 +14,10 @@ public interface IAccountsControllerService Task AuthenticateRefresh(); Task Logout(); Task GetAccountProfilePicture(long id); + Task PutAccountProfilePicture(AccountProfilePictureRequest data); + Task DeleteAccountProfilePicture(); Task GetAccountInfo(long id); - Task PutAccountInfo(AccountRequest data); + Task PutAccountProfileInfo(AccountProfileInfoRequest data); Task GetAccountRatedMovies(long id, MovieRatedQueryParameters query); Task GetAccountRatedSeries(long id, SeriesRatedQueryParameters query); Task GetAccountRatedPersons(long id, PersonRatedQueryParameters query); diff --git a/WatchIt.WebAPI/WatchIt.WebAPI.Validators/Accounts/AccountRequestValidator.cs b/WatchIt.WebAPI/WatchIt.WebAPI.Validators/Accounts/AccountProfileInfoRequestValidator.cs similarity index 52% rename from WatchIt.WebAPI/WatchIt.WebAPI.Validators/Accounts/AccountRequestValidator.cs rename to WatchIt.WebAPI/WatchIt.WebAPI.Validators/Accounts/AccountProfileInfoRequestValidator.cs index a5b3265..aa20074 100644 --- a/WatchIt.WebAPI/WatchIt.WebAPI.Validators/Accounts/AccountRequestValidator.cs +++ b/WatchIt.WebAPI/WatchIt.WebAPI.Validators/Accounts/AccountProfileInfoRequestValidator.cs @@ -4,14 +4,10 @@ using WatchIt.Database; namespace WatchIt.WebAPI.Validators.Accounts; -public class AccountRequestValidator : AbstractValidator +public class AccountProfileInfoRequestValidator : AbstractValidator { - public AccountRequestValidator(DatabaseContext database) + public AccountProfileInfoRequestValidator(DatabaseContext database) { - RuleFor(x => x.Username).NotEmpty() - .MaximumLength(50); - RuleFor(x => x.Email).EmailAddress() - .MaximumLength(320); RuleFor(x => x.Description).MaximumLength(1000); When(x => x.GenderId.HasValue, () => { diff --git a/WatchIt.WebAPI/WatchIt.WebAPI.Validators/Accounts/AccountProfilePictureRequestValidator.cs b/WatchIt.WebAPI/WatchIt.WebAPI.Validators/Accounts/AccountProfilePictureRequestValidator.cs new file mode 100644 index 0000000..873766c --- /dev/null +++ b/WatchIt.WebAPI/WatchIt.WebAPI.Validators/Accounts/AccountProfilePictureRequestValidator.cs @@ -0,0 +1,13 @@ +using FluentValidation; +using WatchIt.Common.Model.Accounts; + +namespace WatchIt.WebAPI.Validators.Accounts; + +public class AccountProfilePictureRequestValidator : AbstractValidator +{ + public AccountProfilePictureRequestValidator() + { + RuleFor(x => x.Image).NotEmpty(); + RuleFor(x => x.MimeType).Matches(@"\w+/.+").WithMessage("Incorrect mimetype"); + } +} \ No newline at end of file diff --git a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/Accounts/AccountsClientService.cs b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/Accounts/AccountsClientService.cs index c246c03..4438636 100644 --- a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/Accounts/AccountsClientService.cs +++ b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/Accounts/AccountsClientService.cs @@ -71,7 +71,7 @@ public class AccountsClientService(IHttpClientService httpClientService, IConfig public async Task GetAccountProfilePicture(long id, Action? successAction = null, Action>? badRequestAction = null, Action? notFoundAction = null) { - string url = GetUrl(EndpointsConfiguration.Accounts.GetProfilePicture, id); + string url = GetUrl(EndpointsConfiguration.Accounts.GetAccountProfilePicture, id); HttpRequest request = new HttpRequest(HttpMethodType.Get, url); HttpResponse response = await httpClientService.SendRequestAsync(request); @@ -80,6 +80,34 @@ public class AccountsClientService(IHttpClientService httpClientService, IConfig .RegisterActionFor404NotFound(notFoundAction) .ExecuteAction(); } + + public async Task PutAccountProfilePicture(AccountProfilePictureRequest data, Action? successAction = null, Action>? badRequestAction = null, Action? unauthorizedAction = null) + { + string url = GetUrl(EndpointsConfiguration.Accounts.PutAccountProfilePicture); + + HttpRequest request = new HttpRequest(HttpMethodType.Put, url) + { + Body = data + }; + + HttpResponse response = await httpClientService.SendRequestAsync(request); + response.RegisterActionFor2XXSuccess(successAction) + .RegisterActionFor400BadRequest(badRequestAction) + .RegisterActionFor401Unauthorized(unauthorizedAction) + .ExecuteAction(); + } + + public async Task DeleteAccountProfilePicture(Action? successAction = null, Action? unauthorizedAction = null) + { + string url = GetUrl(EndpointsConfiguration.Accounts.DeleteAccountProfilePicture); + + HttpRequest request = new HttpRequest(HttpMethodType.Delete, url); + + HttpResponse response = await httpClientService.SendRequestAsync(request); + response.RegisterActionFor2XXSuccess(successAction) + .RegisterActionFor401Unauthorized(unauthorizedAction) + .ExecuteAction(); + } public async Task GetAccountInfo(long id, Action? successAction = null, Action? notFoundAction = null) { @@ -92,9 +120,9 @@ public class AccountsClientService(IHttpClientService httpClientService, IConfig .ExecuteAction(); } - public async Task PutAccountInfo(AccountRequest data, Action? successAction = null, Action>? badRequestAction = null, Action? unauthorizedAction = null, Action? notFoundAction = null) + public async Task PutAccountProfileInfo(AccountProfileInfoRequest data, Action? successAction = null, Action>? badRequestAction = null, Action? unauthorizedAction = null) { - string url = GetUrl(EndpointsConfiguration.Accounts.PutAccountInfo); + string url = GetUrl(EndpointsConfiguration.Accounts.PutAccountProfileInfo); HttpRequest request = new HttpRequest(HttpMethodType.Put, url) { Body = data, @@ -104,7 +132,6 @@ public class AccountsClientService(IHttpClientService httpClientService, IConfig response.RegisterActionFor2XXSuccess(successAction) .RegisterActionFor400BadRequest(badRequestAction) .RegisterActionFor401Unauthorized(unauthorizedAction) - .RegisterActionFor404NotFound(notFoundAction) .ExecuteAction(); } diff --git a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/Accounts/IAccountsClientService.cs b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/Accounts/IAccountsClientService.cs index 6f16640..bb45c37 100644 --- a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/Accounts/IAccountsClientService.cs +++ b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/Accounts/IAccountsClientService.cs @@ -12,8 +12,10 @@ public interface IAccountsClientService Task AuthenticateRefresh(Action? successAction = null, Action? unauthorizedAction = null, Action? forbiddenAction = null); Task Logout(Action? successAction = null); Task GetAccountProfilePicture(long id, Action? successAction = null, Action>? badRequestAction = null, Action? notFoundAction = null); + Task PutAccountProfilePicture(AccountProfilePictureRequest data, Action? successAction = null, Action>? badRequestAction = null, Action? unauthorizedAction = null); + Task DeleteAccountProfilePicture(Action? successAction = null, Action? unauthorizedAction = null); Task GetAccountInfo(long id, Action? successAction = null, Action? notFoundAction = null); - Task PutAccountInfo(AccountRequest data, Action? successAction = null, Action>? badRequestAction = null, Action? unauthorizedAction = null, Action? notFoundAction = null); + Task PutAccountProfileInfo(AccountProfileInfoRequest data, Action? successAction = null, Action>? badRequestAction = null, Action? unauthorizedAction = null); Task GetAccountRatedMovies(long id, MovieRatedQueryParameters query, Action>? successAction = null, Action? notFoundAction = null); Task GetAccountRatedSeries(long id, SeriesRatedQueryParameters query, Action>? successAction = null, Action? notFoundAction = null); Task GetAccountRatedPersons(long id, PersonRatedQueryParameters query, Action>? successAction = null, Action? notFoundAction = null); diff --git a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Configuration/Model/Accounts.cs b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Configuration/Model/Accounts.cs index 5731d34..02ac602 100644 --- a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Configuration/Model/Accounts.cs +++ b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Configuration/Model/Accounts.cs @@ -7,9 +7,11 @@ public class Accounts public string Authenticate { get; set; } public string AuthenticateRefresh { get; set; } public string Logout { get; set; } - public string GetProfilePicture { get; set; } + public string GetAccountProfilePicture { get; set; } + public string PutAccountProfilePicture { get; set; } + public string DeleteAccountProfilePicture { get; set; } public string GetAccountInfo { get; set; } - public string PutAccountInfo { get; set; } + public string PutAccountProfileInfo { get; set; } public string GetAccountRatedMovies { get; set; } public string GetAccountRatedSeries { get; set; } public string GetAccountRatedPersons { get; set; } diff --git a/WatchIt.Website/WatchIt.Website/App.razor b/WatchIt.Website/WatchIt.Website/App.razor index 5ceca05..66ac768 100644 --- a/WatchIt.Website/WatchIt.Website/App.razor +++ b/WatchIt.Website/WatchIt.Website/App.razor @@ -10,10 +10,10 @@ - + - + diff --git a/WatchIt.Website/WatchIt.Website/Components/Common/Panels/PictureEditorPanelComponent.razor b/WatchIt.Website/WatchIt.Website/Components/Common/Panels/PictureEditorPanelComponent.razor index 2264955..37613f4 100644 --- a/WatchIt.Website/WatchIt.Website/Components/Common/Panels/PictureEditorPanelComponent.razor +++ b/WatchIt.Website/WatchIt.Website/Components/Common/Panels/PictureEditorPanelComponent.razor @@ -2,7 +2,7 @@ @if (_loaded) {
- + @if (_pictureChanged || _pictureSaved is not null) { diff --git a/WatchIt.Website/WatchIt.Website/Components/Common/Panels/PictureEditorPanelComponent.razor.cs b/WatchIt.Website/WatchIt.Website/Components/Common/Panels/PictureEditorPanelComponent.razor.cs index 3bd56b1..1949048 100644 --- a/WatchIt.Website/WatchIt.Website/Components/Common/Panels/PictureEditorPanelComponent.razor.cs +++ b/WatchIt.Website/WatchIt.Website/Components/Common/Panels/PictureEditorPanelComponent.razor.cs @@ -11,10 +11,12 @@ public partial class PictureEditorPanelComponent : ComponentBase [Parameter] public long? Id { get; set; } [Parameter] public int ContentWidth { get; set; } = 300; [Parameter] public required string PicturePlaceholder { get; set; } + [Parameter] public bool Circle { get; set; } [Parameter] public string Class { get; set; } = string.Empty; [Parameter] public required Func, Task> PictureGetTask { get; set; } [Parameter] public required Func, Task> PicturePutTask { get; set; } [Parameter] public required Func PictureDeleteTask { get; set; } + [Parameter] public Action? OnPictureChanged { get; set; } #endregion @@ -92,6 +94,7 @@ public partial class PictureEditorPanelComponent : ComponentBase _pictureSelected = data; _pictureChanged = false; _pictureSaving = false; + OnPictureChanged?.Invoke(data); } _pictureSaving = true; @@ -112,6 +115,7 @@ public partial class PictureEditorPanelComponent : ComponentBase _pictureSelected = null; _pictureChanged = false; _pictureDeleting = false; + OnPictureChanged?.Invoke(null); } _pictureDeleting = true; diff --git a/WatchIt.Website/WatchIt.Website/Components/Common/Subcomponents/AccountPictureComponent.razor b/WatchIt.Website/WatchIt.Website/Components/Common/Subcomponents/AccountPictureComponent.razor index ee75eef..6b532d5 100644 --- a/WatchIt.Website/WatchIt.Website/Components/Common/Subcomponents/AccountPictureComponent.razor +++ b/WatchIt.Website/WatchIt.Website/Components/Common/Subcomponents/AccountPictureComponent.razor @@ -1 +1,7 @@ -avatar \ No newline at end of file + \ No newline at end of file diff --git a/WatchIt.Website/WatchIt.Website/Components/Common/Subcomponents/AccountPictureComponent.razor.cs b/WatchIt.Website/WatchIt.Website/Components/Common/Subcomponents/AccountPictureComponent.razor.cs index 21e0402..42d51f8 100644 --- a/WatchIt.Website/WatchIt.Website/Components/Common/Subcomponents/AccountPictureComponent.razor.cs +++ b/WatchIt.Website/WatchIt.Website/Components/Common/Subcomponents/AccountPictureComponent.razor.cs @@ -30,6 +30,18 @@ public partial class AccountPictureComponent : ComponentBase private AccountProfilePictureResponse? _picture; #endregion + + + + #region PUBLIC METHODS + + public async Task Reload() + { + await AccountsClientService.GetAccountProfilePicture(Id, data => _picture = data, notFoundAction: () => _picture = null); + StateHasChanged(); + } + + #endregion @@ -39,18 +51,7 @@ public partial class AccountPictureComponent : ComponentBase { if (firstRender) { - List endTasks = new List(); - - // STEP 0 - endTasks.AddRange( - [ - AccountsClientService.GetAccountProfilePicture(Id, data => _picture = data) - ]); - - // END - await Task.WhenAll(endTasks); - - StateHasChanged(); + await Reload(); } } diff --git a/WatchIt.Website/WatchIt.Website/Components/Common/Subcomponents/PictureComponent.razor b/WatchIt.Website/WatchIt.Website/Components/Common/Subcomponents/PictureComponent.razor index 398c4d6..358a074 100644 --- a/WatchIt.Website/WatchIt.Website/Components/Common/Subcomponents/PictureComponent.razor +++ b/WatchIt.Website/WatchIt.Website/Components/Common/Subcomponents/PictureComponent.razor @@ -1 +1 @@ -@(AlternativeText) \ No newline at end of file +@(AlternativeText) \ No newline at end of file diff --git a/WatchIt.Website/WatchIt.Website/Components/Common/Subcomponents/PictureComponent.razor.cs b/WatchIt.Website/WatchIt.Website/Components/Common/Subcomponents/PictureComponent.razor.cs index 213b9c2..08800d4 100644 --- a/WatchIt.Website/WatchIt.Website/Components/Common/Subcomponents/PictureComponent.razor.cs +++ b/WatchIt.Website/WatchIt.Website/Components/Common/Subcomponents/PictureComponent.razor.cs @@ -14,6 +14,8 @@ public partial class PictureComponent : ComponentBase [Parameter] public string Class { get; set; } = string.Empty; [Parameter] public int? Height { get; set; } [Parameter] public int? Width { get; set; } + [Parameter] public bool Circle { get; set; } + [Parameter] public bool Shadow { get; set; } = true; #endregion @@ -40,6 +42,11 @@ public partial class PictureComponent : ComponentBase { _attributes.Add("width", Width.Value); } + + if (Circle) + { + AspectRatio = PictureComponentAspectRatio.Square; + } } #endregion @@ -71,6 +78,7 @@ public partial class PictureComponent : ComponentBase public static readonly PictureComponentAspectRatio Default = new PictureComponentAspectRatio(); public static readonly PictureComponentAspectRatio Photo = new PictureComponentAspectRatio(16, 9); + public static readonly PictureComponentAspectRatio Square = new PictureComponentAspectRatio(1, 1); #endregion diff --git a/WatchIt.Website/WatchIt.Website/Components/Pages/UserEditPage/Panels/ProfileEditFormPanelComponent.razor b/WatchIt.Website/WatchIt.Website/Components/Pages/UserEditPage/Panels/ProfileEditFormPanelComponent.razor new file mode 100644 index 0000000..438fa9c --- /dev/null +++ b/WatchIt.Website/WatchIt.Website/Components/Pages/UserEditPage/Panels/ProfileEditFormPanelComponent.razor @@ -0,0 +1,60 @@ +@using WatchIt.Common.Model.Genders + + + +
+ @if (_loaded) + { +
+

Basic profile info

+ + +
+
+ +
+ +
+
+
+ +
+ + + @foreach (GenderResponse gender in _genders) + { + + } + +
+
+
+
+ @if (!string.IsNullOrWhiteSpace(_error)) + { + @(_error) + } +
+
+ +
+
+
+
+
+ } + else + { + + } +
\ No newline at end of file diff --git a/WatchIt.Website/WatchIt.Website/Components/Pages/UserEditPage/Panels/ProfileEditFormPanelComponent.razor.cs b/WatchIt.Website/WatchIt.Website/Components/Pages/UserEditPage/Panels/ProfileEditFormPanelComponent.razor.cs new file mode 100644 index 0000000..59806dd --- /dev/null +++ b/WatchIt.Website/WatchIt.Website/Components/Pages/UserEditPage/Panels/ProfileEditFormPanelComponent.razor.cs @@ -0,0 +1,86 @@ +using Microsoft.AspNetCore.Components; +using WatchIt.Common.Model.Accounts; +using WatchIt.Common.Model.Genders; +using WatchIt.Website.Services.Client.Accounts; +using WatchIt.Website.Services.Client.Genders; + +namespace WatchIt.Website.Components.Pages.UserEditPage.Panels; + +public partial class ProfileEditFormPanelComponent : ComponentBase +{ + #region SERVICES + + [Inject] private NavigationManager NavigationManager { get; set; } = default!; + [Inject] private IAccountsClientService AccountsClientService { get; set; } = default!; + [Inject] private IGendersClientService GendersClientService { get; set; } = default!; + + #endregion + + + + #region PARAMETERS + + [Parameter] public long Id { get; set; } + [Parameter] public string Class { get; set; } = string.Empty; + + #endregion + + + + #region FIELDS + + private bool _loaded; + private bool _saving; + private string? _error; + + private IEnumerable _genders = []; + + private AccountProfileInfoRequest _accountProfileInfo = new AccountProfileInfoRequest(); + + #endregion + + + + #region PRIVATE METHODS + + protected override async Task OnAfterRenderAsync(bool firstRender) + { + if (firstRender) + { + await Task.WhenAll( + [ + GendersClientService.GetAllGenders(successAction: data => _genders = data), + AccountsClientService.GetAccountInfo(Id, data => _accountProfileInfo = new AccountProfileInfoRequest(data)) + ]); + + _loaded = true; + StateHasChanged(); + } + } + + private async Task Save() + { + void Success() + { + _error = null; + _saving = false; + } + + void BadRequest(IDictionary errors) + { + _error = errors.SelectMany(x => x.Value).FirstOrDefault() ?? "Unknown error"; + _saving = false; + } + + void AuthError() + { + _error = "Authentication error"; + _saving = false; + } + + _saving = true; + await AccountsClientService.PutAccountProfileInfo(_accountProfileInfo, Success, BadRequest, AuthError); + } + + #endregion +} \ No newline at end of file diff --git a/WatchIt.Website/WatchIt.Website/Components/Pages/UserEditPage/Panels/ProfileEditHeaderPanelComponent.razor b/WatchIt.Website/WatchIt.Website/Components/Pages/UserEditPage/Panels/ProfileEditHeaderPanelComponent.razor new file mode 100644 index 0000000..6385348 --- /dev/null +++ b/WatchIt.Website/WatchIt.Website/Components/Pages/UserEditPage/Panels/ProfileEditHeaderPanelComponent.razor @@ -0,0 +1,5 @@ +
+
+

Profile settings

+
+
\ No newline at end of file diff --git a/WatchIt.Website/WatchIt.Website/Components/Pages/UserEditPage/Panels/ProfileEditHeaderPanelComponent.razor.css b/WatchIt.Website/WatchIt.Website/Components/Pages/UserEditPage/Panels/ProfileEditHeaderPanelComponent.razor.css new file mode 100644 index 0000000..e69de29 diff --git a/WatchIt.Website/WatchIt.Website/Components/Pages/UserEditPage/Panels/UserEditPageHeaderPanelComponent.razor b/WatchIt.Website/WatchIt.Website/Components/Pages/UserEditPage/Panels/UserEditPageHeaderPanelComponent.razor new file mode 100644 index 0000000..2b2c701 --- /dev/null +++ b/WatchIt.Website/WatchIt.Website/Components/Pages/UserEditPage/Panels/UserEditPageHeaderPanelComponent.razor @@ -0,0 +1,9 @@ +
+
+ +
+

@(User.Username)

+ User settings +
+
+
\ No newline at end of file diff --git a/WatchIt.Website/WatchIt.Website/Components/Pages/UserEditPage/Panels/UserEditPageHeaderPanelComponent.razor.cs b/WatchIt.Website/WatchIt.Website/Components/Pages/UserEditPage/Panels/UserEditPageHeaderPanelComponent.razor.cs new file mode 100644 index 0000000..9b44909 --- /dev/null +++ b/WatchIt.Website/WatchIt.Website/Components/Pages/UserEditPage/Panels/UserEditPageHeaderPanelComponent.razor.cs @@ -0,0 +1,38 @@ +using Microsoft.AspNetCore.Components; +using WatchIt.Website.Components.Common.Subcomponents; +using WatchIt.Website.Services.Authentication; + +namespace WatchIt.Website.Components.Pages.UserEditPage.Panels; + +public partial class UserEditPageHeaderPanelComponent : ComponentBase +{ + #region SERVICES + + [Inject] public NavigationManager NavigationManager { get; set; } = default!; + + #endregion + + + + #region PARAMETERS + + [Parameter] public required User User { get; set; } + + #endregion + + + + #region FIELDS + + private AccountPictureComponent _accountPicture = default!; + + #endregion + + + + #region PUBLIC METHODS + + public async Task ReloadPicture() => await _accountPicture.Reload(); + + #endregion +} \ No newline at end of file diff --git a/WatchIt.Website/WatchIt.Website/Components/Pages/UserEditPage/Panels/UserEditPageHeaderPanelComponent.razor.css b/WatchIt.Website/WatchIt.Website/Components/Pages/UserEditPage/Panels/UserEditPageHeaderPanelComponent.razor.css new file mode 100644 index 0000000..7044add --- /dev/null +++ b/WatchIt.Website/WatchIt.Website/Components/Pages/UserEditPage/Panels/UserEditPageHeaderPanelComponent.razor.css @@ -0,0 +1,9 @@ +/* IDS */ + +#username { + margin-top: -8px !important; +} + +#secondaryText { + color: lightgray !important; +} \ No newline at end of file diff --git a/WatchIt.Website/WatchIt.Website/Components/Pages/UserPage/Panels/UserPageHeaderPanelComponent.razor b/WatchIt.Website/WatchIt.Website/Components/Pages/UserPage/Panels/UserPageHeaderPanelComponent.razor index 86e41f1..28059b2 100644 --- a/WatchIt.Website/WatchIt.Website/Components/Pages/UserPage/Panels/UserPageHeaderPanelComponent.razor +++ b/WatchIt.Website/WatchIt.Website/Components/Pages/UserPage/Panels/UserPageHeaderPanelComponent.razor @@ -1,26 +1,26 @@
- +
-

@(AccountData.Username)

+

@(AccountProfileInfoData.Username)

- @if (!string.IsNullOrWhiteSpace(AccountData.Description)) + @if (!string.IsNullOrWhiteSpace(AccountProfileInfoData.Description)) { - - @(AccountData.Description) + + @(AccountProfileInfoData.Description) }
-
+
@Body
diff --git a/WatchIt.Website/WatchIt.Website/Layout/MainLayout.razor.cs b/WatchIt.Website/WatchIt.Website/Layout/MainLayout.razor.cs index 10a09d8..a73056b 100644 --- a/WatchIt.Website/WatchIt.Website/Layout/MainLayout.razor.cs +++ b/WatchIt.Website/WatchIt.Website/Layout/MainLayout.razor.cs @@ -2,6 +2,7 @@ using System.Net; using Microsoft.AspNetCore.Components; using WatchIt.Common.Model.Accounts; using WatchIt.Common.Model.Photos; +using WatchIt.Website.Components.Common.Subcomponents; using WatchIt.Website.Services.Authentication; using WatchIt.Website.Services.Tokens; using WatchIt.Website.Services.Client.Accounts; @@ -27,6 +28,8 @@ public partial class MainLayout : LayoutComponentBase #region FIELDS + private AccountPictureComponent? _profilePicture; + private bool _loaded; private User? _user; @@ -53,6 +56,20 @@ public partial class MainLayout : LayoutComponentBase } #endregion + + + + #region PUBLIC METHODS + + public async Task ReloadProfilePicture() + { + if (_profilePicture is not null) + { + await _profilePicture.Reload(); + } + } + + #endregion diff --git a/WatchIt.Website/WatchIt.Website/Pages/UserEditPage.razor b/WatchIt.Website/WatchIt.Website/Pages/UserEditPage.razor index 64a2378..c9e0aac 100644 --- a/WatchIt.Website/WatchIt.Website/Pages/UserEditPage.razor +++ b/WatchIt.Website/WatchIt.Website/Pages/UserEditPage.razor @@ -1 +1,82 @@ -@page "/user/edit" \ No newline at end of file +@using System.Text +@using WatchIt.Common.Model +@using WatchIt.Website.Components.Pages.UserEditPage.Panels + +@page "/user/edit" + +@{ + StringBuilder sb = new StringBuilder(" - WatchIt"); + + if (_user is null) sb.Insert(0, "Loading..."); + else sb.Insert(0, "User settings"); + + @(sb.ToString()) +} + + + +
+ @if (_user is not null) + { +
+
+ +
+
+
+
+ + + Profile + Account + + + +
+
+
+
+ +
+
+
+
+ +
+
+ +
+
+
+
+
+ + + +
+
+
+
+ } + else + { +
+
+
+ +
+
+
+ } +
\ No newline at end of file diff --git a/WatchIt.Website/WatchIt.Website/Pages/UserEditPage.razor.cs b/WatchIt.Website/WatchIt.Website/Pages/UserEditPage.razor.cs index d5a489f..b3ada08 100644 --- a/WatchIt.Website/WatchIt.Website/Pages/UserEditPage.razor.cs +++ b/WatchIt.Website/WatchIt.Website/Pages/UserEditPage.razor.cs @@ -1,7 +1,68 @@ +using System.Net; using Microsoft.AspNetCore.Components; +using WatchIt.Common.Model; +using WatchIt.Website.Components.Pages.UserEditPage.Panels; +using WatchIt.Website.Layout; +using WatchIt.Website.Services.Authentication; +using WatchIt.Website.Services.Client.Accounts; namespace WatchIt.Website.Pages; public partial class UserEditPage : ComponentBase { + #region SERVICES + + [Inject] private NavigationManager NavigationManager { get; set; } = default!; + [Inject] private IAuthenticationService AuthenticationService { get; set; } = default!; + [Inject] private IAccountsClientService AccountsClientService { get; set; } = default!; + + #endregion + + + + #region PARAMETERS + + [CascadingParameter] public MainLayout Layout { get; set; } = default!; + + #endregion + + + + #region FIELDS + + private User? _user; + + private UserEditPageHeaderPanelComponent _header = default!; + + #endregion + + + + #region PRIVATE METHODS + + protected override async Task OnAfterRenderAsync(bool firstRender) + { + if (firstRender) + { + Layout.BackgroundPhoto = null; + + _user = await AuthenticationService.GetUserAsync(); + if (_user is null) + { + NavigationManager.NavigateTo($"/auth?redirect_to={WebUtility.UrlEncode("/user/edit")}"); + } + else + { + StateHasChanged(); + } + } + } + + private async Task PictureChanged() => await Task.WhenAll( + [ + _header.ReloadPicture(), + Layout.ReloadProfilePicture() + ]); + + #endregion } \ No newline at end of file diff --git a/WatchIt.Website/WatchIt.Website/Pages/UserPage.razor b/WatchIt.Website/WatchIt.Website/Pages/UserPage.razor index 12503ca..ff65c65 100644 --- a/WatchIt.Website/WatchIt.Website/Pages/UserPage.razor +++ b/WatchIt.Website/WatchIt.Website/Pages/UserPage.razor @@ -48,7 +48,7 @@ {
- +
diff --git a/WatchIt.Website/WatchIt.Website/Pages/UserPage.razor.cs b/WatchIt.Website/WatchIt.Website/Pages/UserPage.razor.cs index 2a2985c..4de839e 100644 --- a/WatchIt.Website/WatchIt.Website/Pages/UserPage.razor.cs +++ b/WatchIt.Website/WatchIt.Website/Pages/UserPage.razor.cs @@ -1,3 +1,4 @@ +using System.Net; using Microsoft.AspNetCore.Components; using WatchIt.Common.Model.Accounts; using WatchIt.Website.Layout; @@ -75,7 +76,7 @@ public partial class UserPage : ComponentBase { if (user is null) { - NavigationManager.NavigateTo("/auth"); + NavigationManager.NavigateTo($"/auth?redirect_to={WebUtility.UrlEncode("/user")}"); _redirection = true; return; } diff --git a/WatchIt.Website/WatchIt.Website/appsettings.json b/WatchIt.Website/WatchIt.Website/appsettings.json index 9d0355d..2d4a0f1 100644 --- a/WatchIt.Website/WatchIt.Website/appsettings.json +++ b/WatchIt.Website/WatchIt.Website/appsettings.json @@ -19,11 +19,13 @@ "Base": "/accounts", "Register": "/register", "Authenticate": "/authenticate", - "AuthenticateRefresh": "/authenticate-refresh", + "AuthenticateRefresh": "/authenticate_refresh", "Logout": "/logout", - "GetProfilePicture": "/{0}/profile-picture", + "GetAccountProfilePicture": "/{0}/profile_picture", + "PutAccountProfilePicture": "/profile_picture", + "DeleteAccountProfilePicture": "/profile_picture", "GetAccountInfo": "/{0}/info", - "PutAccountInfo": "/info", + "PutAccountProfileInfo": "/profile_info", "GetAccountRatedMovies": "/{0}/movies", "GetAccountRatedSeries": "/{0}/series", "GetAccountRatedPersons": "/{0}/persons" diff --git a/WatchIt.Website/WatchIt.Website/wwwroot/css/panel.css b/WatchIt.Website/WatchIt.Website/wwwroot/css/panel.css index 0e200f3..6dcb155 100644 --- a/WatchIt.Website/WatchIt.Website/wwwroot/css/panel.css +++ b/WatchIt.Website/WatchIt.Website/wwwroot/css/panel.css @@ -28,7 +28,7 @@ gap: 1rem; padding: 1rem 1.5rem !important; - background-color: rgba(0, 0, 0, 0.8); + background-color: rgba(0, 0, 0, 0.7); } .panel-menu > li > a { @@ -52,6 +52,14 @@ +/* SECTION HEADER */ + +.panel-section-header { + padding: 0.75rem 1.5rem; +} + + + /* BACKGROUNDS */ .panel-background-gold { From 314fceb1208c1e1a3e99684b72e7d64e33644360 Mon Sep 17 00:00:00 2001 From: Mateusz Skoczek Date: Sun, 3 Nov 2024 23:27:45 +0100 Subject: [PATCH 14/20] profile background editor panel added --- .../Panels/ProfileBackgroundEditorPanelComponent.razor | 5 +++++ .../Panels/ProfileBackgroundEditorPanelComponent.razor.cs | 7 +++++++ WatchIt.Website/WatchIt.Website/Pages/UserEditPage.razor | 5 +++++ 3 files changed, 17 insertions(+) create mode 100644 WatchIt.Website/WatchIt.Website/Components/Pages/UserEditPage/Panels/ProfileBackgroundEditorPanelComponent.razor create mode 100644 WatchIt.Website/WatchIt.Website/Components/Pages/UserEditPage/Panels/ProfileBackgroundEditorPanelComponent.razor.cs diff --git a/WatchIt.Website/WatchIt.Website/Components/Pages/UserEditPage/Panels/ProfileBackgroundEditorPanelComponent.razor b/WatchIt.Website/WatchIt.Website/Components/Pages/UserEditPage/Panels/ProfileBackgroundEditorPanelComponent.razor new file mode 100644 index 0000000..8d8a88c --- /dev/null +++ b/WatchIt.Website/WatchIt.Website/Components/Pages/UserEditPage/Panels/ProfileBackgroundEditorPanelComponent.razor @@ -0,0 +1,5 @@ +
+
+

Profile background

+
+
\ No newline at end of file diff --git a/WatchIt.Website/WatchIt.Website/Components/Pages/UserEditPage/Panels/ProfileBackgroundEditorPanelComponent.razor.cs b/WatchIt.Website/WatchIt.Website/Components/Pages/UserEditPage/Panels/ProfileBackgroundEditorPanelComponent.razor.cs new file mode 100644 index 0000000..904e6a4 --- /dev/null +++ b/WatchIt.Website/WatchIt.Website/Components/Pages/UserEditPage/Panels/ProfileBackgroundEditorPanelComponent.razor.cs @@ -0,0 +1,7 @@ +using Microsoft.AspNetCore.Components; + +namespace WatchIt.Website.Components.Pages.UserEditPage.Panels; + +public partial class ProfileBackgroundEditorPanelComponent : ComponentBase +{ +} \ No newline at end of file diff --git a/WatchIt.Website/WatchIt.Website/Pages/UserEditPage.razor b/WatchIt.Website/WatchIt.Website/Pages/UserEditPage.razor index c9e0aac..8031ff4 100644 --- a/WatchIt.Website/WatchIt.Website/Pages/UserEditPage.razor +++ b/WatchIt.Website/WatchIt.Website/Pages/UserEditPage.razor @@ -58,6 +58,11 @@ Class="h-100"/>
+
+
+ +
+
From 26a5e1e5587ae75e619c02305392c173eec5af8e Mon Sep 17 00:00:00 2001 From: Mateusz Skoczek Date: Tue, 5 Nov 2024 20:04:15 +0100 Subject: [PATCH 15/20] profile editing finished --- .../AccountProfileBackgroundRequest.cs | 24 ++++ .../AccountsController.cs | 33 +++++ .../AccountsControllerService.cs | 56 ++++++++ .../IAccountsControllerService.cs | 3 + ...ccountProfileBackgroundRequestValidator.cs | 14 ++ .../Accounts/AccountsClientService.cs | 41 ++++++ .../Accounts/IAccountsClientService.cs | 4 + .../Model/Accounts.cs | 3 + WatchIt.Website/WatchIt.Website/App.razor | 2 +- ...rofileBackgroundEditorPanelComponent.razor | 122 +++++++++++++++++- ...ileBackgroundEditorPanelComponent.razor.cs | 121 +++++++++++++++++ ...leBackgroundEditorPanelComponent.razor.css | 23 ++++ .../WatchIt.Website/Pages/UserEditPage.razor | 5 +- .../Pages/UserEditPage.razor.cs | 15 ++- .../WatchIt.Website/Pages/UserPage.razor | 12 +- .../WatchIt.Website/Pages/UserPage.razor.cs | 10 +- .../WatchIt.Website/appsettings.json | 3 + 17 files changed, 475 insertions(+), 16 deletions(-) create mode 100644 WatchIt.Common/WatchIt.Common.Model/Accounts/AccountProfileBackgroundRequest.cs create mode 100644 WatchIt.WebAPI/WatchIt.WebAPI.Validators/Accounts/AccountProfileBackgroundRequestValidator.cs create mode 100644 WatchIt.Website/WatchIt.Website/Components/Pages/UserEditPage/Panels/ProfileBackgroundEditorPanelComponent.razor.css diff --git a/WatchIt.Common/WatchIt.Common.Model/Accounts/AccountProfileBackgroundRequest.cs b/WatchIt.Common/WatchIt.Common.Model/Accounts/AccountProfileBackgroundRequest.cs new file mode 100644 index 0000000..4bcb781 --- /dev/null +++ b/WatchIt.Common/WatchIt.Common.Model/Accounts/AccountProfileBackgroundRequest.cs @@ -0,0 +1,24 @@ +using System.Diagnostics.CodeAnalysis; + +namespace WatchIt.Common.Model.Accounts; + +public class AccountProfileBackgroundRequest +{ + #region PROPERTIES + + public required Guid Id { get; set; } + + #endregion + + + + #region CONSTRUCTORS + + [SetsRequiredMembers] + public AccountProfileBackgroundRequest(Guid id) + { + Id = id; + } + + #endregion +} \ No newline at end of file diff --git a/WatchIt.WebAPI/WatchIt.WebAPI.Controllers/AccountsController.cs b/WatchIt.WebAPI/WatchIt.WebAPI.Controllers/AccountsController.cs index 02fa953..714d4e4 100644 --- a/WatchIt.WebAPI/WatchIt.WebAPI.Controllers/AccountsController.cs +++ b/WatchIt.WebAPI/WatchIt.WebAPI.Controllers/AccountsController.cs @@ -5,6 +5,7 @@ using Microsoft.AspNetCore.Mvc; using WatchIt.Common.Model.Accounts; using WatchIt.Common.Model.Movies; using WatchIt.Common.Model.Persons; +using WatchIt.Common.Model.Photos; using WatchIt.Common.Model.Series; using WatchIt.WebAPI.Services.Controllers.Accounts; @@ -14,6 +15,8 @@ namespace WatchIt.WebAPI.Controllers; [Route("accounts")] public class AccountsController(IAccountsControllerService accountsControllerService) : ControllerBase { + #region Basic + [HttpPost("register")] [AllowAnonymous] [ProducesResponseType(typeof(RegisterResponse), StatusCodes.Status201Created)] @@ -39,6 +42,10 @@ public class AccountsController(IAccountsControllerService accountsControllerSer [ProducesResponseType(typeof(void), StatusCodes.Status204NoContent)] public async Task Logout() => await accountsControllerService.Logout(); + #endregion + + #region Profile picture + [HttpGet("{id}/profile_picture")] [AllowAnonymous] [ProducesResponseType(typeof(AccountProfilePictureResponse), StatusCodes.Status200OK)] @@ -59,6 +66,32 @@ public class AccountsController(IAccountsControllerService accountsControllerSer [ProducesResponseType(typeof(void), StatusCodes.Status401Unauthorized)] public async Task DeleteAccountProfilePicture() => await accountsControllerService.DeleteAccountProfilePicture(); + #endregion + + #region Profile background + + [HttpGet("{id}/profile_background")] + [AllowAnonymous] + [ProducesResponseType(typeof(PhotoResponse), StatusCodes.Status200OK)] + [ProducesResponseType(typeof(ValidationProblemDetails), StatusCodes.Status400BadRequest)] + [ProducesResponseType(StatusCodes.Status404NotFound)] + public async Task GetAccountProfileBackground([FromRoute(Name = "id")]long id) => await accountsControllerService.GetAccountProfileBackground(id); + + [HttpPut("profile_background")] + [Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme)] + [ProducesResponseType(typeof(PhotoResponse), StatusCodes.Status200OK)] + [ProducesResponseType(typeof(ValidationProblemDetails), StatusCodes.Status400BadRequest)] + [ProducesResponseType(typeof(void), StatusCodes.Status401Unauthorized)] + public async Task PutAccountProfileBackground([FromBody]AccountProfileBackgroundRequest body) => await accountsControllerService.PutAccountProfileBackground(body); + + [HttpDelete("profile_background")] + [Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme)] + [ProducesResponseType(typeof(void), StatusCodes.Status204NoContent)] + [ProducesResponseType(typeof(void), StatusCodes.Status401Unauthorized)] + public async Task DeleteAccountProfileBackground() => await accountsControllerService.DeleteAccountProfileBackground(); + + #endregion + [HttpGet("{id}/info")] [AllowAnonymous] [ProducesResponseType(typeof(AccountResponse), StatusCodes.Status200OK)] diff --git a/WatchIt.WebAPI/WatchIt.WebAPI.Services/WatchIt.WebAPI.Services.Controllers/WatchIt.WebAPI.Services.Controllers.Accounts/AccountsControllerService.cs b/WatchIt.WebAPI/WatchIt.WebAPI.Services/WatchIt.WebAPI.Services.Controllers/WatchIt.WebAPI.Services.Controllers.Accounts/AccountsControllerService.cs index da1d7a9..e4a6879 100644 --- a/WatchIt.WebAPI/WatchIt.WebAPI.Services/WatchIt.WebAPI.Services.Controllers/WatchIt.WebAPI.Services.Controllers.Accounts/AccountsControllerService.cs +++ b/WatchIt.WebAPI/WatchIt.WebAPI.Services/WatchIt.WebAPI.Services.Controllers/WatchIt.WebAPI.Services.Controllers.Accounts/AccountsControllerService.cs @@ -8,6 +8,7 @@ using WatchIt.Common.Model.Accounts; using WatchIt.Common.Model.Media; using WatchIt.Common.Model.Movies; using WatchIt.Common.Model.Persons; +using WatchIt.Common.Model.Photos; using WatchIt.Common.Model.Series; using WatchIt.Database; using WatchIt.Database.Model.Account; @@ -32,6 +33,8 @@ public class AccountsControllerService( { #region PUBLIC METHODS + #region Basic + public async Task Register(RegisterRequest data) { string leftSalt = StringExtensions.CreateRandom(20); @@ -125,6 +128,10 @@ public class AccountsControllerService( return RequestResult.NoContent(); } + #endregion + + #region Profile picture + public async Task GetAccountProfilePicture(long id) { Account? account = await database.Accounts.FirstOrDefaultAsync(x => x.Id == id); @@ -185,6 +192,55 @@ public class AccountsControllerService( return RequestResult.NoContent(); } + #endregion + + #region Profile background + + public async Task GetAccountProfileBackground(long id) + { + Account? account = await database.Accounts.FirstOrDefaultAsync(x => x.Id == id); + if (account is null) + { + return RequestResult.BadRequest() + .AddValidationError("id", "Account with this id does not exists"); + } + + if (account.BackgroundPicture is null) + { + return RequestResult.NotFound(); + } + + PhotoResponse response = new PhotoResponse(account.BackgroundPicture); + return RequestResult.Ok(response); + } + + public async Task PutAccountProfileBackground(AccountProfileBackgroundRequest data) + { + Account account = await database.Accounts.FirstAsync(x => x.Id == userService.GetUserId()); + + account.BackgroundPictureId = data.Id; + + await database.SaveChangesAsync(); + + PhotoResponse returnData = new PhotoResponse(account.BackgroundPicture!); + return RequestResult.Ok(returnData); + } + + public async Task DeleteAccountProfileBackground() + { + Account account = await database.Accounts.FirstAsync(x => x.Id == userService.GetUserId()); + + if (account.BackgroundPicture is not null) + { + account.BackgroundPictureId = null; + await database.SaveChangesAsync(); + } + + return RequestResult.NoContent(); + } + + #endregion + public async Task GetAccountInfo(long id) { Account? account = await database.Accounts.FirstOrDefaultAsync(x => x.Id == id); diff --git a/WatchIt.WebAPI/WatchIt.WebAPI.Services/WatchIt.WebAPI.Services.Controllers/WatchIt.WebAPI.Services.Controllers.Accounts/IAccountsControllerService.cs b/WatchIt.WebAPI/WatchIt.WebAPI.Services/WatchIt.WebAPI.Services.Controllers/WatchIt.WebAPI.Services.Controllers.Accounts/IAccountsControllerService.cs index 4fb51a0..5213ab4 100644 --- a/WatchIt.WebAPI/WatchIt.WebAPI.Services/WatchIt.WebAPI.Services.Controllers/WatchIt.WebAPI.Services.Controllers.Accounts/IAccountsControllerService.cs +++ b/WatchIt.WebAPI/WatchIt.WebAPI.Services/WatchIt.WebAPI.Services.Controllers/WatchIt.WebAPI.Services.Controllers.Accounts/IAccountsControllerService.cs @@ -16,6 +16,9 @@ public interface IAccountsControllerService Task GetAccountProfilePicture(long id); Task PutAccountProfilePicture(AccountProfilePictureRequest data); Task DeleteAccountProfilePicture(); + Task GetAccountProfileBackground(long id); + Task PutAccountProfileBackground(AccountProfileBackgroundRequest data); + Task DeleteAccountProfileBackground(); Task GetAccountInfo(long id); Task PutAccountProfileInfo(AccountProfileInfoRequest data); Task GetAccountRatedMovies(long id, MovieRatedQueryParameters query); diff --git a/WatchIt.WebAPI/WatchIt.WebAPI.Validators/Accounts/AccountProfileBackgroundRequestValidator.cs b/WatchIt.WebAPI/WatchIt.WebAPI.Validators/Accounts/AccountProfileBackgroundRequestValidator.cs new file mode 100644 index 0000000..205be53 --- /dev/null +++ b/WatchIt.WebAPI/WatchIt.WebAPI.Validators/Accounts/AccountProfileBackgroundRequestValidator.cs @@ -0,0 +1,14 @@ +using FluentValidation; +using WatchIt.Common.Model.Accounts; +using WatchIt.Database; + +namespace WatchIt.WebAPI.Validators.Accounts; + +public class AccountProfileBackgroundRequestValidator : AbstractValidator +{ + public AccountProfileBackgroundRequestValidator(DatabaseContext database) + { + RuleFor(x => x.Id).MustBeIn(database.MediaPhotoImages.Where(x => x.MediaPhotoImageBackground != null), x => x.Id) + .WithMessage("Image has to be background"); + } +} \ No newline at end of file diff --git a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/Accounts/AccountsClientService.cs b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/Accounts/AccountsClientService.cs index 4438636..1dab7b6 100644 --- a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/Accounts/AccountsClientService.cs +++ b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/Accounts/AccountsClientService.cs @@ -1,6 +1,7 @@ using WatchIt.Common.Model.Accounts; using WatchIt.Common.Model.Movies; using WatchIt.Common.Model.Persons; +using WatchIt.Common.Model.Photos; using WatchIt.Common.Model.Series; using WatchIt.Common.Services.HttpClient; using WatchIt.Website.Services.Configuration; @@ -108,6 +109,46 @@ public class AccountsClientService(IHttpClientService httpClientService, IConfig .RegisterActionFor401Unauthorized(unauthorizedAction) .ExecuteAction(); } + + public async Task GetAccountProfileBackground(long id, Action? successAction = null, Action>? badRequestAction = null, Action? notFoundAction = null) + { + string url = GetUrl(EndpointsConfiguration.Accounts.GetAccountProfileBackground, id); + HttpRequest request = new HttpRequest(HttpMethodType.Get, url); + + HttpResponse response = await httpClientService.SendRequestAsync(request); + response.RegisterActionFor2XXSuccess(successAction) + .RegisterActionFor400BadRequest(badRequestAction) + .RegisterActionFor404NotFound(notFoundAction) + .ExecuteAction(); + } + + public async Task PutAccountProfileBackground(AccountProfileBackgroundRequest data, Action? successAction = null, Action>? badRequestAction = null, Action? unauthorizedAction = null) + { + string url = GetUrl(EndpointsConfiguration.Accounts.PutAccountProfileBackground); + + HttpRequest request = new HttpRequest(HttpMethodType.Put, url) + { + Body = data + }; + + HttpResponse response = await httpClientService.SendRequestAsync(request); + response.RegisterActionFor2XXSuccess(successAction) + .RegisterActionFor400BadRequest(badRequestAction) + .RegisterActionFor401Unauthorized(unauthorizedAction) + .ExecuteAction(); + } + + public async Task DeleteAccountProfileBackground(Action? successAction = null, Action? unauthorizedAction = null) + { + string url = GetUrl(EndpointsConfiguration.Accounts.DeleteAccountProfileBackground); + + HttpRequest request = new HttpRequest(HttpMethodType.Delete, url); + + HttpResponse response = await httpClientService.SendRequestAsync(request); + response.RegisterActionFor2XXSuccess(successAction) + .RegisterActionFor401Unauthorized(unauthorizedAction) + .ExecuteAction(); + } public async Task GetAccountInfo(long id, Action? successAction = null, Action? notFoundAction = null) { diff --git a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/Accounts/IAccountsClientService.cs b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/Accounts/IAccountsClientService.cs index bb45c37..48110fe 100644 --- a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/Accounts/IAccountsClientService.cs +++ b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/Accounts/IAccountsClientService.cs @@ -1,6 +1,7 @@ using WatchIt.Common.Model.Accounts; using WatchIt.Common.Model.Movies; using WatchIt.Common.Model.Persons; +using WatchIt.Common.Model.Photos; using WatchIt.Common.Model.Series; namespace WatchIt.Website.Services.Client.Accounts; @@ -14,6 +15,9 @@ public interface IAccountsClientService Task GetAccountProfilePicture(long id, Action? successAction = null, Action>? badRequestAction = null, Action? notFoundAction = null); Task PutAccountProfilePicture(AccountProfilePictureRequest data, Action? successAction = null, Action>? badRequestAction = null, Action? unauthorizedAction = null); Task DeleteAccountProfilePicture(Action? successAction = null, Action? unauthorizedAction = null); + Task GetAccountProfileBackground(long id, Action? successAction = null, Action>? badRequestAction = null, Action? notFoundAction = null); + Task PutAccountProfileBackground(AccountProfileBackgroundRequest data, Action? successAction = null, Action>? badRequestAction = null, Action? unauthorizedAction = null); + Task DeleteAccountProfileBackground(Action? successAction = null, Action? unauthorizedAction = null); Task GetAccountInfo(long id, Action? successAction = null, Action? notFoundAction = null); Task PutAccountProfileInfo(AccountProfileInfoRequest data, Action? successAction = null, Action>? badRequestAction = null, Action? unauthorizedAction = null); Task GetAccountRatedMovies(long id, MovieRatedQueryParameters query, Action>? successAction = null, Action? notFoundAction = null); diff --git a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Configuration/Model/Accounts.cs b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Configuration/Model/Accounts.cs index 02ac602..f035f6d 100644 --- a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Configuration/Model/Accounts.cs +++ b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Configuration/Model/Accounts.cs @@ -10,6 +10,9 @@ public class Accounts public string GetAccountProfilePicture { get; set; } public string PutAccountProfilePicture { get; set; } public string DeleteAccountProfilePicture { get; set; } + public string GetAccountProfileBackground { get; set; } + public string PutAccountProfileBackground { get; set; } + public string DeleteAccountProfileBackground { get; set; } public string GetAccountInfo { get; set; } public string PutAccountProfileInfo { get; set; } public string GetAccountRatedMovies { get; set; } diff --git a/WatchIt.Website/WatchIt.Website/App.razor b/WatchIt.Website/WatchIt.Website/App.razor index 66ac768..f460abd 100644 --- a/WatchIt.Website/WatchIt.Website/App.razor +++ b/WatchIt.Website/WatchIt.Website/App.razor @@ -13,7 +13,7 @@ - + diff --git a/WatchIt.Website/WatchIt.Website/Components/Pages/UserEditPage/Panels/ProfileBackgroundEditorPanelComponent.razor b/WatchIt.Website/WatchIt.Website/Components/Pages/UserEditPage/Panels/ProfileBackgroundEditorPanelComponent.razor index 8d8a88c..0a2e598 100644 --- a/WatchIt.Website/WatchIt.Website/Components/Pages/UserEditPage/Panels/ProfileBackgroundEditorPanelComponent.razor +++ b/WatchIt.Website/WatchIt.Website/Components/Pages/UserEditPage/Panels/ProfileBackgroundEditorPanelComponent.razor @@ -1,5 +1,121 @@ +@using Blazorise.Components +@using WatchIt.Common.Model.Photos + + +
-
-

Profile background

-
+ @if (_loaded) + { +
+
+

Profile background

+ @if (_editMode) + { + + } + else + { + + + } +
+ @if (_editMode) + { +
+
+
+
+ + Sorry... @not_found_context was not found + +
+
+ +
+
+
+ @if (_mediaPhotos is null) + { + Select media first + } + else if (!_mediaPhotos.Any()) + { + No backgrounds for this media + } + else + { +
+ @foreach (PhotoResponse photo in _mediaPhotos) + { +
+
+
+
+ +
+
+
+
+
+
+
+ +
+
+
+
+ } +
+ } +
+ } + else + { + if (_selectedPhoto is not null) + { + + } + else + { + You don't have selected background. Click "Edit" to choose one. + } + } +
+ } + else + { + + }
\ No newline at end of file diff --git a/WatchIt.Website/WatchIt.Website/Components/Pages/UserEditPage/Panels/ProfileBackgroundEditorPanelComponent.razor.cs b/WatchIt.Website/WatchIt.Website/Components/Pages/UserEditPage/Panels/ProfileBackgroundEditorPanelComponent.razor.cs index 904e6a4..594ba75 100644 --- a/WatchIt.Website/WatchIt.Website/Components/Pages/UserEditPage/Panels/ProfileBackgroundEditorPanelComponent.razor.cs +++ b/WatchIt.Website/WatchIt.Website/Components/Pages/UserEditPage/Panels/ProfileBackgroundEditorPanelComponent.razor.cs @@ -1,7 +1,128 @@ using Microsoft.AspNetCore.Components; +using WatchIt.Common.Model.Accounts; +using WatchIt.Common.Model.Media; +using WatchIt.Common.Model.Photos; +using WatchIt.Website.Services.Authentication; +using WatchIt.Website.Services.Client.Accounts; +using WatchIt.Website.Services.Client.Media; namespace WatchIt.Website.Components.Pages.UserEditPage.Panels; public partial class ProfileBackgroundEditorPanelComponent : ComponentBase { + #region SERVICES + + [Inject] private IMediaClientService MediaClientService { get; set; } = default!; + [Inject] private IAccountsClientService AccountsClientService { get; set; } = default!; + + #endregion + + + + #region PARAMETERS + + [Parameter] public required long Id { get; set; } + [Parameter] public Action? OnBackgroundChanged { get; set; } + + #endregion + + + + #region FIELDS + + private bool _loaded; + + private bool _editMode; + private long? _selectedMedia; + private IEnumerable? _mediaPhotos; + private bool _backgroundsLoading; + private bool _saveLoading; + + private bool _removeLoading; + + private IEnumerable _mediaList = default!; + + private PhotoResponse? _selectedPhoto; + private MediaResponse? _selectedPhotoMedia; + + #endregion + + + + #region PRIVATE METHODS + + protected override async Task OnAfterRenderAsync(bool firstRender) + { + if (firstRender) + { + await Task.WhenAll( + [ + MediaClientService.GetAllMedia(successAction: data => _mediaList = data), + AccountsClientService.GetAccountProfileBackground(Id, data => _selectedPhoto = data) + ]); + + if (_selectedPhoto is not null) + { + _selectedPhotoMedia = _mediaList.First(x => x.Id == _selectedPhoto.MediaId); + } + + _loaded = true; + StateHasChanged(); + } + } + + private async Task Save(Guid id) + { + _saveLoading = true; + await AccountsClientService.PutAccountProfileBackground(new AccountProfileBackgroundRequest(id), data => + { + OnBackgroundChanged?.Invoke(data); + _selectedPhoto = data; + _selectedPhotoMedia = _mediaList.First(x => x.Id == _selectedMedia!.Value); + _saveLoading = false; + Cancel(); + }); + } + + private void Cancel() + { + _editMode = false; + _selectedMedia = default; + _saveLoading = false; + _backgroundsLoading = false; + _mediaPhotos = default; + } + + private void Edit() + { + _editMode = true; + } + + private async Task Remove() + { + _removeLoading = true; + await AccountsClientService.DeleteAccountProfileBackground(() => + { + OnBackgroundChanged?.Invoke(null); + _selectedPhoto = null; + _selectedPhotoMedia = null; + _removeLoading = false; + }); + } + + private async Task LoadBackgrounds() + { + _backgroundsLoading = true; + PhotoQueryParameters query = new PhotoQueryParameters + { + IsBackground = true + }; + await MediaClientService.GetMediaPhotos(_selectedMedia!.Value, query, successAction: data => + { + _mediaPhotos = data; + _backgroundsLoading = false; + }); + } + + #endregion } \ No newline at end of file diff --git a/WatchIt.Website/WatchIt.Website/Components/Pages/UserEditPage/Panels/ProfileBackgroundEditorPanelComponent.razor.css b/WatchIt.Website/WatchIt.Website/Components/Pages/UserEditPage/Panels/ProfileBackgroundEditorPanelComponent.razor.css new file mode 100644 index 0000000..910ae4d --- /dev/null +++ b/WatchIt.Website/WatchIt.Website/Components/Pages/UserEditPage/Panels/ProfileBackgroundEditorPanelComponent.razor.css @@ -0,0 +1,23 @@ +/* IDS */ + +#scrollPhotos { + overflow-x: scroll; + + border-color: grey; + border-width: 1px; + border-style: solid; + border-radius: 10px; +} + +#backgroundIndicator { + height: 30px; + width: 30px; +} + + + +/* CLASSES */ + +.photo-container { + width: 350px; +} \ No newline at end of file diff --git a/WatchIt.Website/WatchIt.Website/Pages/UserEditPage.razor b/WatchIt.Website/WatchIt.Website/Pages/UserEditPage.razor index 8031ff4..ae3c2c8 100644 --- a/WatchIt.Website/WatchIt.Website/Pages/UserEditPage.razor +++ b/WatchIt.Website/WatchIt.Website/Pages/UserEditPage.razor @@ -1,7 +1,9 @@ @using System.Text @using WatchIt.Common.Model +@using WatchIt.Common.Model.Photos @using WatchIt.Website.Components.Pages.UserEditPage.Panels + @page "/user/edit" @{ @@ -60,7 +62,8 @@
- +
diff --git a/WatchIt.Website/WatchIt.Website/Pages/UserEditPage.razor.cs b/WatchIt.Website/WatchIt.Website/Pages/UserEditPage.razor.cs index b3ada08..8e4c5ea 100644 --- a/WatchIt.Website/WatchIt.Website/Pages/UserEditPage.razor.cs +++ b/WatchIt.Website/WatchIt.Website/Pages/UserEditPage.razor.cs @@ -1,6 +1,7 @@ using System.Net; using Microsoft.AspNetCore.Components; using WatchIt.Common.Model; +using WatchIt.Common.Model.Photos; using WatchIt.Website.Components.Pages.UserEditPage.Panels; using WatchIt.Website.Layout; using WatchIt.Website.Services.Authentication; @@ -50,11 +51,12 @@ public partial class UserEditPage : ComponentBase if (_user is null) { NavigationManager.NavigateTo($"/auth?redirect_to={WebUtility.UrlEncode("/user/edit")}"); + return; } - else - { - StateHasChanged(); - } + StateHasChanged(); + + await AccountsClientService.GetAccountProfileBackground(_user.Id, data => Layout.BackgroundPhoto = data); + StateHasChanged(); } } @@ -63,6 +65,11 @@ public partial class UserEditPage : ComponentBase _header.ReloadPicture(), Layout.ReloadProfilePicture() ]); + + private void BackgroundChanged(PhotoResponse? background) + { + Layout.BackgroundPhoto = background; + } #endregion } \ No newline at end of file diff --git a/WatchIt.Website/WatchIt.Website/Pages/UserPage.razor b/WatchIt.Website/WatchIt.Website/Pages/UserPage.razor index ff65c65..722e501 100644 --- a/WatchIt.Website/WatchIt.Website/Pages/UserPage.razor +++ b/WatchIt.Website/WatchIt.Website/Pages/UserPage.razor @@ -69,7 +69,7 @@ step1Tasks = new List(); List endTasks = new List(); // INIT Layout.BackgroundPhoto = null; // STEP 0 - endTasks.AddRange( + step1Tasks.AddRange( [ GetUserData() ]); + // STEP 1 + await Task.WhenAll(step1Tasks); + endTasks.AddRange( + [ + AccountsClientService.GetAccountProfileBackground(_accountData.Id, data => Layout.BackgroundPhoto = data) + ]); + // END await Task.WhenAll(endTasks); diff --git a/WatchIt.Website/WatchIt.Website/appsettings.json b/WatchIt.Website/WatchIt.Website/appsettings.json index 2d4a0f1..b6820ca 100644 --- a/WatchIt.Website/WatchIt.Website/appsettings.json +++ b/WatchIt.Website/WatchIt.Website/appsettings.json @@ -24,6 +24,9 @@ "GetAccountProfilePicture": "/{0}/profile_picture", "PutAccountProfilePicture": "/profile_picture", "DeleteAccountProfilePicture": "/profile_picture", + "GetAccountProfileBackground": "/{0}/profile_background", + "PutAccountProfileBackground": "/profile_background", + "DeleteAccountProfileBackground": "/profile_background", "GetAccountInfo": "/{0}/info", "PutAccountProfileInfo": "/profile_info", "GetAccountRatedMovies": "/{0}/movies", From 4cbc44f9be1de6f675ee745832165e40f75cbf0c Mon Sep 17 00:00:00 2001 From: Mateusz Skoczek Date: Wed, 6 Nov 2024 00:11:45 +0100 Subject: [PATCH 16/20] username change panel added --- .../AccountProfileBackgroundRequest.cs | 2 + .../Accounts/AccountUsernameRequest.cs | 27 ++++++ .../AccountsController.cs | 11 +++ .../AccountsControllerService.cs | 21 +++- .../IAccountsControllerService.cs | 1 + .../AccountUsernameRequestValidator.cs | 16 ++++ .../Accounts/AccountsClientService.cs | 15 +++ .../Accounts/IAccountsClientService.cs | 1 + .../Model/Accounts.cs | 1 + .../AccountEditHeaderPanelComponent.razor | 5 + .../Panels/NewUsernamePanelComponent.razor | 46 +++++++++ .../Panels/NewUsernamePanelComponent.razor.cs | 95 +++++++++++++++++++ ...rofileBackgroundEditorPanelComponent.razor | 2 +- .../ProfileEditFormPanelComponent.razor | 6 +- .../ProfileEditHeaderPanelComponent.razor.css | 0 .../UserEditPageHeaderPanelComponent.razor | 4 +- .../UserEditPageHeaderPanelComponent.razor.cs | 21 ++++ .../WatchIt.Website/Layout/MainLayout.razor | 2 +- .../Layout/MainLayout.razor.cs | 15 +-- .../WatchIt.Website/Pages/UserEditPage.razor | 55 +++++------ .../WatchIt.Website/appsettings.json | 1 + 21 files changed, 305 insertions(+), 42 deletions(-) create mode 100644 WatchIt.Common/WatchIt.Common.Model/Accounts/AccountUsernameRequest.cs create mode 100644 WatchIt.WebAPI/WatchIt.WebAPI.Validators/Accounts/AccountUsernameRequestValidator.cs create mode 100644 WatchIt.Website/WatchIt.Website/Components/Pages/UserEditPage/Panels/AccountEditHeaderPanelComponent.razor create mode 100644 WatchIt.Website/WatchIt.Website/Components/Pages/UserEditPage/Panels/NewUsernamePanelComponent.razor create mode 100644 WatchIt.Website/WatchIt.Website/Components/Pages/UserEditPage/Panels/NewUsernamePanelComponent.razor.cs delete mode 100644 WatchIt.Website/WatchIt.Website/Components/Pages/UserEditPage/Panels/ProfileEditHeaderPanelComponent.razor.css diff --git a/WatchIt.Common/WatchIt.Common.Model/Accounts/AccountProfileBackgroundRequest.cs b/WatchIt.Common/WatchIt.Common.Model/Accounts/AccountProfileBackgroundRequest.cs index 4bcb781..6f8ce7b 100644 --- a/WatchIt.Common/WatchIt.Common.Model/Accounts/AccountProfileBackgroundRequest.cs +++ b/WatchIt.Common/WatchIt.Common.Model/Accounts/AccountProfileBackgroundRequest.cs @@ -1,4 +1,5 @@ using System.Diagnostics.CodeAnalysis; +using System.Text.Json.Serialization; namespace WatchIt.Common.Model.Accounts; @@ -6,6 +7,7 @@ public class AccountProfileBackgroundRequest { #region PROPERTIES + [JsonPropertyName("id")] public required Guid Id { get; set; } #endregion diff --git a/WatchIt.Common/WatchIt.Common.Model/Accounts/AccountUsernameRequest.cs b/WatchIt.Common/WatchIt.Common.Model/Accounts/AccountUsernameRequest.cs new file mode 100644 index 0000000..5219594 --- /dev/null +++ b/WatchIt.Common/WatchIt.Common.Model/Accounts/AccountUsernameRequest.cs @@ -0,0 +1,27 @@ +using System.Text.Json.Serialization; + +namespace WatchIt.Common.Model.Accounts; + +public class AccountUsernameRequest +{ + #region PROPERTIES + + [JsonPropertyName("new_username")] + public string NewUsername { get; set; } + + [JsonPropertyName("password")] + public string Password { get; set; } + + #endregion + + + + #region PUBLIC METHODS + + public void UpdateAccount(Database.Model.Account.Account account) + { + account.Username = NewUsername; + } + + #endregion +} \ No newline at end of file diff --git a/WatchIt.WebAPI/WatchIt.WebAPI.Controllers/AccountsController.cs b/WatchIt.WebAPI/WatchIt.WebAPI.Controllers/AccountsController.cs index 714d4e4..1b93fe9 100644 --- a/WatchIt.WebAPI/WatchIt.WebAPI.Controllers/AccountsController.cs +++ b/WatchIt.WebAPI/WatchIt.WebAPI.Controllers/AccountsController.cs @@ -92,6 +92,8 @@ public class AccountsController(IAccountsControllerService accountsControllerSer #endregion + #region Info + [HttpGet("{id}/info")] [AllowAnonymous] [ProducesResponseType(typeof(AccountResponse), StatusCodes.Status200OK)] @@ -105,6 +107,15 @@ public class AccountsController(IAccountsControllerService accountsControllerSer [ProducesResponseType(StatusCodes.Status404NotFound)] public async Task PutAccountProfileInfo([FromBody]AccountProfileInfoRequest data) => await accountsControllerService.PutAccountProfileInfo(data); + [HttpPatch("username")] + [Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme)] + [ProducesResponseType(StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status400BadRequest)] + [ProducesResponseType(StatusCodes.Status401Unauthorized)] + public async Task PatchAccountUsername([FromBody]AccountUsernameRequest data) => await accountsControllerService.PatchAccountUsername(data); + + #endregion + [HttpGet("{id}/movies")] [AllowAnonymous] [ProducesResponseType(typeof(IEnumerable), StatusCodes.Status200OK)] diff --git a/WatchIt.WebAPI/WatchIt.WebAPI.Services/WatchIt.WebAPI.Services.Controllers/WatchIt.WebAPI.Services.Controllers.Accounts/AccountsControllerService.cs b/WatchIt.WebAPI/WatchIt.WebAPI.Services/WatchIt.WebAPI.Services.Controllers/WatchIt.WebAPI.Services.Controllers.Accounts/AccountsControllerService.cs index e4a6879..67d41c1 100644 --- a/WatchIt.WebAPI/WatchIt.WebAPI.Services/WatchIt.WebAPI.Services.Controllers/WatchIt.WebAPI.Services.Controllers.Accounts/AccountsControllerService.cs +++ b/WatchIt.WebAPI/WatchIt.WebAPI.Services/WatchIt.WebAPI.Services.Controllers/WatchIt.WebAPI.Services.Controllers.Accounts/AccountsControllerService.cs @@ -240,7 +240,9 @@ public class AccountsControllerService( } #endregion - + + #region Info + public async Task GetAccountInfo(long id) { Account? account = await database.Accounts.FirstOrDefaultAsync(x => x.Id == id); @@ -266,6 +268,23 @@ public class AccountsControllerService( return RequestResult.Ok(); } + + public async Task PatchAccountUsername(AccountUsernameRequest data) + { + Account account = await database.Accounts.FirstAsync(x => x.Id == userService.GetUserId()); + + if (!ComputeHash(data.Password, account.LeftSalt, account.RightSalt).SequenceEqual(account.Password)) + { + return RequestResult.Unauthorized(); + } + + data.UpdateAccount(account); + await database.SaveChangesAsync(); + + return RequestResult.Ok(); + } + + #endregion public async Task GetAccountRatedMovies(long id, MovieRatedQueryParameters query) { diff --git a/WatchIt.WebAPI/WatchIt.WebAPI.Services/WatchIt.WebAPI.Services.Controllers/WatchIt.WebAPI.Services.Controllers.Accounts/IAccountsControllerService.cs b/WatchIt.WebAPI/WatchIt.WebAPI.Services/WatchIt.WebAPI.Services.Controllers/WatchIt.WebAPI.Services.Controllers.Accounts/IAccountsControllerService.cs index 5213ab4..481603e 100644 --- a/WatchIt.WebAPI/WatchIt.WebAPI.Services/WatchIt.WebAPI.Services.Controllers/WatchIt.WebAPI.Services.Controllers.Accounts/IAccountsControllerService.cs +++ b/WatchIt.WebAPI/WatchIt.WebAPI.Services/WatchIt.WebAPI.Services.Controllers/WatchIt.WebAPI.Services.Controllers.Accounts/IAccountsControllerService.cs @@ -21,6 +21,7 @@ public interface IAccountsControllerService Task DeleteAccountProfileBackground(); Task GetAccountInfo(long id); Task PutAccountProfileInfo(AccountProfileInfoRequest data); + Task PatchAccountUsername(AccountUsernameRequest data); Task GetAccountRatedMovies(long id, MovieRatedQueryParameters query); Task GetAccountRatedSeries(long id, SeriesRatedQueryParameters query); Task GetAccountRatedPersons(long id, PersonRatedQueryParameters query); diff --git a/WatchIt.WebAPI/WatchIt.WebAPI.Validators/Accounts/AccountUsernameRequestValidator.cs b/WatchIt.WebAPI/WatchIt.WebAPI.Validators/Accounts/AccountUsernameRequestValidator.cs new file mode 100644 index 0000000..6c0ad30 --- /dev/null +++ b/WatchIt.WebAPI/WatchIt.WebAPI.Validators/Accounts/AccountUsernameRequestValidator.cs @@ -0,0 +1,16 @@ +using FluentValidation; +using WatchIt.Common.Model.Accounts; +using WatchIt.Database; + +namespace WatchIt.WebAPI.Validators.Accounts; + +public class AccountUsernameRequestValidator : AbstractValidator +{ + public AccountUsernameRequestValidator(DatabaseContext database) + { + RuleFor(x => x.NewUsername).MinimumLength(5) + .MaximumLength(50) + .CannotBeIn(database.Accounts, x => x.Username) + .WithMessage("Username is already used"); + } +} \ No newline at end of file diff --git a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/Accounts/AccountsClientService.cs b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/Accounts/AccountsClientService.cs index 1dab7b6..d73728e 100644 --- a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/Accounts/AccountsClientService.cs +++ b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/Accounts/AccountsClientService.cs @@ -176,6 +176,21 @@ public class AccountsClientService(IHttpClientService httpClientService, IConfig .ExecuteAction(); } + public async Task PatchAccountUsername(AccountUsernameRequest data, Action? successAction = null, Action>? badRequestAction = null, Action? unauthorizedAction = null) + { + string url = GetUrl(EndpointsConfiguration.Accounts.PatchAccountUsername); + HttpRequest request = new HttpRequest(HttpMethodType.Patch, url) + { + Body = data, + }; + + HttpResponse response = await httpClientService.SendRequestAsync(request); + response.RegisterActionFor2XXSuccess(successAction) + .RegisterActionFor400BadRequest(badRequestAction) + .RegisterActionFor401Unauthorized(unauthorizedAction) + .ExecuteAction(); + } + public async Task GetAccountRatedMovies(long id, MovieRatedQueryParameters query, Action>? successAction = null, Action? notFoundAction = null) { string url = GetUrl(EndpointsConfiguration.Accounts.GetAccountRatedMovies, id); diff --git a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/Accounts/IAccountsClientService.cs b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/Accounts/IAccountsClientService.cs index 48110fe..4a86d8f 100644 --- a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/Accounts/IAccountsClientService.cs +++ b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/Accounts/IAccountsClientService.cs @@ -20,6 +20,7 @@ public interface IAccountsClientService Task DeleteAccountProfileBackground(Action? successAction = null, Action? unauthorizedAction = null); Task GetAccountInfo(long id, Action? successAction = null, Action? notFoundAction = null); Task PutAccountProfileInfo(AccountProfileInfoRequest data, Action? successAction = null, Action>? badRequestAction = null, Action? unauthorizedAction = null); + Task PatchAccountUsername(AccountUsernameRequest data, Action? successAction = null, Action>? badRequestAction = null, Action? unauthorizedAction = null); Task GetAccountRatedMovies(long id, MovieRatedQueryParameters query, Action>? successAction = null, Action? notFoundAction = null); Task GetAccountRatedSeries(long id, SeriesRatedQueryParameters query, Action>? successAction = null, Action? notFoundAction = null); Task GetAccountRatedPersons(long id, PersonRatedQueryParameters query, Action>? successAction = null, Action? notFoundAction = null); diff --git a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Configuration/Model/Accounts.cs b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Configuration/Model/Accounts.cs index f035f6d..04e8c7f 100644 --- a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Configuration/Model/Accounts.cs +++ b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Configuration/Model/Accounts.cs @@ -15,6 +15,7 @@ public class Accounts public string DeleteAccountProfileBackground { get; set; } public string GetAccountInfo { get; set; } public string PutAccountProfileInfo { get; set; } + public string PatchAccountUsername { get; set; } public string GetAccountRatedMovies { get; set; } public string GetAccountRatedSeries { get; set; } public string GetAccountRatedPersons { get; set; } diff --git a/WatchIt.Website/WatchIt.Website/Components/Pages/UserEditPage/Panels/AccountEditHeaderPanelComponent.razor b/WatchIt.Website/WatchIt.Website/Components/Pages/UserEditPage/Panels/AccountEditHeaderPanelComponent.razor new file mode 100644 index 0000000..a051670 --- /dev/null +++ b/WatchIt.Website/WatchIt.Website/Components/Pages/UserEditPage/Panels/AccountEditHeaderPanelComponent.razor @@ -0,0 +1,5 @@ +
+
+

Account settings

+
+
\ No newline at end of file diff --git a/WatchIt.Website/WatchIt.Website/Components/Pages/UserEditPage/Panels/NewUsernamePanelComponent.razor b/WatchIt.Website/WatchIt.Website/Components/Pages/UserEditPage/Panels/NewUsernamePanelComponent.razor new file mode 100644 index 0000000..62a6a9b --- /dev/null +++ b/WatchIt.Website/WatchIt.Website/Components/Pages/UserEditPage/Panels/NewUsernamePanelComponent.razor @@ -0,0 +1,46 @@ +
+
+

Change username

+ @if (_data is not null) + { + + +
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+ @if (!string.IsNullOrWhiteSpace(_error)) + { + @(_error) + } + else if (_saved) + { + New username saved! + } +
+
+ +
+
+
+
+ } + else + { + + } +
+
\ No newline at end of file diff --git a/WatchIt.Website/WatchIt.Website/Components/Pages/UserEditPage/Panels/NewUsernamePanelComponent.razor.cs b/WatchIt.Website/WatchIt.Website/Components/Pages/UserEditPage/Panels/NewUsernamePanelComponent.razor.cs new file mode 100644 index 0000000..0a797fd --- /dev/null +++ b/WatchIt.Website/WatchIt.Website/Components/Pages/UserEditPage/Panels/NewUsernamePanelComponent.razor.cs @@ -0,0 +1,95 @@ +using Microsoft.AspNetCore.Components; +using WatchIt.Common.Model.Accounts; +using WatchIt.Website.Services.Authentication; +using WatchIt.Website.Services.Client.Accounts; + +namespace WatchIt.Website.Components.Pages.UserEditPage.Panels; + +public partial class NewUsernamePanelComponent : ComponentBase +{ + #region SERVICES + + [Inject] private IAuthenticationService AuthenticationService { get; set; } = default!; + [Inject] private IAccountsClientService AccountsClientService { get; set; } = default!; + [Inject] private NavigationManager NavigationManager { get; set; } = default!; + + #endregion + + + + #region PARAMETERS + + [Parameter] public required long Id { get; set; } + + #endregion + + + + #region FIELDS + + private AccountUsernameRequest? _data; + private string? _error; + private bool _saving; + private bool _saved; + + #endregion + + + + #region PRIVATE METHODS + + protected override async Task OnAfterRenderAsync(bool firstRender) + { + if (firstRender) + { + User? user = await AuthenticationService.GetUserAsync(); + + if (user is null) + { + return; + } + + await AccountsClientService.GetAccountInfo(user.Id, data => + { + _data = new AccountUsernameRequest + { + NewUsername = data.Username + }; + StateHasChanged(); + }); + } + } + + private async Task Save() + { + void Success() + { + _saved = true; + _saving = false; + _data = new AccountUsernameRequest + { + NewUsername = _data!.NewUsername + }; + NavigationManager.Refresh(true); + } + + void BadRequest(IDictionary errors) + { + _error = errors.SelectMany(x => x.Value).FirstOrDefault() ?? "Unknown error"; + _saving = false; + } + + void Unauthorized() + { + _error = "Incorrect password"; + _saving = false; + } + + _saving = true; + _saved = false; + _error = null; + await AccountsClientService.PatchAccountUsername(_data!, Success, BadRequest, Unauthorized); + } + + #endregion +} \ No newline at end of file diff --git a/WatchIt.Website/WatchIt.Website/Components/Pages/UserEditPage/Panels/ProfileBackgroundEditorPanelComponent.razor b/WatchIt.Website/WatchIt.Website/Components/Pages/UserEditPage/Panels/ProfileBackgroundEditorPanelComponent.razor index 0a2e598..6281e1a 100644 --- a/WatchIt.Website/WatchIt.Website/Components/Pages/UserEditPage/Panels/ProfileBackgroundEditorPanelComponent.razor +++ b/WatchIt.Website/WatchIt.Website/Components/Pages/UserEditPage/Panels/ProfileBackgroundEditorPanelComponent.razor @@ -90,7 +90,7 @@
- +
diff --git a/WatchIt.Website/WatchIt.Website/Components/Pages/UserEditPage/Panels/ProfileEditFormPanelComponent.razor b/WatchIt.Website/WatchIt.Website/Components/Pages/UserEditPage/Panels/ProfileEditFormPanelComponent.razor index 438fa9c..8f9869a 100644 --- a/WatchIt.Website/WatchIt.Website/Components/Pages/UserEditPage/Panels/ProfileEditFormPanelComponent.razor +++ b/WatchIt.Website/WatchIt.Website/Components/Pages/UserEditPage/Panels/ProfileEditFormPanelComponent.razor @@ -39,12 +39,12 @@
diff --git a/WatchIt.Website/WatchIt.Website/Components/Pages/UserEditPage/Panels/ProfileEditHeaderPanelComponent.razor.css b/WatchIt.Website/WatchIt.Website/Components/Pages/UserEditPage/Panels/ProfileEditHeaderPanelComponent.razor.css deleted file mode 100644 index e69de29..0000000 diff --git a/WatchIt.Website/WatchIt.Website/Components/Pages/UserEditPage/Panels/UserEditPageHeaderPanelComponent.razor b/WatchIt.Website/WatchIt.Website/Components/Pages/UserEditPage/Panels/UserEditPageHeaderPanelComponent.razor index 2b2c701..2fd8305 100644 --- a/WatchIt.Website/WatchIt.Website/Components/Pages/UserEditPage/Panels/UserEditPageHeaderPanelComponent.razor +++ b/WatchIt.Website/WatchIt.Website/Components/Pages/UserEditPage/Panels/UserEditPageHeaderPanelComponent.razor @@ -1,8 +1,8 @@
- +
-

@(User.Username)

+

@(_username ?? "Loading...")

User settings
diff --git a/WatchIt.Website/WatchIt.Website/Components/Pages/UserEditPage/Panels/UserEditPageHeaderPanelComponent.razor.cs b/WatchIt.Website/WatchIt.Website/Components/Pages/UserEditPage/Panels/UserEditPageHeaderPanelComponent.razor.cs index 9b44909..83f7d8e 100644 --- a/WatchIt.Website/WatchIt.Website/Components/Pages/UserEditPage/Panels/UserEditPageHeaderPanelComponent.razor.cs +++ b/WatchIt.Website/WatchIt.Website/Components/Pages/UserEditPage/Panels/UserEditPageHeaderPanelComponent.razor.cs @@ -1,6 +1,7 @@ using Microsoft.AspNetCore.Components; using WatchIt.Website.Components.Common.Subcomponents; using WatchIt.Website.Services.Authentication; +using WatchIt.Website.Services.Client.Accounts; namespace WatchIt.Website.Components.Pages.UserEditPage.Panels; @@ -8,6 +9,7 @@ public partial class UserEditPageHeaderPanelComponent : ComponentBase { #region SERVICES + [Inject] public IAccountsClientService AccountsClientService { get; set; } = default!; [Inject] public NavigationManager NavigationManager { get; set; } = default!; #endregion @@ -25,6 +27,7 @@ public partial class UserEditPageHeaderPanelComponent : ComponentBase #region FIELDS private AccountPictureComponent _accountPicture = default!; + private string? _username; #endregion @@ -35,4 +38,22 @@ public partial class UserEditPageHeaderPanelComponent : ComponentBase public async Task ReloadPicture() => await _accountPicture.Reload(); #endregion + + + + #region PRIVATE METHODS + + protected override async Task OnAfterRenderAsync(bool firstRender) + { + if (firstRender) + { + await AccountsClientService.GetAccountInfo(User.Id, data => + { + _username = data.Username; + StateHasChanged(); + }); + } + } + + #endregion } \ No newline at end of file diff --git a/WatchIt.Website/WatchIt.Website/Layout/MainLayout.razor b/WatchIt.Website/WatchIt.Website/Layout/MainLayout.razor index 3b64a23..736e311 100644 --- a/WatchIt.Website/WatchIt.Website/Layout/MainLayout.razor +++ b/WatchIt.Website/WatchIt.Website/Layout/MainLayout.razor @@ -56,7 +56,7 @@ diff --git a/WatchIt.Website/WatchIt.Website/Layout/MainLayout.razor.cs b/WatchIt.Website/WatchIt.Website/Layout/MainLayout.razor.cs index a73056b..00657c8 100644 --- a/WatchIt.Website/WatchIt.Website/Layout/MainLayout.razor.cs +++ b/WatchIt.Website/WatchIt.Website/Layout/MainLayout.razor.cs @@ -21,6 +21,7 @@ public partial class MainLayout : LayoutComponentBase [Inject] public IAuthenticationService AuthenticationService { get; set; } = default!; [Inject] public IMediaClientService MediaClientService { get; set; } = default!; [Inject] public IPhotosClientService PhotosClientService { get; set; } = default!; + [Inject] public IAccountsClientService AccountsClientService { get; set; } = default!; #endregion @@ -33,6 +34,7 @@ public partial class MainLayout : LayoutComponentBase private bool _loaded; private User? _user; + private AccountResponse? _accountData; private PhotoResponse? _defaultBackgroundPhoto; private bool _searchbarVisible; @@ -81,17 +83,16 @@ public partial class MainLayout : LayoutComponentBase { if (firstRender) { - List endTasks = new List(); - - // STEP 0 - endTasks.AddRange( + await Task.WhenAll( [ Task.Run(async () => _user = await AuthenticationService.GetUserAsync()), PhotosClientService.GetPhotoRandomBackground(data => _defaultBackgroundPhoto = data) ]); - - // END - await Task.WhenAll(endTasks); + + if (_user is not null) + { + await AccountsClientService.GetAccountInfo(_user.Id, data => _accountData = data); + } _loaded = true; StateHasChanged(); diff --git a/WatchIt.Website/WatchIt.Website/Pages/UserEditPage.razor b/WatchIt.Website/WatchIt.Website/Pages/UserEditPage.razor index ae3c2c8..77dadc7 100644 --- a/WatchIt.Website/WatchIt.Website/Pages/UserEditPage.razor +++ b/WatchIt.Website/WatchIt.Website/Pages/UserEditPage.razor @@ -37,40 +37,41 @@ -
-
-
-
- -
+
+
+
+
-
-
- -
-
- -
+
+
+
+
-
-
- -
+
+ +
+
+
+
+
- +
+ + +
diff --git a/WatchIt.Website/WatchIt.Website/appsettings.json b/WatchIt.Website/WatchIt.Website/appsettings.json index b6820ca..a4eb5eb 100644 --- a/WatchIt.Website/WatchIt.Website/appsettings.json +++ b/WatchIt.Website/WatchIt.Website/appsettings.json @@ -29,6 +29,7 @@ "DeleteAccountProfileBackground": "/profile_background", "GetAccountInfo": "/{0}/info", "PutAccountProfileInfo": "/profile_info", + "PatchAccountUsername": "/username", "GetAccountRatedMovies": "/{0}/movies", "GetAccountRatedSeries": "/{0}/series", "GetAccountRatedPersons": "/{0}/persons" From 2a0d130914c0888acfb3ca8bb58e706a98accd5d Mon Sep 17 00:00:00 2001 From: Mateusz Skoczek Date: Wed, 6 Nov 2024 14:56:02 +0100 Subject: [PATCH 17/20] email and password change panels added --- .../Accounts/AccountEmailRequest.cs | 27 ++++++ .../Accounts/AccountPasswordRequest.cs | 19 +++++ .../WatchIt.Database.Model/Account/Account.cs | 6 +- .../AccountsController.cs | 14 ++++ .../AccountsControllerService.cs | 50 +++++++++-- .../IAccountsControllerService.cs | 2 + .../Accounts/AccountEmailRequestValidator.cs | 15 ++++ .../AccountPasswordRequestValidator.cs | 17 ++++ .../Accounts/AccountsClientService.cs | 30 +++++++ .../Accounts/IAccountsClientService.cs | 2 + .../Model/Accounts.cs | 2 + .../Panels/NewEmailPanelComponent.razor | 46 ++++++++++ .../Panels/NewEmailPanelComponent.razor.cs | 83 +++++++++++++++++++ .../Panels/NewPasswordPanelComponent.razor | 45 ++++++++++ .../Panels/NewPasswordPanelComponent.razor.cs | 60 ++++++++++++++ .../Panels/NewUsernamePanelComponent.razor.cs | 21 ++--- .../ProfileEditFormPanelComponent.razor | 2 +- .../ProfileEditFormPanelComponent.razor.cs | 9 +- .../UserEditPageHeaderPanelComponent.razor | 4 +- .../UserEditPageHeaderPanelComponent.razor.cs | 22 +---- .../WatchIt.Website/Pages/UserEditPage.razor | 16 ++-- .../Pages/UserEditPage.razor.cs | 13 ++- .../WatchIt.Website/appsettings.json | 2 + 23 files changed, 441 insertions(+), 66 deletions(-) create mode 100644 WatchIt.Common/WatchIt.Common.Model/Accounts/AccountEmailRequest.cs create mode 100644 WatchIt.Common/WatchIt.Common.Model/Accounts/AccountPasswordRequest.cs create mode 100644 WatchIt.WebAPI/WatchIt.WebAPI.Validators/Accounts/AccountEmailRequestValidator.cs create mode 100644 WatchIt.WebAPI/WatchIt.WebAPI.Validators/Accounts/AccountPasswordRequestValidator.cs create mode 100644 WatchIt.Website/WatchIt.Website/Components/Pages/UserEditPage/Panels/NewEmailPanelComponent.razor create mode 100644 WatchIt.Website/WatchIt.Website/Components/Pages/UserEditPage/Panels/NewEmailPanelComponent.razor.cs create mode 100644 WatchIt.Website/WatchIt.Website/Components/Pages/UserEditPage/Panels/NewPasswordPanelComponent.razor create mode 100644 WatchIt.Website/WatchIt.Website/Components/Pages/UserEditPage/Panels/NewPasswordPanelComponent.razor.cs diff --git a/WatchIt.Common/WatchIt.Common.Model/Accounts/AccountEmailRequest.cs b/WatchIt.Common/WatchIt.Common.Model/Accounts/AccountEmailRequest.cs new file mode 100644 index 0000000..bdf5bab --- /dev/null +++ b/WatchIt.Common/WatchIt.Common.Model/Accounts/AccountEmailRequest.cs @@ -0,0 +1,27 @@ +using System.Text.Json.Serialization; + +namespace WatchIt.Common.Model.Accounts; + +public class AccountEmailRequest +{ + #region PROPERTIES + + [JsonPropertyName("new_email")] + public string NewEmail { get; set; } + + [JsonPropertyName("password")] + public string Password { get; set; } + + #endregion + + + + #region PUBLIC METHODS + + public void UpdateAccount(Database.Model.Account.Account account) + { + account.Email = NewEmail; + } + + #endregion +} \ No newline at end of file diff --git a/WatchIt.Common/WatchIt.Common.Model/Accounts/AccountPasswordRequest.cs b/WatchIt.Common/WatchIt.Common.Model/Accounts/AccountPasswordRequest.cs new file mode 100644 index 0000000..e0048c1 --- /dev/null +++ b/WatchIt.Common/WatchIt.Common.Model/Accounts/AccountPasswordRequest.cs @@ -0,0 +1,19 @@ +using System.Text.Json.Serialization; + +namespace WatchIt.Common.Model.Accounts; + +public class AccountPasswordRequest +{ + #region PROPERTIES + + [JsonPropertyName("old_password")] + public string OldPassword { get; set; } + + [JsonPropertyName("new_password")] + public string NewPassword { get; set; } + + [JsonPropertyName("new_password_confirmation")] + public string NewPasswordConfirmation { get; set; } + + #endregion +} \ No newline at end of file diff --git a/WatchIt.Database/WatchIt.Database.Model/WatchIt.Database.Model/Account/Account.cs b/WatchIt.Database/WatchIt.Database.Model/WatchIt.Database.Model/Account/Account.cs index c24a5ec..f7f5db4 100644 --- a/WatchIt.Database/WatchIt.Database.Model/WatchIt.Database.Model/Account/Account.cs +++ b/WatchIt.Database/WatchIt.Database.Model/WatchIt.Database.Model/Account/Account.cs @@ -15,9 +15,9 @@ public class Account public short? GenderId { get; set; } public Guid? ProfilePictureId { get; set; } public Guid? BackgroundPictureId { get; set; } - public required byte[] Password { get; set; } - public required string LeftSalt { get; set; } - public required string RightSalt { get; set; } + public byte[] Password { get; set; } + public string LeftSalt { get; set; } + public string RightSalt { get; set; } public bool IsAdmin { get; set; } = false; public DateTime CreationDate { get; set; } public DateTime LastActive { get; set; } diff --git a/WatchIt.WebAPI/WatchIt.WebAPI.Controllers/AccountsController.cs b/WatchIt.WebAPI/WatchIt.WebAPI.Controllers/AccountsController.cs index 1b93fe9..56ea67a 100644 --- a/WatchIt.WebAPI/WatchIt.WebAPI.Controllers/AccountsController.cs +++ b/WatchIt.WebAPI/WatchIt.WebAPI.Controllers/AccountsController.cs @@ -114,6 +114,20 @@ public class AccountsController(IAccountsControllerService accountsControllerSer [ProducesResponseType(StatusCodes.Status401Unauthorized)] public async Task PatchAccountUsername([FromBody]AccountUsernameRequest data) => await accountsControllerService.PatchAccountUsername(data); + [HttpPatch("email")] + [Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme)] + [ProducesResponseType(StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status400BadRequest)] + [ProducesResponseType(StatusCodes.Status401Unauthorized)] + public async Task PatchAccountEmail([FromBody]AccountEmailRequest data) => await accountsControllerService.PatchAccountEmail(data); + + [HttpPatch("password")] + [Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme)] + [ProducesResponseType(StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status400BadRequest)] + [ProducesResponseType(StatusCodes.Status401Unauthorized)] + public async Task PatchAccountPassword([FromBody]AccountPasswordRequest data) => await accountsControllerService.PatchAccountPassword(data); + #endregion [HttpGet("{id}/movies")] diff --git a/WatchIt.WebAPI/WatchIt.WebAPI.Services/WatchIt.WebAPI.Services.Controllers/WatchIt.WebAPI.Services.Controllers.Accounts/AccountsControllerService.cs b/WatchIt.WebAPI/WatchIt.WebAPI.Services/WatchIt.WebAPI.Services.Controllers/WatchIt.WebAPI.Services.Controllers.Accounts/AccountsControllerService.cs index 67d41c1..cb6a052 100644 --- a/WatchIt.WebAPI/WatchIt.WebAPI.Services/WatchIt.WebAPI.Services.Controllers/WatchIt.WebAPI.Services.Controllers.Accounts/AccountsControllerService.cs +++ b/WatchIt.WebAPI/WatchIt.WebAPI.Services/WatchIt.WebAPI.Services.Controllers/WatchIt.WebAPI.Services.Controllers.Accounts/AccountsControllerService.cs @@ -37,18 +37,13 @@ public class AccountsControllerService( public async Task Register(RegisterRequest data) { - string leftSalt = StringExtensions.CreateRandom(20); - string rightSalt = StringExtensions.CreateRandom(20); - byte[] hash = ComputeHash(data.Password, leftSalt, rightSalt); - Account account = new Account { Username = data.Username, Email = data.Email, - Password = hash, - LeftSalt = leftSalt, - RightSalt = rightSalt, }; + + SetPassword(account, data.Password); await database.Accounts.AddAsync(account); await database.SaveChangesAsync(); @@ -283,6 +278,36 @@ public class AccountsControllerService( return RequestResult.Ok(); } + + public async Task PatchAccountEmail(AccountEmailRequest data) + { + Account account = await database.Accounts.FirstAsync(x => x.Id == userService.GetUserId()); + + if (!ComputeHash(data.Password, account.LeftSalt, account.RightSalt).SequenceEqual(account.Password)) + { + return RequestResult.Unauthorized(); + } + + data.UpdateAccount(account); + await database.SaveChangesAsync(); + + return RequestResult.Ok(); + } + + public async Task PatchAccountPassword(AccountPasswordRequest data) + { + Account account = await database.Accounts.FirstAsync(x => x.Id == userService.GetUserId()); + + if (!ComputeHash(data.OldPassword, account.LeftSalt, account.RightSalt).SequenceEqual(account.Password)) + { + return RequestResult.Unauthorized(); + } + + SetPassword(account, data.NewPassword); + await database.SaveChangesAsync(); + + return RequestResult.Ok(); + } #endregion @@ -338,5 +363,16 @@ public class AccountsControllerService( protected byte[] ComputeHash(string password, string leftSalt, string rightSalt) => SHA512.HashData(Encoding.UTF8.GetBytes($"{leftSalt}{password}{rightSalt}")); + private void SetPassword(Account account, string password) + { + string leftSalt = StringExtensions.CreateRandom(20); + string rightSalt = StringExtensions.CreateRandom(20); + byte[] hash = ComputeHash(password, leftSalt, rightSalt); + + account.Password = hash; + account.LeftSalt = leftSalt; + account.RightSalt = rightSalt; + } + #endregion } \ No newline at end of file diff --git a/WatchIt.WebAPI/WatchIt.WebAPI.Services/WatchIt.WebAPI.Services.Controllers/WatchIt.WebAPI.Services.Controllers.Accounts/IAccountsControllerService.cs b/WatchIt.WebAPI/WatchIt.WebAPI.Services/WatchIt.WebAPI.Services.Controllers/WatchIt.WebAPI.Services.Controllers.Accounts/IAccountsControllerService.cs index 481603e..0728d3e 100644 --- a/WatchIt.WebAPI/WatchIt.WebAPI.Services/WatchIt.WebAPI.Services.Controllers/WatchIt.WebAPI.Services.Controllers.Accounts/IAccountsControllerService.cs +++ b/WatchIt.WebAPI/WatchIt.WebAPI.Services/WatchIt.WebAPI.Services.Controllers/WatchIt.WebAPI.Services.Controllers.Accounts/IAccountsControllerService.cs @@ -22,6 +22,8 @@ public interface IAccountsControllerService Task GetAccountInfo(long id); Task PutAccountProfileInfo(AccountProfileInfoRequest data); Task PatchAccountUsername(AccountUsernameRequest data); + Task PatchAccountEmail(AccountEmailRequest data); + Task PatchAccountPassword(AccountPasswordRequest data); Task GetAccountRatedMovies(long id, MovieRatedQueryParameters query); Task GetAccountRatedSeries(long id, SeriesRatedQueryParameters query); Task GetAccountRatedPersons(long id, PersonRatedQueryParameters query); diff --git a/WatchIt.WebAPI/WatchIt.WebAPI.Validators/Accounts/AccountEmailRequestValidator.cs b/WatchIt.WebAPI/WatchIt.WebAPI.Validators/Accounts/AccountEmailRequestValidator.cs new file mode 100644 index 0000000..6bc7e63 --- /dev/null +++ b/WatchIt.WebAPI/WatchIt.WebAPI.Validators/Accounts/AccountEmailRequestValidator.cs @@ -0,0 +1,15 @@ +using FluentValidation; +using WatchIt.Common.Model.Accounts; +using WatchIt.Database; + +namespace WatchIt.WebAPI.Validators.Accounts; + +public class AccountEmailRequestValidator : AbstractValidator +{ + public AccountEmailRequestValidator(DatabaseContext database) + { + RuleFor(x => x.NewEmail).EmailAddress() + .CannotBeIn(database.Accounts, x => x.Email) + .WithMessage("Email was already used"); + } +} \ No newline at end of file diff --git a/WatchIt.WebAPI/WatchIt.WebAPI.Validators/Accounts/AccountPasswordRequestValidator.cs b/WatchIt.WebAPI/WatchIt.WebAPI.Validators/Accounts/AccountPasswordRequestValidator.cs new file mode 100644 index 0000000..ffa2096 --- /dev/null +++ b/WatchIt.WebAPI/WatchIt.WebAPI.Validators/Accounts/AccountPasswordRequestValidator.cs @@ -0,0 +1,17 @@ +using FluentValidation; +using WatchIt.Common.Model.Accounts; +using WatchIt.Database; + +namespace WatchIt.WebAPI.Validators.Accounts; + +public class AccountPasswordRequestValidator : AbstractValidator +{ + public AccountPasswordRequestValidator(DatabaseContext database) + { + RuleFor(x => x.NewPassword).MinimumLength(8) + .Must(x => x.Any(char.IsUpper)).WithMessage("Password must contain at least one uppercase letter.") + .Must(x => x.Any(char.IsLower)).WithMessage("Password must contain at least one lowercase letter.") + .Must(x => x.Any(char.IsDigit)).WithMessage("Password must contain at least one digit.") + .Equal(x => x.NewPasswordConfirmation); + } +} \ No newline at end of file diff --git a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/Accounts/AccountsClientService.cs b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/Accounts/AccountsClientService.cs index d73728e..49e0344 100644 --- a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/Accounts/AccountsClientService.cs +++ b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/Accounts/AccountsClientService.cs @@ -191,6 +191,36 @@ public class AccountsClientService(IHttpClientService httpClientService, IConfig .ExecuteAction(); } + public async Task PatchAccountEmail(AccountEmailRequest data, Action? successAction = null, Action>? badRequestAction = null, Action? unauthorizedAction = null) + { + string url = GetUrl(EndpointsConfiguration.Accounts.PatchAccountEmail); + HttpRequest request = new HttpRequest(HttpMethodType.Patch, url) + { + Body = data, + }; + + HttpResponse response = await httpClientService.SendRequestAsync(request); + response.RegisterActionFor2XXSuccess(successAction) + .RegisterActionFor400BadRequest(badRequestAction) + .RegisterActionFor401Unauthorized(unauthorizedAction) + .ExecuteAction(); + } + + public async Task PatchAccountPassword(AccountPasswordRequest data, Action? successAction = null, Action>? badRequestAction = null, Action? unauthorizedAction = null) + { + string url = GetUrl(EndpointsConfiguration.Accounts.PatchAccountPassword); + HttpRequest request = new HttpRequest(HttpMethodType.Patch, url) + { + Body = data, + }; + + HttpResponse response = await httpClientService.SendRequestAsync(request); + response.RegisterActionFor2XXSuccess(successAction) + .RegisterActionFor400BadRequest(badRequestAction) + .RegisterActionFor401Unauthorized(unauthorizedAction) + .ExecuteAction(); + } + public async Task GetAccountRatedMovies(long id, MovieRatedQueryParameters query, Action>? successAction = null, Action? notFoundAction = null) { string url = GetUrl(EndpointsConfiguration.Accounts.GetAccountRatedMovies, id); diff --git a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/Accounts/IAccountsClientService.cs b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/Accounts/IAccountsClientService.cs index 4a86d8f..84b48f5 100644 --- a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/Accounts/IAccountsClientService.cs +++ b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/Accounts/IAccountsClientService.cs @@ -21,6 +21,8 @@ public interface IAccountsClientService Task GetAccountInfo(long id, Action? successAction = null, Action? notFoundAction = null); Task PutAccountProfileInfo(AccountProfileInfoRequest data, Action? successAction = null, Action>? badRequestAction = null, Action? unauthorizedAction = null); Task PatchAccountUsername(AccountUsernameRequest data, Action? successAction = null, Action>? badRequestAction = null, Action? unauthorizedAction = null); + Task PatchAccountEmail(AccountEmailRequest data, Action? successAction = null, Action>? badRequestAction = null, Action? unauthorizedAction = null); + Task PatchAccountPassword(AccountPasswordRequest data, Action? successAction = null, Action>? badRequestAction = null, Action? unauthorizedAction = null); Task GetAccountRatedMovies(long id, MovieRatedQueryParameters query, Action>? successAction = null, Action? notFoundAction = null); Task GetAccountRatedSeries(long id, SeriesRatedQueryParameters query, Action>? successAction = null, Action? notFoundAction = null); Task GetAccountRatedPersons(long id, PersonRatedQueryParameters query, Action>? successAction = null, Action? notFoundAction = null); diff --git a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Configuration/Model/Accounts.cs b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Configuration/Model/Accounts.cs index 04e8c7f..fae7f58 100644 --- a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Configuration/Model/Accounts.cs +++ b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Configuration/Model/Accounts.cs @@ -16,6 +16,8 @@ public class Accounts public string GetAccountInfo { get; set; } public string PutAccountProfileInfo { get; set; } public string PatchAccountUsername { get; set; } + public string PatchAccountEmail { get; set; } + public string PatchAccountPassword { get; set; } public string GetAccountRatedMovies { get; set; } public string GetAccountRatedSeries { get; set; } public string GetAccountRatedPersons { get; set; } diff --git a/WatchIt.Website/WatchIt.Website/Components/Pages/UserEditPage/Panels/NewEmailPanelComponent.razor b/WatchIt.Website/WatchIt.Website/Components/Pages/UserEditPage/Panels/NewEmailPanelComponent.razor new file mode 100644 index 0000000..612abe7 --- /dev/null +++ b/WatchIt.Website/WatchIt.Website/Components/Pages/UserEditPage/Panels/NewEmailPanelComponent.razor @@ -0,0 +1,46 @@ +
+
+

Change email

+ @if (_data is not null) + { + + +
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+ @if (!string.IsNullOrWhiteSpace(_error)) + { + @(_error) + } + else if (_saved) + { + New email saved! + } +
+
+ +
+
+
+
+ } + else + { + + } +
+
\ No newline at end of file diff --git a/WatchIt.Website/WatchIt.Website/Components/Pages/UserEditPage/Panels/NewEmailPanelComponent.razor.cs b/WatchIt.Website/WatchIt.Website/Components/Pages/UserEditPage/Panels/NewEmailPanelComponent.razor.cs new file mode 100644 index 0000000..77043e6 --- /dev/null +++ b/WatchIt.Website/WatchIt.Website/Components/Pages/UserEditPage/Panels/NewEmailPanelComponent.razor.cs @@ -0,0 +1,83 @@ +using Microsoft.AspNetCore.Components; +using WatchIt.Common.Model.Accounts; +using WatchIt.Website.Services.Client.Accounts; + +namespace WatchIt.Website.Components.Pages.UserEditPage.Panels; + +public partial class NewEmailPanelComponent : ComponentBase +{ + #region SERVICES + + [Inject] private IAccountsClientService AccountsClientService { get; set; } = default!; + [Inject] private NavigationManager NavigationManager { get; set; } = default!; + + #endregion + + + + #region PARAMETERS + + [Parameter] public required AccountResponse AccountData { get; set; } + + #endregion + + + + #region FIELDS + + private AccountEmailRequest? _data; + private string? _error; + private bool _saving; + private bool _saved; + + #endregion + + + + #region PRIVATE METHODS + + protected override async Task OnAfterRenderAsync(bool firstRender) + { + if (firstRender) + { + _data = new AccountEmailRequest + { + NewEmail = AccountData.Email, + }; + StateHasChanged(); + } + } + + private async Task Save() + { + void Success() + { + _saved = true; + _saving = false; + _data = new AccountEmailRequest + { + NewEmail = _data!.NewEmail + }; + NavigationManager.Refresh(true); + } + + void BadRequest(IDictionary errors) + { + _error = errors.SelectMany(x => x.Value).FirstOrDefault() ?? "Unknown error"; + _saving = false; + } + + void Unauthorized() + { + _error = "Incorrect password"; + _saving = false; + } + + _saving = true; + _saved = false; + _error = null; + await AccountsClientService.PatchAccountEmail(_data!, Success, BadRequest, Unauthorized); + } + + #endregion +} \ No newline at end of file diff --git a/WatchIt.Website/WatchIt.Website/Components/Pages/UserEditPage/Panels/NewPasswordPanelComponent.razor b/WatchIt.Website/WatchIt.Website/Components/Pages/UserEditPage/Panels/NewPasswordPanelComponent.razor new file mode 100644 index 0000000..1a869ac --- /dev/null +++ b/WatchIt.Website/WatchIt.Website/Components/Pages/UserEditPage/Panels/NewPasswordPanelComponent.razor @@ -0,0 +1,45 @@ +
+
+

Change password

+ + +
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+ @if (!string.IsNullOrWhiteSpace(_error)) + { + @(_error) + } + else if (_saved) + { + New email saved! + } +
+
+ +
+
+
+
+
+
\ No newline at end of file diff --git a/WatchIt.Website/WatchIt.Website/Components/Pages/UserEditPage/Panels/NewPasswordPanelComponent.razor.cs b/WatchIt.Website/WatchIt.Website/Components/Pages/UserEditPage/Panels/NewPasswordPanelComponent.razor.cs new file mode 100644 index 0000000..7655c8c --- /dev/null +++ b/WatchIt.Website/WatchIt.Website/Components/Pages/UserEditPage/Panels/NewPasswordPanelComponent.razor.cs @@ -0,0 +1,60 @@ +using Microsoft.AspNetCore.Components; +using WatchIt.Common.Model.Accounts; +using WatchIt.Website.Services.Client.Accounts; + +namespace WatchIt.Website.Components.Pages.UserEditPage.Panels; + +public partial class NewPasswordPanelComponent : ComponentBase +{ + #region SERVICES + + [Inject] private IAccountsClientService AccountsClientService { get; set; } = default!; + [Inject] private NavigationManager NavigationManager { get; set; } = default!; + + #endregion + + + + #region FIELDS + + private AccountPasswordRequest _data = new AccountPasswordRequest(); + private string? _error; + private bool _saving; + private bool _saved; + + #endregion + + + + #region PRIVATE METHODS + + private async Task Save() + { + void Success() + { + _saved = true; + _saving = false; + _data = new AccountPasswordRequest(); + NavigationManager.Refresh(true); + } + + void BadRequest(IDictionary errors) + { + _error = errors.SelectMany(x => x.Value).FirstOrDefault() ?? "Unknown error"; + _saving = false; + } + + void Unauthorized() + { + _error = "Incorrect password"; + _saving = false; + } + + _saving = true; + _saved = false; + _error = null; + await AccountsClientService.PatchAccountPassword(_data, Success, BadRequest, Unauthorized); + } + + #endregion +} \ No newline at end of file diff --git a/WatchIt.Website/WatchIt.Website/Components/Pages/UserEditPage/Panels/NewUsernamePanelComponent.razor.cs b/WatchIt.Website/WatchIt.Website/Components/Pages/UserEditPage/Panels/NewUsernamePanelComponent.razor.cs index 0a797fd..39eeb7f 100644 --- a/WatchIt.Website/WatchIt.Website/Components/Pages/UserEditPage/Panels/NewUsernamePanelComponent.razor.cs +++ b/WatchIt.Website/WatchIt.Website/Components/Pages/UserEditPage/Panels/NewUsernamePanelComponent.razor.cs @@ -9,7 +9,6 @@ public partial class NewUsernamePanelComponent : ComponentBase { #region SERVICES - [Inject] private IAuthenticationService AuthenticationService { get; set; } = default!; [Inject] private IAccountsClientService AccountsClientService { get; set; } = default!; [Inject] private NavigationManager NavigationManager { get; set; } = default!; @@ -19,7 +18,7 @@ public partial class NewUsernamePanelComponent : ComponentBase #region PARAMETERS - [Parameter] public required long Id { get; set; } + [Parameter] public required AccountResponse AccountData { get; set; } #endregion @@ -42,21 +41,11 @@ public partial class NewUsernamePanelComponent : ComponentBase { if (firstRender) { - User? user = await AuthenticationService.GetUserAsync(); - - if (user is null) + _data = new AccountUsernameRequest { - return; - } - - await AccountsClientService.GetAccountInfo(user.Id, data => - { - _data = new AccountUsernameRequest - { - NewUsername = data.Username - }; - StateHasChanged(); - }); + NewUsername = AccountData.Username, + }; + StateHasChanged(); } } diff --git a/WatchIt.Website/WatchIt.Website/Components/Pages/UserEditPage/Panels/ProfileEditFormPanelComponent.razor b/WatchIt.Website/WatchIt.Website/Components/Pages/UserEditPage/Panels/ProfileEditFormPanelComponent.razor index 8f9869a..b5a326d 100644 --- a/WatchIt.Website/WatchIt.Website/Components/Pages/UserEditPage/Panels/ProfileEditFormPanelComponent.razor +++ b/WatchIt.Website/WatchIt.Website/Components/Pages/UserEditPage/Panels/ProfileEditFormPanelComponent.razor @@ -23,7 +23,7 @@ @foreach (GenderResponse gender in _genders) { - + }
diff --git a/WatchIt.Website/WatchIt.Website/Components/Pages/UserEditPage/Panels/ProfileEditFormPanelComponent.razor.cs b/WatchIt.Website/WatchIt.Website/Components/Pages/UserEditPage/Panels/ProfileEditFormPanelComponent.razor.cs index 59806dd..7407687 100644 --- a/WatchIt.Website/WatchIt.Website/Components/Pages/UserEditPage/Panels/ProfileEditFormPanelComponent.razor.cs +++ b/WatchIt.Website/WatchIt.Website/Components/Pages/UserEditPage/Panels/ProfileEditFormPanelComponent.razor.cs @@ -20,7 +20,7 @@ public partial class ProfileEditFormPanelComponent : ComponentBase #region PARAMETERS - [Parameter] public long Id { get; set; } + [Parameter] public required AccountResponse AccountData { get; set; } [Parameter] public string Class { get; set; } = string.Empty; #endregion @@ -47,11 +47,8 @@ public partial class ProfileEditFormPanelComponent : ComponentBase { if (firstRender) { - await Task.WhenAll( - [ - GendersClientService.GetAllGenders(successAction: data => _genders = data), - AccountsClientService.GetAccountInfo(Id, data => _accountProfileInfo = new AccountProfileInfoRequest(data)) - ]); + _accountProfileInfo = new AccountProfileInfoRequest(AccountData); + await GendersClientService.GetAllGenders(successAction: data => _genders = data); _loaded = true; StateHasChanged(); diff --git a/WatchIt.Website/WatchIt.Website/Components/Pages/UserEditPage/Panels/UserEditPageHeaderPanelComponent.razor b/WatchIt.Website/WatchIt.Website/Components/Pages/UserEditPage/Panels/UserEditPageHeaderPanelComponent.razor index 2fd8305..f9a9c48 100644 --- a/WatchIt.Website/WatchIt.Website/Components/Pages/UserEditPage/Panels/UserEditPageHeaderPanelComponent.razor +++ b/WatchIt.Website/WatchIt.Website/Components/Pages/UserEditPage/Panels/UserEditPageHeaderPanelComponent.razor @@ -1,8 +1,8 @@
- +
-

@(_username ?? "Loading...")

+

@(AccountData.Username)

User settings
diff --git a/WatchIt.Website/WatchIt.Website/Components/Pages/UserEditPage/Panels/UserEditPageHeaderPanelComponent.razor.cs b/WatchIt.Website/WatchIt.Website/Components/Pages/UserEditPage/Panels/UserEditPageHeaderPanelComponent.razor.cs index 83f7d8e..7700867 100644 --- a/WatchIt.Website/WatchIt.Website/Components/Pages/UserEditPage/Panels/UserEditPageHeaderPanelComponent.razor.cs +++ b/WatchIt.Website/WatchIt.Website/Components/Pages/UserEditPage/Panels/UserEditPageHeaderPanelComponent.razor.cs @@ -1,4 +1,5 @@ using Microsoft.AspNetCore.Components; +using WatchIt.Common.Model.Accounts; using WatchIt.Website.Components.Common.Subcomponents; using WatchIt.Website.Services.Authentication; using WatchIt.Website.Services.Client.Accounts; @@ -18,7 +19,7 @@ public partial class UserEditPageHeaderPanelComponent : ComponentBase #region PARAMETERS - [Parameter] public required User User { get; set; } + [Parameter] public required AccountResponse AccountData { get; set; } #endregion @@ -27,7 +28,6 @@ public partial class UserEditPageHeaderPanelComponent : ComponentBase #region FIELDS private AccountPictureComponent _accountPicture = default!; - private string? _username; #endregion @@ -38,22 +38,4 @@ public partial class UserEditPageHeaderPanelComponent : ComponentBase public async Task ReloadPicture() => await _accountPicture.Reload(); #endregion - - - - #region PRIVATE METHODS - - protected override async Task OnAfterRenderAsync(bool firstRender) - { - if (firstRender) - { - await AccountsClientService.GetAccountInfo(User.Id, data => - { - _username = data.Username; - StateHasChanged(); - }); - } - } - - #endregion } \ No newline at end of file diff --git a/WatchIt.Website/WatchIt.Website/Pages/UserEditPage.razor b/WatchIt.Website/WatchIt.Website/Pages/UserEditPage.razor index 77dadc7..1ef2c1b 100644 --- a/WatchIt.Website/WatchIt.Website/Pages/UserEditPage.razor +++ b/WatchIt.Website/WatchIt.Website/Pages/UserEditPage.razor @@ -9,7 +9,7 @@ @{ StringBuilder sb = new StringBuilder(" - WatchIt"); - if (_user is null) sb.Insert(0, "Loading..."); + if (_accountData is null) sb.Insert(0, "Loading..."); else sb.Insert(0, "User settings"); @(sb.ToString()) @@ -18,11 +18,11 @@
- @if (_user is not null) + @if (_accountData is not null) {
- +
@@ -45,7 +45,7 @@
-
-
-
@@ -70,7 +70,9 @@
- + + +
diff --git a/WatchIt.Website/WatchIt.Website/Pages/UserEditPage.razor.cs b/WatchIt.Website/WatchIt.Website/Pages/UserEditPage.razor.cs index 8e4c5ea..4b29a60 100644 --- a/WatchIt.Website/WatchIt.Website/Pages/UserEditPage.razor.cs +++ b/WatchIt.Website/WatchIt.Website/Pages/UserEditPage.razor.cs @@ -1,6 +1,7 @@ using System.Net; using Microsoft.AspNetCore.Components; using WatchIt.Common.Model; +using WatchIt.Common.Model.Accounts; using WatchIt.Common.Model.Photos; using WatchIt.Website.Components.Pages.UserEditPage.Panels; using WatchIt.Website.Layout; @@ -31,7 +32,7 @@ public partial class UserEditPage : ComponentBase #region FIELDS - private User? _user; + private AccountResponse? _accountData; private UserEditPageHeaderPanelComponent _header = default!; @@ -47,15 +48,19 @@ public partial class UserEditPage : ComponentBase { Layout.BackgroundPhoto = null; - _user = await AuthenticationService.GetUserAsync(); - if (_user is null) + User? user = await AuthenticationService.GetUserAsync(); + if (user is null) { NavigationManager.NavigateTo($"/auth?redirect_to={WebUtility.UrlEncode("/user/edit")}"); return; } StateHasChanged(); - await AccountsClientService.GetAccountProfileBackground(_user.Id, data => Layout.BackgroundPhoto = data); + await Task.WhenAll( + [ + AccountsClientService.GetAccountInfo(user.Id, data => _accountData = data), + AccountsClientService.GetAccountProfileBackground(user.Id, data => Layout.BackgroundPhoto = data) + ]); StateHasChanged(); } } diff --git a/WatchIt.Website/WatchIt.Website/appsettings.json b/WatchIt.Website/WatchIt.Website/appsettings.json index a4eb5eb..943633b 100644 --- a/WatchIt.Website/WatchIt.Website/appsettings.json +++ b/WatchIt.Website/WatchIt.Website/appsettings.json @@ -30,6 +30,8 @@ "GetAccountInfo": "/{0}/info", "PutAccountProfileInfo": "/profile_info", "PatchAccountUsername": "/username", + "PatchAccountEmail": "/email", + "PatchAccountPassword": "/password", "GetAccountRatedMovies": "/{0}/movies", "GetAccountRatedSeries": "/{0}/series", "GetAccountRatedPersons": "/{0}/persons" From d6fda7dbb86d8017b16246b277a6d9c4575faa11 Mon Sep 17 00:00:00 2001 From: Mateusz Skoczek Date: Wed, 6 Nov 2024 15:52:26 +0100 Subject: [PATCH 18/20] getaccountinfo endpoint renamed --- .../WatchIt.WebAPI.Controllers/AccountsController.cs | 4 ++-- .../AccountsControllerService.cs | 2 +- .../IAccountsControllerService.cs | 2 +- .../Accounts/AccountsClientService.cs | 4 ++-- .../Accounts/IAccountsClientService.cs | 2 +- .../WatchIt.Website.Services.Configuration/Model/Accounts.cs | 2 +- WatchIt.Website/WatchIt.Website/Layout/MainLayout.razor.cs | 2 +- WatchIt.Website/WatchIt.Website/Pages/UserEditPage.razor.cs | 2 +- WatchIt.Website/WatchIt.Website/Pages/UserPage.razor.cs | 2 +- WatchIt.Website/WatchIt.Website/appsettings.json | 2 +- 10 files changed, 12 insertions(+), 12 deletions(-) diff --git a/WatchIt.WebAPI/WatchIt.WebAPI.Controllers/AccountsController.cs b/WatchIt.WebAPI/WatchIt.WebAPI.Controllers/AccountsController.cs index 56ea67a..a2b60a5 100644 --- a/WatchIt.WebAPI/WatchIt.WebAPI.Controllers/AccountsController.cs +++ b/WatchIt.WebAPI/WatchIt.WebAPI.Controllers/AccountsController.cs @@ -94,11 +94,11 @@ public class AccountsController(IAccountsControllerService accountsControllerSer #region Info - [HttpGet("{id}/info")] + [HttpGet("{id}")] [AllowAnonymous] [ProducesResponseType(typeof(AccountResponse), StatusCodes.Status200OK)] [ProducesResponseType(StatusCodes.Status404NotFound)] - public async Task GetAccountInfo([FromRoute]long id) => await accountsControllerService.GetAccountInfo(id); + public async Task GetAccount([FromRoute]long id) => await accountsControllerService.GetAccount(id); [HttpPut("profile_info")] [Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme)] diff --git a/WatchIt.WebAPI/WatchIt.WebAPI.Services/WatchIt.WebAPI.Services.Controllers/WatchIt.WebAPI.Services.Controllers.Accounts/AccountsControllerService.cs b/WatchIt.WebAPI/WatchIt.WebAPI.Services/WatchIt.WebAPI.Services.Controllers/WatchIt.WebAPI.Services.Controllers.Accounts/AccountsControllerService.cs index cb6a052..0570ff3 100644 --- a/WatchIt.WebAPI/WatchIt.WebAPI.Services/WatchIt.WebAPI.Services.Controllers/WatchIt.WebAPI.Services.Controllers.Accounts/AccountsControllerService.cs +++ b/WatchIt.WebAPI/WatchIt.WebAPI.Services/WatchIt.WebAPI.Services.Controllers/WatchIt.WebAPI.Services.Controllers.Accounts/AccountsControllerService.cs @@ -238,7 +238,7 @@ public class AccountsControllerService( #region Info - public async Task GetAccountInfo(long id) + public async Task GetAccount(long id) { Account? account = await database.Accounts.FirstOrDefaultAsync(x => x.Id == id); if (account is null) diff --git a/WatchIt.WebAPI/WatchIt.WebAPI.Services/WatchIt.WebAPI.Services.Controllers/WatchIt.WebAPI.Services.Controllers.Accounts/IAccountsControllerService.cs b/WatchIt.WebAPI/WatchIt.WebAPI.Services/WatchIt.WebAPI.Services.Controllers/WatchIt.WebAPI.Services.Controllers.Accounts/IAccountsControllerService.cs index 0728d3e..34996cb 100644 --- a/WatchIt.WebAPI/WatchIt.WebAPI.Services/WatchIt.WebAPI.Services.Controllers/WatchIt.WebAPI.Services.Controllers.Accounts/IAccountsControllerService.cs +++ b/WatchIt.WebAPI/WatchIt.WebAPI.Services/WatchIt.WebAPI.Services.Controllers/WatchIt.WebAPI.Services.Controllers.Accounts/IAccountsControllerService.cs @@ -19,7 +19,7 @@ public interface IAccountsControllerService Task GetAccountProfileBackground(long id); Task PutAccountProfileBackground(AccountProfileBackgroundRequest data); Task DeleteAccountProfileBackground(); - Task GetAccountInfo(long id); + Task GetAccount(long id); Task PutAccountProfileInfo(AccountProfileInfoRequest data); Task PatchAccountUsername(AccountUsernameRequest data); Task PatchAccountEmail(AccountEmailRequest data); diff --git a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/Accounts/AccountsClientService.cs b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/Accounts/AccountsClientService.cs index 49e0344..01e50de 100644 --- a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/Accounts/AccountsClientService.cs +++ b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/Accounts/AccountsClientService.cs @@ -150,9 +150,9 @@ public class AccountsClientService(IHttpClientService httpClientService, IConfig .ExecuteAction(); } - public async Task GetAccountInfo(long id, Action? successAction = null, Action? notFoundAction = null) + public async Task GetAccount(long id, Action? successAction = null, Action? notFoundAction = null) { - string url = GetUrl(EndpointsConfiguration.Accounts.GetAccountInfo, id); + string url = GetUrl(EndpointsConfiguration.Accounts.GetAccount, id); HttpRequest request = new HttpRequest(HttpMethodType.Get, url); HttpResponse response = await httpClientService.SendRequestAsync(request); diff --git a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/Accounts/IAccountsClientService.cs b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/Accounts/IAccountsClientService.cs index 84b48f5..7b0e4cc 100644 --- a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/Accounts/IAccountsClientService.cs +++ b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/Accounts/IAccountsClientService.cs @@ -18,7 +18,7 @@ public interface IAccountsClientService Task GetAccountProfileBackground(long id, Action? successAction = null, Action>? badRequestAction = null, Action? notFoundAction = null); Task PutAccountProfileBackground(AccountProfileBackgroundRequest data, Action? successAction = null, Action>? badRequestAction = null, Action? unauthorizedAction = null); Task DeleteAccountProfileBackground(Action? successAction = null, Action? unauthorizedAction = null); - Task GetAccountInfo(long id, Action? successAction = null, Action? notFoundAction = null); + Task GetAccount(long id, Action? successAction = null, Action? notFoundAction = null); Task PutAccountProfileInfo(AccountProfileInfoRequest data, Action? successAction = null, Action>? badRequestAction = null, Action? unauthorizedAction = null); Task PatchAccountUsername(AccountUsernameRequest data, Action? successAction = null, Action>? badRequestAction = null, Action? unauthorizedAction = null); Task PatchAccountEmail(AccountEmailRequest data, Action? successAction = null, Action>? badRequestAction = null, Action? unauthorizedAction = null); diff --git a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Configuration/Model/Accounts.cs b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Configuration/Model/Accounts.cs index fae7f58..1479b8d 100644 --- a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Configuration/Model/Accounts.cs +++ b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Configuration/Model/Accounts.cs @@ -13,7 +13,7 @@ public class Accounts public string GetAccountProfileBackground { get; set; } public string PutAccountProfileBackground { get; set; } public string DeleteAccountProfileBackground { get; set; } - public string GetAccountInfo { get; set; } + public string GetAccount { get; set; } public string PutAccountProfileInfo { get; set; } public string PatchAccountUsername { get; set; } public string PatchAccountEmail { get; set; } diff --git a/WatchIt.Website/WatchIt.Website/Layout/MainLayout.razor.cs b/WatchIt.Website/WatchIt.Website/Layout/MainLayout.razor.cs index 00657c8..76d3d6c 100644 --- a/WatchIt.Website/WatchIt.Website/Layout/MainLayout.razor.cs +++ b/WatchIt.Website/WatchIt.Website/Layout/MainLayout.razor.cs @@ -91,7 +91,7 @@ public partial class MainLayout : LayoutComponentBase if (_user is not null) { - await AccountsClientService.GetAccountInfo(_user.Id, data => _accountData = data); + await AccountsClientService.GetAccount(_user.Id, data => _accountData = data); } _loaded = true; diff --git a/WatchIt.Website/WatchIt.Website/Pages/UserEditPage.razor.cs b/WatchIt.Website/WatchIt.Website/Pages/UserEditPage.razor.cs index 4b29a60..cb179b4 100644 --- a/WatchIt.Website/WatchIt.Website/Pages/UserEditPage.razor.cs +++ b/WatchIt.Website/WatchIt.Website/Pages/UserEditPage.razor.cs @@ -58,7 +58,7 @@ public partial class UserEditPage : ComponentBase await Task.WhenAll( [ - AccountsClientService.GetAccountInfo(user.Id, data => _accountData = data), + AccountsClientService.GetAccount(user.Id, data => _accountData = data), AccountsClientService.GetAccountProfileBackground(user.Id, data => Layout.BackgroundPhoto = data) ]); StateHasChanged(); diff --git a/WatchIt.Website/WatchIt.Website/Pages/UserPage.razor.cs b/WatchIt.Website/WatchIt.Website/Pages/UserPage.razor.cs index 95087f0..41cec0a 100644 --- a/WatchIt.Website/WatchIt.Website/Pages/UserPage.razor.cs +++ b/WatchIt.Website/WatchIt.Website/Pages/UserPage.razor.cs @@ -91,7 +91,7 @@ public partial class UserPage : ComponentBase Id = user.Id; } - await AccountsClientService.GetAccountInfo(Id.Value, data => _accountData = data); + await AccountsClientService.GetAccount(Id.Value, data => _accountData = data); _owner = Id.Value == user?.Id; } diff --git a/WatchIt.Website/WatchIt.Website/appsettings.json b/WatchIt.Website/WatchIt.Website/appsettings.json index 943633b..8099a36 100644 --- a/WatchIt.Website/WatchIt.Website/appsettings.json +++ b/WatchIt.Website/WatchIt.Website/appsettings.json @@ -27,7 +27,7 @@ "GetAccountProfileBackground": "/{0}/profile_background", "PutAccountProfileBackground": "/profile_background", "DeleteAccountProfileBackground": "/profile_background", - "GetAccountInfo": "/{0}/info", + "GetAccount": "/{0}", "PutAccountProfileInfo": "/profile_info", "PatchAccountUsername": "/username", "PatchAccountEmail": "/email", From 57fd4ba7a1f73f172181f53955da10f11d327717 Mon Sep 17 00:00:00 2001 From: Mateusz Skoczek Date: Wed, 6 Nov 2024 16:29:24 +0100 Subject: [PATCH 19/20] get all accounts endpoint added --- .../Accounts/AccountQueryParameters.cs | 67 +++++++++++++++++++ .../Accounts/AccountResponse.cs | 17 ++++- .../AccountsController.cs | 5 ++ .../AccountsControllerService.cs | 8 +++ .../IAccountsControllerService.cs | 1 + .../Accounts/AccountsClientService.cs | 13 ++++ .../Accounts/IAccountsClientService.cs | 1 + .../Model/Accounts.cs | 1 + .../WatchIt.Website/appsettings.json | 1 + 9 files changed, 113 insertions(+), 1 deletion(-) create mode 100644 WatchIt.Common/WatchIt.Common.Model/Accounts/AccountQueryParameters.cs diff --git a/WatchIt.Common/WatchIt.Common.Model/Accounts/AccountQueryParameters.cs b/WatchIt.Common/WatchIt.Common.Model/Accounts/AccountQueryParameters.cs new file mode 100644 index 0000000..88221db --- /dev/null +++ b/WatchIt.Common/WatchIt.Common.Model/Accounts/AccountQueryParameters.cs @@ -0,0 +1,67 @@ +using Microsoft.AspNetCore.Mvc; +using WatchIt.Common.Query; + +namespace WatchIt.Common.Model.Accounts; + +public class AccountQueryParameters : QueryParameters +{ + #region PROPERTIES + + [FromQuery(Name = "username")] + public string? Username { get; set; } + + [FromQuery(Name = "email")] + public string? Email { get; set; } + + [FromQuery(Name = "description")] + public string? Description { get; set; } + + [FromQuery(Name = "gender_id")] + public short? GenderId { get; set; } + + [FromQuery(Name = "last_active")] + public DateOnly? LastActive { get; set; } + + [FromQuery(Name = "last_active_from")] + public DateOnly? LastActiveFrom { get; set; } + + [FromQuery(Name = "last_active_to")] + public DateOnly? LastActiveTo { get; set; } + + [FromQuery(Name = "creation_date")] + public DateOnly? CreationDate { get; set; } + + [FromQuery(Name = "creation_date_from")] + public DateOnly? CreationDateFrom { get; set; } + + [FromQuery(Name = "creation_date_to")] + public DateOnly? CreationDateTo { get; set; } + + [FromQuery(Name = "is_admin")] + public bool? IsAdmin { get; set; } + + #endregion + + + + #region PRIVATE METHODS + + protected override bool IsMeetingConditions(AccountResponse item) => + ( + TestStringWithRegex(item.Username, Username) + && + TestStringWithRegex(item.Email, Email) + && + TestStringWithRegex(item.Description, Description) + && + Test(item.Gender?.Id, GenderId) + && + TestComparable(item.LastActive, LastActive, LastActiveFrom, LastActiveTo) + && + TestComparable(item.CreationDate, CreationDate, CreationDateFrom, CreationDateTo) + && + Test(item.IsAdmin, IsAdmin) + ); + + #endregion +} \ No newline at end of file diff --git a/WatchIt.Common/WatchIt.Common.Model/Accounts/AccountResponse.cs b/WatchIt.Common/WatchIt.Common.Model/Accounts/AccountResponse.cs index fb3bc77..8ab8756 100644 --- a/WatchIt.Common/WatchIt.Common.Model/Accounts/AccountResponse.cs +++ b/WatchIt.Common/WatchIt.Common.Model/Accounts/AccountResponse.cs @@ -1,13 +1,28 @@ using System.Diagnostics.CodeAnalysis; using System.Text.Json.Serialization; using WatchIt.Common.Model.Genders; +using WatchIt.Common.Query; namespace WatchIt.Common.Model.Accounts; -public class AccountResponse : Account +public class AccountResponse : Account, IQueryOrderable { #region PROPERTIES + [JsonIgnore] + public static IDictionary> OrderableProperties { get; } = new Dictionary> + { + { "id", x => x.Id }, + { "username", x => x.Username }, + { "email", x => x.Email }, + { "description", x => x.Description }, + { "gender", x => x.Gender.Name }, + { "last_active", x => x.LastActive }, + { "creation_date", x => x.CreationDate }, + { "is_admin", x => x.IsAdmin } + }; + + [JsonPropertyName("id")] public required long Id { get; set; } diff --git a/WatchIt.WebAPI/WatchIt.WebAPI.Controllers/AccountsController.cs b/WatchIt.WebAPI/WatchIt.WebAPI.Controllers/AccountsController.cs index a2b60a5..a57a424 100644 --- a/WatchIt.WebAPI/WatchIt.WebAPI.Controllers/AccountsController.cs +++ b/WatchIt.WebAPI/WatchIt.WebAPI.Controllers/AccountsController.cs @@ -94,6 +94,11 @@ public class AccountsController(IAccountsControllerService accountsControllerSer #region Info + [HttpGet] + [AllowAnonymous] + [ProducesResponseType(typeof(IEnumerable), StatusCodes.Status200OK)] + public async Task GetAccounts(AccountQueryParameters query) => await accountsControllerService.GetAccounts(query); + [HttpGet("{id}")] [AllowAnonymous] [ProducesResponseType(typeof(AccountResponse), StatusCodes.Status200OK)] diff --git a/WatchIt.WebAPI/WatchIt.WebAPI.Services/WatchIt.WebAPI.Services.Controllers/WatchIt.WebAPI.Services.Controllers.Accounts/AccountsControllerService.cs b/WatchIt.WebAPI/WatchIt.WebAPI.Services/WatchIt.WebAPI.Services.Controllers/WatchIt.WebAPI.Services.Controllers.Accounts/AccountsControllerService.cs index 0570ff3..14fc4ba 100644 --- a/WatchIt.WebAPI/WatchIt.WebAPI.Services/WatchIt.WebAPI.Services.Controllers/WatchIt.WebAPI.Services.Controllers.Accounts/AccountsControllerService.cs +++ b/WatchIt.WebAPI/WatchIt.WebAPI.Services/WatchIt.WebAPI.Services.Controllers/WatchIt.WebAPI.Services.Controllers.Accounts/AccountsControllerService.cs @@ -238,6 +238,14 @@ public class AccountsControllerService( #region Info + public async Task GetAccounts(AccountQueryParameters query) + { + IEnumerable accounts = await database.Accounts.ToListAsync(); + IEnumerable accountsData = accounts.Select(x => new AccountResponse(x)); + accountsData = query.PrepareData(accountsData); + return RequestResult.Ok(accountsData); + } + public async Task GetAccount(long id) { Account? account = await database.Accounts.FirstOrDefaultAsync(x => x.Id == id); diff --git a/WatchIt.WebAPI/WatchIt.WebAPI.Services/WatchIt.WebAPI.Services.Controllers/WatchIt.WebAPI.Services.Controllers.Accounts/IAccountsControllerService.cs b/WatchIt.WebAPI/WatchIt.WebAPI.Services/WatchIt.WebAPI.Services.Controllers/WatchIt.WebAPI.Services.Controllers.Accounts/IAccountsControllerService.cs index 34996cb..bb03dc5 100644 --- a/WatchIt.WebAPI/WatchIt.WebAPI.Services/WatchIt.WebAPI.Services.Controllers/WatchIt.WebAPI.Services.Controllers.Accounts/IAccountsControllerService.cs +++ b/WatchIt.WebAPI/WatchIt.WebAPI.Services/WatchIt.WebAPI.Services.Controllers/WatchIt.WebAPI.Services.Controllers.Accounts/IAccountsControllerService.cs @@ -19,6 +19,7 @@ public interface IAccountsControllerService Task GetAccountProfileBackground(long id); Task PutAccountProfileBackground(AccountProfileBackgroundRequest data); Task DeleteAccountProfileBackground(); + Task GetAccounts(AccountQueryParameters query); Task GetAccount(long id); Task PutAccountProfileInfo(AccountProfileInfoRequest data); Task PatchAccountUsername(AccountUsernameRequest data); diff --git a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/Accounts/AccountsClientService.cs b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/Accounts/AccountsClientService.cs index 01e50de..df8649f 100644 --- a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/Accounts/AccountsClientService.cs +++ b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/Accounts/AccountsClientService.cs @@ -150,6 +150,19 @@ public class AccountsClientService(IHttpClientService httpClientService, IConfig .ExecuteAction(); } + public async Task GetAccounts(AccountQueryParameters query, Action>? successAction = null) + { + string url = GetUrl(EndpointsConfiguration.Accounts.GetAccounts); + HttpRequest request = new HttpRequest(HttpMethodType.Get, url) + { + Query = query + }; + + HttpResponse response = await httpClientService.SendRequestAsync(request); + response.RegisterActionFor2XXSuccess(successAction) + .ExecuteAction(); + } + public async Task GetAccount(long id, Action? successAction = null, Action? notFoundAction = null) { string url = GetUrl(EndpointsConfiguration.Accounts.GetAccount, id); diff --git a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/Accounts/IAccountsClientService.cs b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/Accounts/IAccountsClientService.cs index 7b0e4cc..09543c6 100644 --- a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/Accounts/IAccountsClientService.cs +++ b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Client/Accounts/IAccountsClientService.cs @@ -18,6 +18,7 @@ public interface IAccountsClientService Task GetAccountProfileBackground(long id, Action? successAction = null, Action>? badRequestAction = null, Action? notFoundAction = null); Task PutAccountProfileBackground(AccountProfileBackgroundRequest data, Action? successAction = null, Action>? badRequestAction = null, Action? unauthorizedAction = null); Task DeleteAccountProfileBackground(Action? successAction = null, Action? unauthorizedAction = null); + Task GetAccounts(AccountQueryParameters query, Action>? successAction = null); Task GetAccount(long id, Action? successAction = null, Action? notFoundAction = null); Task PutAccountProfileInfo(AccountProfileInfoRequest data, Action? successAction = null, Action>? badRequestAction = null, Action? unauthorizedAction = null); Task PatchAccountUsername(AccountUsernameRequest data, Action? successAction = null, Action>? badRequestAction = null, Action? unauthorizedAction = null); diff --git a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Configuration/Model/Accounts.cs b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Configuration/Model/Accounts.cs index 1479b8d..eae345a 100644 --- a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Configuration/Model/Accounts.cs +++ b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Configuration/Model/Accounts.cs @@ -13,6 +13,7 @@ public class Accounts public string GetAccountProfileBackground { get; set; } public string PutAccountProfileBackground { get; set; } public string DeleteAccountProfileBackground { get; set; } + public string GetAccounts { get; set; } public string GetAccount { get; set; } public string PutAccountProfileInfo { get; set; } public string PatchAccountUsername { get; set; } diff --git a/WatchIt.Website/WatchIt.Website/appsettings.json b/WatchIt.Website/WatchIt.Website/appsettings.json index 8099a36..9f2429a 100644 --- a/WatchIt.Website/WatchIt.Website/appsettings.json +++ b/WatchIt.Website/WatchIt.Website/appsettings.json @@ -27,6 +27,7 @@ "GetAccountProfileBackground": "/{0}/profile_background", "PutAccountProfileBackground": "/profile_background", "DeleteAccountProfileBackground": "/profile_background", + "GetAccounts": "", "GetAccount": "/{0}", "PutAccountProfileInfo": "/profile_info", "PatchAccountUsername": "/username", From 727c124b1b8fc4bb2a1a5b965fef86d99f82892c Mon Sep 17 00:00:00 2001 From: Mateusz Skoczek Date: Thu, 7 Nov 2024 00:20:45 +0100 Subject: [PATCH 20/20] user searching finished --- .../UsersSearchResultPanelComponent.razor | 77 +++++++++++++++ .../UsersSearchResultPanelComponent.razor.cs | 97 +++++++++++++++++++ .../UserSearchResultItemComponent.razor | 7 ++ .../UserSearchResultItemComponent.razor.cs | 13 +++ .../Layout/MainLayout.razor.cs | 2 +- .../WatchIt.Website/Pages/SearchPage.razor | 10 +- 6 files changed, 201 insertions(+), 5 deletions(-) create mode 100644 WatchIt.Website/WatchIt.Website/Components/Pages/SearchPage/Panels/UsersSearchResultPanelComponent.razor create mode 100644 WatchIt.Website/WatchIt.Website/Components/Pages/SearchPage/Panels/UsersSearchResultPanelComponent.razor.cs create mode 100644 WatchIt.Website/WatchIt.Website/Components/Pages/SearchPage/Subcomponents/UserSearchResultItemComponent.razor create mode 100644 WatchIt.Website/WatchIt.Website/Components/Pages/SearchPage/Subcomponents/UserSearchResultItemComponent.razor.cs diff --git a/WatchIt.Website/WatchIt.Website/Components/Pages/SearchPage/Panels/UsersSearchResultPanelComponent.razor b/WatchIt.Website/WatchIt.Website/Components/Pages/SearchPage/Panels/UsersSearchResultPanelComponent.razor new file mode 100644 index 0000000..cb5dd8e --- /dev/null +++ b/WatchIt.Website/WatchIt.Website/Components/Pages/SearchPage/Panels/UsersSearchResultPanelComponent.razor @@ -0,0 +1,77 @@ +@using Blazorise.Extensions +@using WatchIt.Website.Components.Pages.SearchPage.Subcomponents + + + +
+
+
+
+

Users

+
+
+ @if (_loaded) + { + if (!_items.IsNullOrEmpty()) + { + for (int i = 0; i < _items.Count; i++) + { + if (i > 0) + { +
+
+
+
+
+ } +
+
+ @{ + int iCopy = i; + } + +
+
+ } + if (!_allItemsLoaded) + { +
+
+
+ +
+
+
+ } + } + else + { +
+
+
+ No items found +
+
+
+ } + } + else + { +
+
+ +
+
+ } +
+
\ No newline at end of file diff --git a/WatchIt.Website/WatchIt.Website/Components/Pages/SearchPage/Panels/UsersSearchResultPanelComponent.razor.cs b/WatchIt.Website/WatchIt.Website/Components/Pages/SearchPage/Panels/UsersSearchResultPanelComponent.razor.cs new file mode 100644 index 0000000..42b7197 --- /dev/null +++ b/WatchIt.Website/WatchIt.Website/Components/Pages/SearchPage/Panels/UsersSearchResultPanelComponent.razor.cs @@ -0,0 +1,97 @@ +using Microsoft.AspNetCore.Components; +using WatchIt.Common.Model.Accounts; +using WatchIt.Website.Services.Client.Accounts; + +namespace WatchIt.Website.Components.Pages.SearchPage.Panels; + +public partial class UsersSearchResultPanelComponent : ComponentBase +{ + #region SERVICES + + [Inject] private IAccountsClientService AccountsClientService { get; set; } = default!; + + #endregion + + + + #region PARAMETERS + + [Parameter] public required string Query { get; set; } + + #endregion + + + + #region FIELDS + + private bool _loaded; + + private AccountQueryParameters _query = new AccountQueryParameters + { + First = 5 + }; + + private List _items = []; + private bool _allItemsLoaded; + private bool _itemsLoading; + + #endregion + + + + #region PRIVATE METHODS + + protected override async Task OnAfterRenderAsync(bool firstRender) + { + if (firstRender) + { + // INIT + _query.Username = Query; + + List endTasks = new List(); + + // STEP 0 + endTasks.AddRange( + [ + AccountsClientService.GetAccounts(_query, data => + { + _items.AddRange(data); + if (data.Count() < 5) + { + _allItemsLoaded = true; + } + else + { + _query.After = 5; + } + }) + ]); + + // END + await Task.WhenAll(endTasks); + + _loaded = true; + StateHasChanged(); + } + } + + private async Task DownloadItems() + { + _itemsLoading = true; + await AccountsClientService.GetAccounts(_query, data => + { + _items.AddRange(data); + if (data.Count() < 5) + { + _allItemsLoaded = true; + } + else + { + _query.After += 5; + } + _itemsLoading = false; + }); + } + + #endregion +} \ No newline at end of file diff --git a/WatchIt.Website/WatchIt.Website/Components/Pages/SearchPage/Subcomponents/UserSearchResultItemComponent.razor b/WatchIt.Website/WatchIt.Website/Components/Pages/SearchPage/Subcomponents/UserSearchResultItemComponent.razor new file mode 100644 index 0000000..dc936c9 --- /dev/null +++ b/WatchIt.Website/WatchIt.Website/Components/Pages/SearchPage/Subcomponents/UserSearchResultItemComponent.razor @@ -0,0 +1,7 @@ + +
+ +

@(Item.Username)

+
+
\ No newline at end of file diff --git a/WatchIt.Website/WatchIt.Website/Components/Pages/SearchPage/Subcomponents/UserSearchResultItemComponent.razor.cs b/WatchIt.Website/WatchIt.Website/Components/Pages/SearchPage/Subcomponents/UserSearchResultItemComponent.razor.cs new file mode 100644 index 0000000..b81a075 --- /dev/null +++ b/WatchIt.Website/WatchIt.Website/Components/Pages/SearchPage/Subcomponents/UserSearchResultItemComponent.razor.cs @@ -0,0 +1,13 @@ +using Microsoft.AspNetCore.Components; +using WatchIt.Common.Model.Accounts; + +namespace WatchIt.Website.Components.Pages.SearchPage.Subcomponents; + +public partial class UserSearchResultItemComponent : ComponentBase +{ + #region PROPERTIES + + [Parameter] public required AccountResponse Item { get; set; } + + #endregion +} \ No newline at end of file diff --git a/WatchIt.Website/WatchIt.Website/Layout/MainLayout.razor.cs b/WatchIt.Website/WatchIt.Website/Layout/MainLayout.razor.cs index 76d3d6c..d0df615 100644 --- a/WatchIt.Website/WatchIt.Website/Layout/MainLayout.razor.cs +++ b/WatchIt.Website/WatchIt.Website/Layout/MainLayout.razor.cs @@ -121,7 +121,7 @@ public partial class MainLayout : LayoutComponentBase if (!string.IsNullOrWhiteSpace(_searchbarText)) { string query = WebUtility.UrlEncode(_searchbarText); - NavigationManager.NavigateTo($"/search/{query}"); + NavigationManager.NavigateTo($"/search/{query}", true); } } diff --git a/WatchIt.Website/WatchIt.Website/Pages/SearchPage.razor b/WatchIt.Website/WatchIt.Website/Pages/SearchPage.razor index 7e30b8f..afcbd75 100644 --- a/WatchIt.Website/WatchIt.Website/Pages/SearchPage.razor +++ b/WatchIt.Website/WatchIt.Website/Pages/SearchPage.razor @@ -1,3 +1,4 @@ +@using System.Net @using WatchIt.Common.Model.Movies @using WatchIt.Common.Model.Persons @using WatchIt.Common.Model.Series @@ -15,7 +16,7 @@

- Search results for phrase: "@(DecodedQuery)" + Search results for phrase: "@(WebUtility.UrlDecode(Query))"

@@ -27,7 +28,7 @@ NameSource="@(item => item.Title)" AdditionalNameInfoSource="@(item => item.ReleaseDate.HasValue ? $" ({item.ReleaseDate.Value.Year})" : null)" RatingSource="@(item => item.Rating)" - Query="@(new MovieQueryParameters { Title = DecodedQuery, OrderBy = "rating.count" })" + Query="@(new MovieQueryParameters { Title = WebUtility.UrlDecode(Query), OrderBy = "rating.count" })" ItemDownloadingTask="@(MoviesClientService.GetAllMovies)" PictureDownloadingTask="@((id, action) => MediaClientService.GetMediaPoster(id, action))" PosterPlaceholder="/assets/media_poster.png" @@ -43,7 +44,7 @@ NameSource="@(item => item.Title)" AdditionalNameInfoSource="@(item => item.ReleaseDate.HasValue ? $" ({item.ReleaseDate.Value.Year})" : null)" RatingSource="@(item => item.Rating)" - Query="@(new SeriesQueryParameters { Title = DecodedQuery, OrderBy = "rating.count" })" + Query="@(new SeriesQueryParameters { Title = WebUtility.UrlDecode(Query), OrderBy = "rating.count" })" ItemDownloadingTask="@(SeriesClientService.GetAllSeries)" PictureDownloadingTask="@((id, action) => MediaClientService.GetMediaPoster(id, action))" PosterPlaceholder="/assets/media_poster.png" @@ -58,9 +59,10 @@ IdSource="@(item => item.Id)" NameSource="@(item => item.Name)" RatingSource="@(item => item.Rating)" - Query="@(new PersonQueryParameters { Name = DecodedQuery, OrderBy = "rating.count" })" + Query="@(new PersonQueryParameters { Name = WebUtility.UrlDecode(Query), OrderBy = "rating.count" })" ItemDownloadingTask="@(PersonsClientService.GetAllPersons)" PictureDownloadingTask="@((id, action) => PersonsClientService.GetPersonPhoto(id, action))" PosterPlaceholder="/assets/person_poster.png" GetGlobalRatingMethod="@((id, action) => PersonsClientService.GetPersonGlobalRating(id, action))"/> +
\ No newline at end of file