Initial ...
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
using System;
|
||||
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;
|
||||
|
||||
namespace xApi.Controllers
|
||||
{
|
||||
public partial class AccountController
|
||||
{
|
||||
//
|
||||
#region Actions ...
|
||||
/// <summary>
|
||||
/// Query Open To Search Users Profiles ...
|
||||
/// Query all Users Which their Profiles is Open To Search ...
|
||||
/// </summary>
|
||||
/// <param name="query">how to filter results based on <see>XQuery</see> structure</param>
|
||||
/// <returns>an instance of <see>XQueryResult</see> of <see>XUserProfileDto</see></returns>
|
||||
[RequireXPowered]
|
||||
[HttpGet("OpenToSearch/Query")]
|
||||
[Authorize(Policy = XPolicies.EnabledUser)]
|
||||
public async Task<ActionResult<XQueryResult<XUserProfileDto>>> QueryOpenToSearchProfiles(
|
||||
[FromQuery] XQuery query
|
||||
)
|
||||
{
|
||||
//
|
||||
// Do Action ...
|
||||
try
|
||||
{
|
||||
//
|
||||
var tokens = await RetrieveTokensAsXTokenResponse();
|
||||
var result = await identityProvider.QueryOpenToSearchUsers(
|
||||
tokens,
|
||||
query
|
||||
);
|
||||
|
||||
//
|
||||
return Ok(result
|
||||
.ToDynamicObject());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
//
|
||||
var exception = GetExceptionActionResult(ex);
|
||||
return exception;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user