using FastEndpoints; using FrameworkBLL.UserLogin; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using static GB5Shared.GB5Constant.Constant; namespace FrameworkSL.Endpoints.UserLogin { /// /// Returns the list of currently active logged-in users from MSESSIONSTORE. /// GB4 equivalent: GET /fws/Synchronization.svc/GetLogedInUsersforDashboard/?Type={Type} /// public class GetLoggedInUsersForDashboard : BaseEndpoint> { private readonly ILoggedInUsersBLL _bll; public GetLoggedInUsersForDashboard(ILoggedInUsersBLL bll) => _bll = bll; public override void Configure() { Get("/UserLogin/GetLoggedInUsersForDashboard"); AllowAnonymous(); } public record Parameters( [property: QueryParam] int Type, [property: FromHeader] string Login); protected override async Task> ExecuteAsync( Parameters req, LoginDTO loginDTO, CancellationToken ct) { try { var result = await _bll.GetLoggedInUsersForDashboardAsync(loginDTO, req.Type, ct); return await GB5Shared.ResponseStandard.Response.CreateSuccessResponse( result, CacheKeyLevel.NOT_REQUIRED, loginDTO); } catch (Exception ex) { return await GB5Shared.ResponseStandard.Response.CreateExceptionError( ex, CacheKeyLevel.NOT_REQUIRED, loginDTO, ex.Message, 500); } } } }