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