This commit is contained in:
2020-11-17 00:52:44 +00:00
parent 84a8a643e7
commit a07a55c90a
3 changed files with 85 additions and 0 deletions

View File

@@ -319,6 +319,33 @@ namespace AyaNova.Api.Controllers
return Ok(ApiOkResponse.Response(ret));
}
/// <summary>
/// Get list of Customer Contact Users
/// (Rights to Customer object required)
/// </summary>
/// <returns>Customer contact users</returns>
[HttpGet("customer-contacts/{customerId}")]
public async Task<IActionResult> GetClientContactList(long customerId)
{
if (!serverState.IsOpen)
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
if (!Authorized.HasReadFullRole(HttpContext.Items, AyaType.Customer))
return StatusCode(403, new ApiNotAuthorizedResponse());
var ret = await ct.User.Where(z => z.UserType == UserType.Customer && z.CustomerId==customerId).Select(z => new dtUser
{
Id = z.Id,
Active = z.Active,
Name = z.Name,
UserType = z.UserType,
LastLogin = z.LastLogin
}).ToListAsync();
return Ok(ApiOkResponse.Response(ret));
}
/// <summary>
/// Fetch user type (inside meaning staff or subcontractor or outside meaning customer or headoffice type user)