using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using xCommons.Attributes; using xCommons.Extensions; using xIdentityHelper; using xIdentityModels.Dtos; using xModels.Dtos; using static IdentityServer4.IdentityServerConstants; namespace xIds.Controllers { /// /// Actions which related to Search and Suggest Users for /// Friendship or Detecting ... /// public partial class AccountController { // #region Actions of Search ... /// /// Query Open To Search Users Profiles ... /// Query all Users Which their Profiles is Open To Search ... /// /// how to filter results based on XQuery structure /// an instance of XQueryResult of XUserProfileDto [RequireXPowered] [HttpGet("OpenToSearch/Query")] [Authorize(Policy = LocalApi.PolicyName)] [Authorize(Policy = XPolicies.EnabledUser)] public async Task>> QueryOpenToSearchProfiles( [FromQuery] XQuery query) { // // Do Action ... try { // var userId = User.Identity.Name; // var result = await IdentityManager.QueryOpenToSearchUsers( userId, query ); return Ok(result .ToDynamicObject()); } catch (Exception ex) { // var exception = GetExceptionActionResult(ex); return exception; } } #endregion } }