44 lines
1.3 KiB
C#
44 lines
1.3 KiB
C#
using _0_Framework.Application;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using ServiceHost.BaseControllers;
|
|
|
|
namespace ServiceHost.Areas.Client.Controllers;
|
|
|
|
public record GetClientProfileDetails(long Id, string Fullname, string Mobile, List<int> Permissions,List<WorkshopClaim> Workshops);
|
|
|
|
public class LoginController: ClientBaseController
|
|
{
|
|
private readonly IAuthHelper _authHelper;
|
|
|
|
public LoginController(IAuthHelper authHelper)
|
|
{
|
|
_authHelper = authHelper;
|
|
}
|
|
/// <summary>
|
|
/// جزئیات پروفایل کاربر کلاینت را برمی گرداند
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
[HttpGet("Profile")]
|
|
public ActionResult<GetClientProfileDetails> GetProfile()
|
|
{
|
|
if (!_authHelper.IsAuthenticated())
|
|
return Unauthorized();
|
|
var data = _authHelper.CurrentAccountInfo();
|
|
|
|
if (data == null )
|
|
return Unauthorized();
|
|
|
|
if (_authHelper.GetUserTypeWithId().userType is not UserType.Client and not UserType.SubAccount)
|
|
return Unauthorized();
|
|
|
|
|
|
var details = new GetClientProfileDetails(
|
|
data.Id,
|
|
data.Fullname,
|
|
data.Mobile,
|
|
data.Permissions,
|
|
data.WorkshopList
|
|
);
|
|
return details;
|
|
}
|
|
} |