using ECPBLL.Shared.Interfaces;
using ECPSL.Shared.Parameters;
using FastEndpoints;
using GB5Shared.DTO.Framework.Login;
using GB5Shared.DTO.Framework.ResponseStandard;
using GB5Shared.FastEndPoint;
using static GB5Shared.GB5Constant.Constant;
namespace ECPSL.Shared.Endpoints.DMSLibrary;
/// BLOCKED — see IDMSLibraryBLL's doc-comment. Endpoint is wired up so the
/// route/contract exists, but currently returns a 500 with a clear NotImplementedException
/// message until a real shared document-library entity is identified.
public class GetSelectListDMSLibrary : BaseEndpoint>
{
private readonly IDMSLibraryBLL _bll;
public GetSelectListDMSLibrary(IDMSLibraryBLL bll) => _bll = bll;
public override void Configure()
{
Post("/DMSLibrary/GetSelectListDMSLibrary");
AllowAnonymous();
}
protected override string? GetCacheKey(GetSelectListDMSLibraryParameters req, LoginDTO login)
=> KeyGenerator.KeyGeneration(
req.CriteriaDTO?.SearchKeyword ?? "all",
EntityConstant.OBJECTDMSLIBRARYSELECTLIST,
CacheKeyLevel.CLIENT_LEVEL,
login);
protected override async Task> ExecuteAsync(
GetSelectListDMSLibraryParameters req, LoginDTO login, CancellationToken ct)
{
try
{
var result = await _bll.GetSelectListDMSLibraryAsync(req.CriteriaDTO?.SearchKeyword, login, ct);
return await GB5Shared.ResponseStandard.Response.CreateSuccessResponse(
result, CacheKeyLevel.CLIENT_LEVEL, login);
}
catch (Exception ex)
{
return await GB5Shared.ResponseStandard.Response.CreateExceptionError(
ex, CacheKeyLevel.CLIENT_LEVEL, login, ex.Message, 500);
}
}
}