using FastEndpoints; using FrameworkBLL.DiagnosticsSession; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using static FrameworkDAL.Constant.Constant; namespace FrameworkSL.Endpoints.DiagnosticsSession; public class GetActiveSessions : BaseEndpoint> { private readonly IDiagnosticsSessionBLL _bll; public GetActiveSessions(IDiagnosticsSessionBLL bll) => _bll = bll; public override void Configure() { Get("/DiagnosticsSession/GetActiveSessions"); AllowAnonymous(); } protected override string? GetCacheKey(Parameters req, LoginDTO login) => $"DiagnosticsSession:Active:{login.ClientId}"; protected override async Task> ExecuteAsync( Parameters req, LoginDTO login, CancellationToken ct) { var result = await _bll.GetActiveSessionsAsync(login, ct).ConfigureAwait(false); return await GB5Shared.ResponseStandard.Response.CreateSuccessResponse( result, CacheKeyLevel.UserLevel, login); } public record Parameters([property: FromHeader] string Login); }