Merge pull request #152 from mateuszskoczek/features/user_search
Features/user search
This commit is contained in:
@@ -0,0 +1,67 @@
|
|||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using WatchIt.Common.Query;
|
||||||
|
|
||||||
|
namespace WatchIt.Common.Model.Accounts;
|
||||||
|
|
||||||
|
public class AccountQueryParameters : QueryParameters<AccountResponse>
|
||||||
|
{
|
||||||
|
#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
|
||||||
|
}
|
||||||
@@ -1,13 +1,28 @@
|
|||||||
using System.Diagnostics.CodeAnalysis;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
using WatchIt.Common.Model.Genders;
|
using WatchIt.Common.Model.Genders;
|
||||||
|
using WatchIt.Common.Query;
|
||||||
|
|
||||||
namespace WatchIt.Common.Model.Accounts;
|
namespace WatchIt.Common.Model.Accounts;
|
||||||
|
|
||||||
public class AccountResponse : Account
|
public class AccountResponse : Account, IQueryOrderable<AccountResponse>
|
||||||
{
|
{
|
||||||
#region PROPERTIES
|
#region PROPERTIES
|
||||||
|
|
||||||
|
[JsonIgnore]
|
||||||
|
public static IDictionary<string, Func<AccountResponse, IComparable>> OrderableProperties { get; } = new Dictionary<string, Func<AccountResponse, IComparable>>
|
||||||
|
{
|
||||||
|
{ "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")]
|
[JsonPropertyName("id")]
|
||||||
public required long Id { get; set; }
|
public required long Id { get; set; }
|
||||||
|
|
||||||
|
|||||||
@@ -94,11 +94,16 @@ public class AccountsController(IAccountsControllerService accountsControllerSer
|
|||||||
|
|
||||||
#region Info
|
#region Info
|
||||||
|
|
||||||
[HttpGet("{id}/info")]
|
[HttpGet]
|
||||||
|
[AllowAnonymous]
|
||||||
|
[ProducesResponseType(typeof(IEnumerable<AccountResponse>), StatusCodes.Status200OK)]
|
||||||
|
public async Task<ActionResult> GetAccounts(AccountQueryParameters query) => await accountsControllerService.GetAccounts(query);
|
||||||
|
|
||||||
|
[HttpGet("{id}")]
|
||||||
[AllowAnonymous]
|
[AllowAnonymous]
|
||||||
[ProducesResponseType(typeof(AccountResponse), StatusCodes.Status200OK)]
|
[ProducesResponseType(typeof(AccountResponse), StatusCodes.Status200OK)]
|
||||||
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||||
public async Task<ActionResult> GetAccountInfo([FromRoute]long id) => await accountsControllerService.GetAccountInfo(id);
|
public async Task<ActionResult> GetAccount([FromRoute]long id) => await accountsControllerService.GetAccount(id);
|
||||||
|
|
||||||
[HttpPut("profile_info")]
|
[HttpPut("profile_info")]
|
||||||
[Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme)]
|
[Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme)]
|
||||||
|
|||||||
@@ -238,7 +238,15 @@ public class AccountsControllerService(
|
|||||||
|
|
||||||
#region Info
|
#region Info
|
||||||
|
|
||||||
public async Task<RequestResult> GetAccountInfo(long id)
|
public async Task<RequestResult> GetAccounts(AccountQueryParameters query)
|
||||||
|
{
|
||||||
|
IEnumerable<Account> accounts = await database.Accounts.ToListAsync();
|
||||||
|
IEnumerable<AccountResponse> accountsData = accounts.Select(x => new AccountResponse(x));
|
||||||
|
accountsData = query.PrepareData(accountsData);
|
||||||
|
return RequestResult.Ok(accountsData);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<RequestResult> GetAccount(long id)
|
||||||
{
|
{
|
||||||
Account? account = await database.Accounts.FirstOrDefaultAsync(x => x.Id == id);
|
Account? account = await database.Accounts.FirstOrDefaultAsync(x => x.Id == id);
|
||||||
if (account is null)
|
if (account is null)
|
||||||
|
|||||||
@@ -19,7 +19,8 @@ public interface IAccountsControllerService
|
|||||||
Task<RequestResult> GetAccountProfileBackground(long id);
|
Task<RequestResult> GetAccountProfileBackground(long id);
|
||||||
Task<RequestResult> PutAccountProfileBackground(AccountProfileBackgroundRequest data);
|
Task<RequestResult> PutAccountProfileBackground(AccountProfileBackgroundRequest data);
|
||||||
Task<RequestResult> DeleteAccountProfileBackground();
|
Task<RequestResult> DeleteAccountProfileBackground();
|
||||||
Task<RequestResult> GetAccountInfo(long id);
|
Task<RequestResult> GetAccounts(AccountQueryParameters query);
|
||||||
|
Task<RequestResult> GetAccount(long id);
|
||||||
Task<RequestResult> PutAccountProfileInfo(AccountProfileInfoRequest data);
|
Task<RequestResult> PutAccountProfileInfo(AccountProfileInfoRequest data);
|
||||||
Task<RequestResult> PatchAccountUsername(AccountUsernameRequest data);
|
Task<RequestResult> PatchAccountUsername(AccountUsernameRequest data);
|
||||||
Task<RequestResult> PatchAccountEmail(AccountEmailRequest data);
|
Task<RequestResult> PatchAccountEmail(AccountEmailRequest data);
|
||||||
|
|||||||
@@ -150,9 +150,22 @@ public class AccountsClientService(IHttpClientService httpClientService, IConfig
|
|||||||
.ExecuteAction();
|
.ExecuteAction();
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task GetAccountInfo(long id, Action<AccountResponse>? successAction = null, Action? notFoundAction = null)
|
public async Task GetAccounts(AccountQueryParameters query, Action<IEnumerable<AccountResponse>>? successAction = null)
|
||||||
{
|
{
|
||||||
string url = GetUrl(EndpointsConfiguration.Accounts.GetAccountInfo, id);
|
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<AccountResponse>? successAction = null, Action? notFoundAction = null)
|
||||||
|
{
|
||||||
|
string url = GetUrl(EndpointsConfiguration.Accounts.GetAccount, id);
|
||||||
HttpRequest request = new HttpRequest(HttpMethodType.Get, url);
|
HttpRequest request = new HttpRequest(HttpMethodType.Get, url);
|
||||||
|
|
||||||
HttpResponse response = await httpClientService.SendRequestAsync(request);
|
HttpResponse response = await httpClientService.SendRequestAsync(request);
|
||||||
|
|||||||
@@ -18,7 +18,8 @@ public interface IAccountsClientService
|
|||||||
Task GetAccountProfileBackground(long id, Action<PhotoResponse>? successAction = null, Action<IDictionary<string, string[]>>? badRequestAction = null, Action? notFoundAction = null);
|
Task GetAccountProfileBackground(long id, Action<PhotoResponse>? successAction = null, Action<IDictionary<string, string[]>>? badRequestAction = null, Action? notFoundAction = null);
|
||||||
Task PutAccountProfileBackground(AccountProfileBackgroundRequest data, Action<PhotoResponse>? successAction = null, Action<IDictionary<string, string[]>>? badRequestAction = null, Action? unauthorizedAction = null);
|
Task PutAccountProfileBackground(AccountProfileBackgroundRequest data, Action<PhotoResponse>? successAction = null, Action<IDictionary<string, string[]>>? badRequestAction = null, Action? unauthorizedAction = null);
|
||||||
Task DeleteAccountProfileBackground(Action? successAction = null, Action? unauthorizedAction = null);
|
Task DeleteAccountProfileBackground(Action? successAction = null, Action? unauthorizedAction = null);
|
||||||
Task GetAccountInfo(long id, Action<AccountResponse>? successAction = null, Action? notFoundAction = null);
|
Task GetAccounts(AccountQueryParameters query, Action<IEnumerable<AccountResponse>>? successAction = null);
|
||||||
|
Task GetAccount(long id, Action<AccountResponse>? successAction = null, Action? notFoundAction = null);
|
||||||
Task PutAccountProfileInfo(AccountProfileInfoRequest data, Action? successAction = null, Action<IDictionary<string, string[]>>? badRequestAction = null, Action? unauthorizedAction = null);
|
Task PutAccountProfileInfo(AccountProfileInfoRequest data, Action? successAction = null, Action<IDictionary<string, string[]>>? badRequestAction = null, Action? unauthorizedAction = null);
|
||||||
Task PatchAccountUsername(AccountUsernameRequest data, Action? successAction = null, Action<IDictionary<string, string[]>>? badRequestAction = null, Action? unauthorizedAction = null);
|
Task PatchAccountUsername(AccountUsernameRequest data, Action? successAction = null, Action<IDictionary<string, string[]>>? badRequestAction = null, Action? unauthorizedAction = null);
|
||||||
Task PatchAccountEmail(AccountEmailRequest data, Action? successAction = null, Action<IDictionary<string, string[]>>? badRequestAction = null, Action? unauthorizedAction = null);
|
Task PatchAccountEmail(AccountEmailRequest data, Action? successAction = null, Action<IDictionary<string, string[]>>? badRequestAction = null, Action? unauthorizedAction = null);
|
||||||
|
|||||||
@@ -13,7 +13,8 @@ public class Accounts
|
|||||||
public string GetAccountProfileBackground { get; set; }
|
public string GetAccountProfileBackground { get; set; }
|
||||||
public string PutAccountProfileBackground { get; set; }
|
public string PutAccountProfileBackground { get; set; }
|
||||||
public string DeleteAccountProfileBackground { get; set; }
|
public string DeleteAccountProfileBackground { get; set; }
|
||||||
public string GetAccountInfo { get; set; }
|
public string GetAccounts { get; set; }
|
||||||
|
public string GetAccount { get; set; }
|
||||||
public string PutAccountProfileInfo { get; set; }
|
public string PutAccountProfileInfo { get; set; }
|
||||||
public string PatchAccountUsername { get; set; }
|
public string PatchAccountUsername { get; set; }
|
||||||
public string PatchAccountEmail { get; set; }
|
public string PatchAccountEmail { get; set; }
|
||||||
|
|||||||
@@ -0,0 +1,77 @@
|
|||||||
|
@using Blazorise.Extensions
|
||||||
|
@using WatchIt.Website.Components.Pages.SearchPage.Subcomponents
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<div class="panel">
|
||||||
|
<div class="container-grid">
|
||||||
|
<div class="row mb-4">
|
||||||
|
<div class="col">
|
||||||
|
<h4 class="m-0"><strong>Users</strong></h4>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@if (_loaded)
|
||||||
|
{
|
||||||
|
if (!_items.IsNullOrEmpty())
|
||||||
|
{
|
||||||
|
for (int i = 0; i < _items.Count; i++)
|
||||||
|
{
|
||||||
|
if (i > 0)
|
||||||
|
{
|
||||||
|
<div class="row">
|
||||||
|
<div class="col">
|
||||||
|
<hr/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
<div class="row">
|
||||||
|
<div class="col">
|
||||||
|
@{
|
||||||
|
int iCopy = i;
|
||||||
|
}
|
||||||
|
<UserSearchResultItemComponent Item="@(_items[iCopy])"/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
if (!_allItemsLoaded)
|
||||||
|
{
|
||||||
|
<div class="row mt-3">
|
||||||
|
<div class="col">
|
||||||
|
<div class="d-flex justify-content-center">
|
||||||
|
<button class="btn btn-secondary" @onclick="DownloadItems">
|
||||||
|
@if (!_itemsLoading)
|
||||||
|
{
|
||||||
|
<span>Load more</span>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
|
||||||
|
<span>Loading...</span>
|
||||||
|
}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<div class="row">
|
||||||
|
<div class="col">
|
||||||
|
<div class="d-flex justify-content-center">
|
||||||
|
No items found
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<div class="row">
|
||||||
|
<div class="col">
|
||||||
|
<LoadingComponent Color="@(LoadingComponent.LoadingComponentColors.Light)"/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
@@ -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<AccountResponse> _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<Task> endTasks = new List<Task>();
|
||||||
|
|
||||||
|
// 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
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
<a class="text-decoration-none text-reset" href="/user/@(Item.Id)">
|
||||||
|
<div class="d-flex align-items-center gap-4">
|
||||||
|
<AccountPictureComponent Id="@(Item.Id)"
|
||||||
|
Size="90"/>
|
||||||
|
<h4 class="fw-bold">@(Item.Username)</h4>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
@@ -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
|
||||||
|
}
|
||||||
@@ -91,7 +91,7 @@ public partial class MainLayout : LayoutComponentBase
|
|||||||
|
|
||||||
if (_user is not null)
|
if (_user is not null)
|
||||||
{
|
{
|
||||||
await AccountsClientService.GetAccountInfo(_user.Id, data => _accountData = data);
|
await AccountsClientService.GetAccount(_user.Id, data => _accountData = data);
|
||||||
}
|
}
|
||||||
|
|
||||||
_loaded = true;
|
_loaded = true;
|
||||||
@@ -121,7 +121,7 @@ public partial class MainLayout : LayoutComponentBase
|
|||||||
if (!string.IsNullOrWhiteSpace(_searchbarText))
|
if (!string.IsNullOrWhiteSpace(_searchbarText))
|
||||||
{
|
{
|
||||||
string query = WebUtility.UrlEncode(_searchbarText);
|
string query = WebUtility.UrlEncode(_searchbarText);
|
||||||
NavigationManager.NavigateTo($"/search/{query}");
|
NavigationManager.NavigateTo($"/search/{query}", true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
@using System.Net
|
||||||
@using WatchIt.Common.Model.Movies
|
@using WatchIt.Common.Model.Movies
|
||||||
@using WatchIt.Common.Model.Persons
|
@using WatchIt.Common.Model.Persons
|
||||||
@using WatchIt.Common.Model.Series
|
@using WatchIt.Common.Model.Series
|
||||||
@@ -15,7 +16,7 @@
|
|||||||
<div class="rounded-3 panel panel-regular p-3">
|
<div class="rounded-3 panel panel-regular p-3">
|
||||||
<div class="d-flex justify-content-center">
|
<div class="d-flex justify-content-center">
|
||||||
<h3 class="m-0">
|
<h3 class="m-0">
|
||||||
<strong>Search results for phrase:</strong> "@(DecodedQuery)"
|
<strong>Search results for phrase:</strong> "@(WebUtility.UrlDecode(Query))"
|
||||||
</h3>
|
</h3>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -27,7 +28,7 @@
|
|||||||
NameSource="@(item => item.Title)"
|
NameSource="@(item => item.Title)"
|
||||||
AdditionalNameInfoSource="@(item => item.ReleaseDate.HasValue ? $" ({item.ReleaseDate.Value.Year})" : null)"
|
AdditionalNameInfoSource="@(item => item.ReleaseDate.HasValue ? $" ({item.ReleaseDate.Value.Year})" : null)"
|
||||||
RatingSource="@(item => item.Rating)"
|
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)"
|
ItemDownloadingTask="@(MoviesClientService.GetAllMovies)"
|
||||||
PictureDownloadingTask="@((id, action) => MediaClientService.GetMediaPoster(id, action))"
|
PictureDownloadingTask="@((id, action) => MediaClientService.GetMediaPoster(id, action))"
|
||||||
PosterPlaceholder="/assets/media_poster.png"
|
PosterPlaceholder="/assets/media_poster.png"
|
||||||
@@ -43,7 +44,7 @@
|
|||||||
NameSource="@(item => item.Title)"
|
NameSource="@(item => item.Title)"
|
||||||
AdditionalNameInfoSource="@(item => item.ReleaseDate.HasValue ? $" ({item.ReleaseDate.Value.Year})" : null)"
|
AdditionalNameInfoSource="@(item => item.ReleaseDate.HasValue ? $" ({item.ReleaseDate.Value.Year})" : null)"
|
||||||
RatingSource="@(item => item.Rating)"
|
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)"
|
ItemDownloadingTask="@(SeriesClientService.GetAllSeries)"
|
||||||
PictureDownloadingTask="@((id, action) => MediaClientService.GetMediaPoster(id, action))"
|
PictureDownloadingTask="@((id, action) => MediaClientService.GetMediaPoster(id, action))"
|
||||||
PosterPlaceholder="/assets/media_poster.png"
|
PosterPlaceholder="/assets/media_poster.png"
|
||||||
@@ -58,9 +59,10 @@
|
|||||||
IdSource="@(item => item.Id)"
|
IdSource="@(item => item.Id)"
|
||||||
NameSource="@(item => item.Name)"
|
NameSource="@(item => item.Name)"
|
||||||
RatingSource="@(item => item.Rating)"
|
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)"
|
ItemDownloadingTask="@(PersonsClientService.GetAllPersons)"
|
||||||
PictureDownloadingTask="@((id, action) => PersonsClientService.GetPersonPhoto(id, action))"
|
PictureDownloadingTask="@((id, action) => PersonsClientService.GetPersonPhoto(id, action))"
|
||||||
PosterPlaceholder="/assets/person_poster.png"
|
PosterPlaceholder="/assets/person_poster.png"
|
||||||
GetGlobalRatingMethod="@((id, action) => PersonsClientService.GetPersonGlobalRating(id, action))"/>
|
GetGlobalRatingMethod="@((id, action) => PersonsClientService.GetPersonGlobalRating(id, action))"/>
|
||||||
|
<UsersSearchResultPanelComponent Query="@(WebUtility.UrlDecode(Query))"/>
|
||||||
</div>
|
</div>
|
||||||
@@ -58,7 +58,7 @@ public partial class UserEditPage : ComponentBase
|
|||||||
|
|
||||||
await Task.WhenAll(
|
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)
|
AccountsClientService.GetAccountProfileBackground(user.Id, data => Layout.BackgroundPhoto = data)
|
||||||
]);
|
]);
|
||||||
StateHasChanged();
|
StateHasChanged();
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ public partial class UserPage : ComponentBase
|
|||||||
Id = user.Id;
|
Id = user.Id;
|
||||||
}
|
}
|
||||||
|
|
||||||
await AccountsClientService.GetAccountInfo(Id.Value, data => _accountData = data);
|
await AccountsClientService.GetAccount(Id.Value, data => _accountData = data);
|
||||||
_owner = Id.Value == user?.Id;
|
_owner = Id.Value == user?.Id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,8 @@
|
|||||||
"GetAccountProfileBackground": "/{0}/profile_background",
|
"GetAccountProfileBackground": "/{0}/profile_background",
|
||||||
"PutAccountProfileBackground": "/profile_background",
|
"PutAccountProfileBackground": "/profile_background",
|
||||||
"DeleteAccountProfileBackground": "/profile_background",
|
"DeleteAccountProfileBackground": "/profile_background",
|
||||||
"GetAccountInfo": "/{0}/info",
|
"GetAccounts": "",
|
||||||
|
"GetAccount": "/{0}",
|
||||||
"PutAccountProfileInfo": "/profile_info",
|
"PutAccountProfileInfo": "/profile_info",
|
||||||
"PatchAccountUsername": "/username",
|
"PatchAccountUsername": "/username",
|
||||||
"PatchAccountEmail": "/email",
|
"PatchAccountEmail": "/email",
|
||||||
|
|||||||
Reference in New Issue
Block a user