using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using IceImportBLL.IceMapFtpSource; using IceImportSL.Parameters.FtpSource; using static GB5Shared.GB5Constant.Constant; namespace IceImportSL.Endpoints.FtpSource; // Returns the raw MICEMAPFTPSOURCE row (MicemapFtpSourceDTO) — *VaultRef fields only, never a // resolved secret. Safe to render in an admin config screen or Swagger as-is. public class GetIceMapFtpSource : BaseEndpoint> { private readonly IIceMapFtpSourceBLL _bll; public GetIceMapFtpSource(IIceMapFtpSourceBLL bll) => _bll = bll; public override void Configure() { Get("/IceImport/GetIceMapFtpSource"); AllowAnonymous(); } // Config data is small and infrequently read — but changes should be visible on the very next // read after a save with no propagation delay (this is an admin config screen, not a hot list // endpoint), so skip caching entirely rather than reason about invalidation for a table this // rarely-read. protected override string? GetCacheKey(GetIceMapFtpSourceParameters req, LoginDTO login) => null; protected override async Task> ExecuteAsync( GetIceMapFtpSourceParameters req, LoginDTO login, CancellationToken ct) { try { var result = await _bll.GetAsync(req.IceMapId, login, ct).ConfigureAwait(false); return await GB5Shared.ResponseStandard.Response.CreateSuccessResponse( result, CacheKeyLevel.NOT_REQUIRED, login); } catch (Exception ex) { return await GB5Shared.ResponseStandard.Response.CreateExceptionError( ex, CacheKeyLevel.NOT_REQUIRED, login, ex.Message, 500); } } }