using FastEndpoints;
using FrameworkBLL.MetaReport;
using GB5Shared.DTO.Framework.Login;
using GB5Shared.DTO.Framework.ResponseStandard;
using GB5Shared.FastEndPoint;
using static GB5Shared.GB5Constant.Constant;
namespace FrameworkSL.Endpoints.MetaReport
{
/// Lightweight index for the MetaReport list/authoring screen — no Variants/Aspects.
public class GetMetaReportList : BaseEndpoint>
{
private readonly IMetaReportBLL _metaReportBLL;
public GetMetaReportList(IMetaReportBLL metaReportBLL) => _metaReportBLL = metaReportBLL;
public override void Configure()
{
Get("/MetaReport/GetMetaReportList");
AllowAnonymous();
}
public record GetMetaReportListParameters([property: FromHeader] string Login);
protected override string? GetCacheKey(GetMetaReportListParameters req, LoginDTO loginDTO)
=> KeyGenerator.KeyGeneration("ALL", EntityConstant.OBJECTMETAREPORT, CacheKeyLevel.CLIENT_LEVEL, loginDTO);
protected override async Task> ExecuteAsync(
GetMetaReportListParameters req, LoginDTO loginDTO, CancellationToken ct)
{
var result = await _metaReportBLL.GetMetaReportList(loginDTO, ct);
return await GB5Shared.ResponseStandard.Response.CreateSuccessResponse(result, CacheKeyLevel.CLIENT_LEVEL, loginDTO);
}
}
}