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.Rework; public class GetReworkRegister : BaseEndpoint> { private readonly IReworkBLL _ReworkBLL; public GetReworkRegister(IReworkBLL reworkBLL) => _ReworkBLL = reworkBLL; public override void Configure() { Get("/IDMS/Rework/GetReworkRegister"); 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.OBJECTIDMSREWORK, CacheKeyLevel.NOT_REQUIRED, loginDTO); protected override async Task> ExecuteAsync(Params req, LoginDTO loginDTO, CancellationToken ct) { var result = await _ReworkBLL.GetReworkByEngagementAsync(req.EngagementId, loginDTO, ct); return await GB5Shared.ResponseStandard.Response.CreateSuccessResponse(result, CacheKeyLevel.NOT_REQUIRED, loginDTO); } }