diff --git a/WatchIt.Common/WatchIt.Common.Model/Rating/RatingResponse.cs b/WatchIt.Common/WatchIt.Common.Model/Rating/RatingResponse.cs index 77fed60..9037814 100644 --- a/WatchIt.Common/WatchIt.Common.Model/Rating/RatingResponse.cs +++ b/WatchIt.Common/WatchIt.Common.Model/Rating/RatingResponse.cs @@ -45,6 +45,11 @@ public class RatingResponse { 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); diff --git a/WatchIt.WebAPI/WatchIt.WebAPI.Controllers/PersonsController.cs b/WatchIt.WebAPI/WatchIt.WebAPI.Controllers/PersonsController.cs index a36a45e..ed213b0 100644 --- a/WatchIt.WebAPI/WatchIt.WebAPI.Controllers/PersonsController.cs +++ b/WatchIt.WebAPI/WatchIt.WebAPI.Controllers/PersonsController.cs @@ -3,6 +3,7 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using WatchIt.Common.Model.Persons; +using WatchIt.Common.Model.Rating; using WatchIt.Common.Model.Roles; using WatchIt.WebAPI.Services.Controllers.Persons; @@ -145,6 +146,22 @@ public class PersonsController : ControllerBase [ProducesResponseType(StatusCodes.Status404NotFound)] public async Task PostPersonCreatorRole([FromRoute]long id, [FromBody]CreatorRolePersonRequest body) => await _personsControllerService.PostPersonCreatorRole(id, body); + #endregion + + #region Rating + + [HttpGet("{id}/rating")] + [AllowAnonymous] + [ProducesResponseType(typeof(RatingResponse), StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status404NotFound)] + public async Task GetPersonGlobalRating([FromRoute]long id) => await _personsControllerService.GetPersonGlobalRating(id); + + [HttpGet("{id}/rating/{user_id}")] + [AllowAnonymous] + [ProducesResponseType(typeof(RatingResponse), StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status404NotFound)] + public async Task GetPersonUserRating([FromRoute]long id, [FromRoute(Name = "user_id")]long userId) => await _personsControllerService.GetPersonUserRating(id, userId); + #endregion #endregion diff --git a/WatchIt.WebAPI/WatchIt.WebAPI.Services/WatchIt.WebAPI.Services.Controllers/WatchIt.WebAPI.Services.Controllers.Persons/IPersonsControllerService.cs b/WatchIt.WebAPI/WatchIt.WebAPI.Services/WatchIt.WebAPI.Services.Controllers/WatchIt.WebAPI.Services.Controllers.Persons/IPersonsControllerService.cs index b5802ce..76599a3 100644 --- a/WatchIt.WebAPI/WatchIt.WebAPI.Services/WatchIt.WebAPI.Services.Controllers/WatchIt.WebAPI.Services.Controllers.Persons/IPersonsControllerService.cs +++ b/WatchIt.WebAPI/WatchIt.WebAPI.Services/WatchIt.WebAPI.Services.Controllers/WatchIt.WebAPI.Services.Controllers.Persons/IPersonsControllerService.cs @@ -23,4 +23,7 @@ public interface IPersonsControllerService Task PostPersonActorRole(long personId, ActorRolePersonRequest data); Task GetPersonAllCreatorRoles(long personId, CreatorRolePersonQueryParameters queryParameters); Task PostPersonCreatorRole(long personId, CreatorRolePersonRequest data); + + Task GetPersonGlobalRating(long id); + Task GetPersonUserRating(long id, long userId); } \ No newline at end of file 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 daafedf..3a80110 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 @@ -1,8 +1,10 @@ using Microsoft.EntityFrameworkCore; using WatchIt.Common.Model.Persons; +using WatchIt.Common.Model.Rating; using WatchIt.Common.Model.Roles; using WatchIt.Database; using WatchIt.Database.Model.Person; +using WatchIt.Database.Model.Rating; using WatchIt.Database.Model.ViewCount; using WatchIt.WebAPI.Services.Controllers.Common; using WatchIt.WebAPI.Services.Utility.User; @@ -321,6 +323,38 @@ public class PersonsControllerService : IPersonsControllerService return RequestResult.Created($"roles/creator/{item.Id}", new CreatorRoleResponse(item)); } + #endregion + + #region Rating + + public async Task GetPersonGlobalRating(long id) + { + Person? item = await _database.Persons.FirstOrDefaultAsync(x => x.Id == id); + if (item is null) + { + return RequestResult.NotFound(); + } + + RatingResponse ratingResponse = RatingResponse.Create(item.PersonActorRoles, item.PersonCreatorRoles); + + return RequestResult.Ok(ratingResponse); + } + + public async Task GetPersonUserRating(long id, long userId) + { + Person? item = await _database.Persons.FirstOrDefaultAsync(x => x.Id == id); + if (item is null) + { + 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); + + return RequestResult.Ok(ratingResponse); + } + #endregion #endregion 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.Utility.Configuration/Model/Persons.cs index 4f372c7..0bbc44e 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.Utility.Configuration/Model/Persons.cs @@ -17,4 +17,6 @@ public class Persons public string PostPersonActorRole { get; set; } public string GetPersonAllCreatorRoles { get; set; } public string PostPersonCreatorRole { get; set; } + public string GetPersonGlobalRating { get; set; } + public string GetPersonUserRating { get; set; } } \ No newline at end of file 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.WebAPI/WatchIt.Website.Services.WebAPI.Persons/IPersonsWebAPIService.cs index bbb0b96..071ed25 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.WebAPI/WatchIt.Website.Services.WebAPI.Persons/IPersonsWebAPIService.cs @@ -1,4 +1,5 @@ using WatchIt.Common.Model.Persons; +using WatchIt.Common.Model.Rating; using WatchIt.Common.Model.Roles; namespace WatchIt.Website.Services.WebAPI.Persons; @@ -22,4 +23,7 @@ public interface IPersonsWebAPIService Task PostPersonActorRole(long id, ActorRolePersonRequest data, Action? successAction = null, Action>? badRequestAction = null, Action? unauthorizedAction = null, Action? forbiddenAction = null); Task GetPersonAllCreatorRoles(long id, CreatorRolePersonQueryParameters? query = null, Action>? successAction = null); Task PostPersonCreatorRole(long id, CreatorRolePersonRequest data, Action? successAction = null, Action>? badRequestAction = null, Action? unauthorizedAction = null, Action? forbiddenAction = null); + + Task GetPersonGlobalRating(long id, Action? successAction = null, Action? notFoundAction = null); + Task GetPersonUserRating(long id, long userId, Action? successAction = null, Action? notFoundAction = null); } \ No newline at end of file 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.WebAPI/WatchIt.Website.Services.WebAPI.Persons/PersonsWebAPIService.cs index a3c8e14..a38a6f0 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.WebAPI/WatchIt.Website.Services.WebAPI.Persons/PersonsWebAPIService.cs @@ -2,6 +2,7 @@ using Microsoft.AspNetCore.Components; using Microsoft.Extensions.Primitives; 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; @@ -258,6 +259,34 @@ public class PersonsWebAPIService : BaseWebAPIService, IPersonsWebAPIService #endregion + #region Rating + + public async Task GetPersonGlobalRating(long id, Action? successAction = null, Action? notFoundAction = null) + { + string url = GetUrl(EndpointsConfiguration.Persons.GetPersonGlobalRating, id); + + HttpRequest request = new HttpRequest(HttpMethodType.Get, url); + + HttpResponse response = await _httpClientService.SendRequestAsync(request); + response.RegisterActionFor2XXSuccess(successAction) + .RegisterActionFor404NotFound(notFoundAction) + .ExecuteAction(); + } + + public async Task GetPersonUserRating(long id, long userId, Action? successAction = null, Action? notFoundAction = null) + { + string url = GetUrl(EndpointsConfiguration.Persons.GetPersonUserRating, id, userId); + + HttpRequest request = new HttpRequest(HttpMethodType.Get, url); + + HttpResponse response = await _httpClientService.SendRequestAsync(request); + response.RegisterActionFor2XXSuccess(successAction) + .RegisterActionFor404NotFound(notFoundAction) + .ExecuteAction(); + } + + #endregion + #endregion diff --git a/WatchIt.Website/WatchIt.Website/App.razor b/WatchIt.Website/WatchIt.Website/App.razor index 92e4b6b..c54fec3 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/Subcomponents/DisplayRatingComponent.razor b/WatchIt.Website/WatchIt.Website/Components/Common/Subcomponents/DisplayRatingComponent.razor new file mode 100644 index 0000000..da7a6c5 --- /dev/null +++ b/WatchIt.Website/WatchIt.Website/Components/Common/Subcomponents/DisplayRatingComponent.razor @@ -0,0 +1,51 @@ +@using Blazorise.Extensions +
+ @if (Rating is null || Rating.Count > 0 || EmptyMode == DisplayRatingComponentEmptyMode.DoubleDash) + { + + } +
+ @if (Rating is not null && Rating.Count > 0) + { + @($"{Math.Round(Rating.Average, 2)}/10") + @(Rating.Count) + } + else + { +
+ @if (Rating is null) + { +
/10
+ } + else + { + switch (EmptyMode) + { + case DisplayRatingComponentEmptyMode.NoRatings: @("no ratings"); break; + case DisplayRatingComponentEmptyMode.DoubleDash: @("--/10"); break; + } + } +
+ } +
+
+ + \ No newline at end of file diff --git a/WatchIt.Website/WatchIt.Website/Components/Common/Subcomponents/DisplayRatingComponent.razor.cs b/WatchIt.Website/WatchIt.Website/Components/Common/Subcomponents/DisplayRatingComponent.razor.cs new file mode 100644 index 0000000..8f6935e --- /dev/null +++ b/WatchIt.Website/WatchIt.Website/Components/Common/Subcomponents/DisplayRatingComponent.razor.cs @@ -0,0 +1,27 @@ +using Microsoft.AspNetCore.Components; +using WatchIt.Common.Model.Rating; + +namespace WatchIt.Website.Components.Common.Subcomponents; + +public partial class DisplayRatingComponent : ComponentBase +{ + #region PARAMETERS + + [Parameter] public RatingResponse? Rating { get; set; } + [Parameter] public DisplayRatingComponentEmptyMode EmptyMode { get; set; } = DisplayRatingComponentEmptyMode.NoRatings; + [Parameter] public double Scale { get; set; } = 1; + + #endregion + + + + #region ENUMS + + public enum DisplayRatingComponentEmptyMode + { + NoRatings, + DoubleDash, + } + + #endregion +} \ No newline at end of file diff --git a/WatchIt.Website/WatchIt.Website/Components/Common/Subcomponents/TitledDisplayRatingComponent.razor b/WatchIt.Website/WatchIt.Website/Components/Common/Subcomponents/TitledDisplayRatingComponent.razor new file mode 100644 index 0000000..6eb08a6 --- /dev/null +++ b/WatchIt.Website/WatchIt.Website/Components/Common/Subcomponents/TitledDisplayRatingComponent.razor @@ -0,0 +1,10 @@ +
+
+
+ @(Title) +
+
+ +
+
+
\ No newline at end of file diff --git a/WatchIt.Website/WatchIt.Website/Components/Common/Subcomponents/TitledDisplayRatingComponent.razor.cs b/WatchIt.Website/WatchIt.Website/Components/Common/Subcomponents/TitledDisplayRatingComponent.razor.cs new file mode 100644 index 0000000..937e658 --- /dev/null +++ b/WatchIt.Website/WatchIt.Website/Components/Common/Subcomponents/TitledDisplayRatingComponent.razor.cs @@ -0,0 +1,14 @@ +using Microsoft.AspNetCore.Components; +using WatchIt.Common.Model.Rating; + +namespace WatchIt.Website.Components.Common.Subcomponents; + +public partial class TitledDisplayRatingComponent : ComponentBase +{ + #region PARAMETERS + + [Parameter] public required RatingResponse Rating { get; set; } + [Parameter] public required string Title { get; set; } + + #endregion +} \ No newline at end of file diff --git a/WatchIt.Website/WatchIt.Website/Components/Common/Subcomponents/TitledDisplayRatingComponent.razor.css b/WatchIt.Website/WatchIt.Website/Components/Common/Subcomponents/TitledDisplayRatingComponent.razor.css new file mode 100644 index 0000000..f0c49bb --- /dev/null +++ b/WatchIt.Website/WatchIt.Website/Components/Common/Subcomponents/TitledDisplayRatingComponent.razor.css @@ -0,0 +1,5 @@ +/* IDS */ + +#title { + font-size: 1.5rem; +} \ No newline at end of file diff --git a/WatchIt.Website/WatchIt.Website/Components/Pages/MediaPage/Subcomponents/RoleComponent.razor b/WatchIt.Website/WatchIt.Website/Components/Pages/MediaPage/Subcomponents/RoleComponent.razor index a05b1fd..fbef83b 100644 --- a/WatchIt.Website/WatchIt.Website/Components/Pages/MediaPage/Subcomponents/RoleComponent.razor +++ b/WatchIt.Website/WatchIt.Website/Components/Pages/MediaPage/Subcomponents/RoleComponent.razor @@ -25,28 +25,14 @@
-
+
Global rating: -
- -
- @if (_globalRating is not null) - { - @(_globalRating.Count > 0 ? _globalRating.Average : "--")/10 - if (_globalRating.Count > 0) - { - @(_globalRating.Count) - } - } - else - { -
- } -
-
+
-
+
Your rating:
@if (_user is not null) diff --git a/WatchIt.Website/WatchIt.Website/Components/Pages/PersonPage/Panels/PersonRatingPanel.razor b/WatchIt.Website/WatchIt.Website/Components/Pages/PersonPage/Panels/PersonRatingPanel.razor new file mode 100644 index 0000000..2490e0b --- /dev/null +++ b/WatchIt.Website/WatchIt.Website/Components/Pages/PersonPage/Panels/PersonRatingPanel.razor @@ -0,0 +1,17 @@ +
+
+ +
+ @if (_user is not null) + { + + } + else + { +
+

Your rating:

+ Log in to see your rating +
+ } +
+
\ No newline at end of file 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 new file mode 100644 index 0000000..2393a2c --- /dev/null +++ b/WatchIt.Website/WatchIt.Website/Components/Pages/PersonPage/Panels/PersonRatingPanel.razor.cs @@ -0,0 +1,93 @@ +using Microsoft.AspNetCore.Components; +using WatchIt.Common.Model.Rating; +using WatchIt.Website.Services.Utility.Authentication; +using WatchIt.Website.Services.WebAPI.Persons; + +namespace WatchIt.Website.Components.Pages.PersonPage.Panels; + +public partial class PersonRatingPanel : ComponentBase +{ + #region SERVICES + + [Inject] private IAuthenticationService AuthenticationService { get; set; } = default!; + [Inject] private IPersonsWebAPIService PersonsWebAPIService { get; set; } = default!; + + #endregion + + + + #region PARAMETERS + + [Parameter] public required long Id { get; set; } + [Parameter] public RatingResponse? Rating { get; set; } + + #endregion + + + + #region FIELDS + + private User? _user; + + private RatingResponse? _userRating; + + #endregion + + + + #region PUBLIC METHODS + + public async Task UpdateRating() => await Task.WhenAll(UpdateGlobalRating(), UpdateUserRating()); + + #endregion + + + + #region PRIVATE METHODS + + protected override async Task OnAfterRenderAsync(bool firstRender) + { + if (firstRender) + { + List step1Tasks = new List(1); + List endTasks = new List(2); + + // STEP 0 + step1Tasks.AddRange( + [ + Task.Run(async () => _user = await AuthenticationService.GetUserAsync()) + ]); + if (Rating is null) + { + endTasks.AddRange( + [ + UpdateGlobalRating() + ]); + } + + // STEP 1 + await Task.WhenAll(step1Tasks); + endTasks.AddRange( + [ + UpdateUserRating() + ]); + + // END + await Task.WhenAll(endTasks); + + StateHasChanged(); + } + } + + protected async Task UpdateGlobalRating() => await PersonsWebAPIService.GetPersonGlobalRating(Id, data => Rating = data); + + protected async Task UpdateUserRating() + { + if (_user is not null) + { + await PersonsWebAPIService.GetPersonUserRating(Id, _user.Id, data => _userRating = data); + } + } + + #endregion +} \ No newline at end of file diff --git a/WatchIt.Website/WatchIt.Website/Pages/DatabasePage.razor.cs b/WatchIt.Website/WatchIt.Website/Pages/DatabasePage.razor.cs index 3f9f6d9..179454a 100644 --- a/WatchIt.Website/WatchIt.Website/Pages/DatabasePage.razor.cs +++ b/WatchIt.Website/WatchIt.Website/Pages/DatabasePage.razor.cs @@ -1,4 +1,5 @@ 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; @@ -24,6 +25,8 @@ public partial class DatabasePage : ComponentBase [Parameter] public string? Type { get; set; } + [CascadingParameter] public MainLayout Layout { get; set; } + #endregion @@ -46,5 +49,16 @@ public partial class DatabasePage : ComponentBase } } + protected override void OnAfterRender(bool firstRender) + { + if (firstRender) + { + // INIT + Layout.BackgroundPhoto = null; + + StateHasChanged(); + } + } + #endregion } \ No newline at end of file diff --git a/WatchIt.Website/WatchIt.Website/Pages/MediaPage.razor b/WatchIt.Website/WatchIt.Website/Pages/MediaPage.razor index 08f47bd..ec8b3dc 100644 --- a/WatchIt.Website/WatchIt.Website/Pages/MediaPage.razor +++ b/WatchIt.Website/WatchIt.Website/Pages/MediaPage.razor @@ -41,7 +41,7 @@ else
-
+
@@ -108,13 +108,11 @@ else
-
+
-

- Global rating: @(_globalRating.Count == 0 ? "no ratings" : $"{Math.Round(_globalRating.Average, 1)}/10") -

+
diff --git a/WatchIt.Website/WatchIt.Website/Pages/PersonPage.razor b/WatchIt.Website/WatchIt.Website/Pages/PersonPage.razor index 4a1c110..b250711 100644 --- a/WatchIt.Website/WatchIt.Website/Pages/PersonPage.razor +++ b/WatchIt.Website/WatchIt.Website/Pages/PersonPage.razor @@ -1,13 +1,14 @@ @using System.Text +@using WatchIt.Website.Components.Pages.PersonPage.Panels @page "/person/{id:long}" @{ StringBuilder sb = new StringBuilder(" - WatchIt"); - if (!_loaded) { sb.Insert(0, "Loading..."); } - else if (_person is null) { sb.Insert(0, "Error"); } - else { sb.Insert(0, _person.Name); } + if (!_loaded) sb.Insert(0, "Loading..."); + else if (_person is null) sb.Insert(0, "Error"); + else sb.Insert(0, _person.Name); @(sb.ToString()) } @@ -28,6 +29,16 @@ GetPosterMethod="@(action => PersonsWebAPIService.GetPersonPhoto(_person.Id, action))"/>
+
+
+ +
+
+ +
+
} else { diff --git a/WatchIt.Website/WatchIt.Website/Pages/PersonPage.razor.cs b/WatchIt.Website/WatchIt.Website/Pages/PersonPage.razor.cs index 79886bb..12120a1 100644 --- a/WatchIt.Website/WatchIt.Website/Pages/PersonPage.razor.cs +++ b/WatchIt.Website/WatchIt.Website/Pages/PersonPage.razor.cs @@ -1,5 +1,6 @@ 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; @@ -28,6 +29,8 @@ public partial class PersonPage : ComponentBase #region FIELDS private bool _loaded; + + private PersonRatingPanel _ratingPanel = default!; private PersonResponse? _person; @@ -55,10 +58,13 @@ public partial class PersonPage : ComponentBase // STEP 1 await Task.WhenAll(step1Tasks); - endTasks.AddRange( - [ - PersonsWebAPIService.PostPersonView(Id), - ]); + if (_person is not null) + { + endTasks.AddRange( + [ + PersonsWebAPIService.PostPersonView(Id), + ]); + } // END await Task.WhenAll(endTasks); diff --git a/WatchIt.Website/WatchIt.Website/WatchIt.Website.csproj b/WatchIt.Website/WatchIt.Website/WatchIt.Website.csproj index 96dece4..b8a140b 100644 --- a/WatchIt.Website/WatchIt.Website/WatchIt.Website.csproj +++ b/WatchIt.Website/WatchIt.Website/WatchIt.Website.csproj @@ -52,7 +52,6 @@ - diff --git a/WatchIt.Website/WatchIt.Website/appsettings.json b/WatchIt.Website/WatchIt.Website/appsettings.json index 2142c32..2e65e00 100644 --- a/WatchIt.Website/WatchIt.Website/appsettings.json +++ b/WatchIt.Website/WatchIt.Website/appsettings.json @@ -101,7 +101,9 @@ "GetPersonAllActorRoles": "/{0}/roles/actor", "PostPersonActorRole": "/{0}/roles/actor", "GetPersonAllCreatorRoles": "/{0}/roles/creator", - "PostPersonCreatorRole": "/{0}/roles/creator" + "PostPersonCreatorRole": "/{0}/roles/creator", + "GetPersonGlobalRating": "/{0}/rating", + "GetPersonUserRating": "/{0}/rating/{1}" }, "Roles": { "Base": "/roles",