using FastEndpoints; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using IDMSBLL.Interfaces; using static GB5Shared.GB5Constant.Constant; namespace IDMSSL.Endpoints.Engagement; public class GetEngagement : BaseEndpoint> { private readonly IEngagementBLL _EngagementBLL; public GetEngagement(IEngagementBLL engagementBLL) => _EngagementBLL = engagementBLL; public override void Configure() { Get("/IDMS/Engagement/GetEngagement"); AllowAnonymous(); } public record Params( [property: FromHeader] string Login, [property: QueryParam] int EngagementId ); protected override string? GetCacheKey(Params req, LoginDTO loginDTO) => KeyGenerator.KeyGeneration(req.EngagementId, EntityConstant.OBJECTIDMSENGAGEMENT, CacheKeyLevel.CLIENT_LEVEL, loginDTO); protected override async Task> ExecuteAsync(Params req, LoginDTO loginDTO, CancellationToken ct) { var result = await _EngagementBLL.GetEngagementAsync(req.EngagementId, loginDTO, ct); return await GB5Shared.ResponseStandard.Response.CreateSuccessResponse(result, CacheKeyLevel.CLIENT_LEVEL, loginDTO); } }