using FastEndpoints; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using IDMSBLL.Interfaces; using IDMSDAL.DTOs; using static GB5Shared.GB5Constant.Constant; namespace IDMSSL.Endpoints.Rework; public class SaveReworkItem : BaseEndpoint> { private readonly IReworkBLL _ReworkBLL; public SaveReworkItem(IReworkBLL reworkBLL) => _ReworkBLL = reworkBLL; public override void Configure() { Post("/IDMS/Rework/SaveReworkItem"); AllowAnonymous(); } public record Params( [property: FromHeader] string Login, [property: FromBody] ReworkDTO ReworkDTO ); protected override string? GetCacheKey(Params req, LoginDTO loginDTO) => null; protected override async Task> ExecuteAsync(Params req, LoginDTO loginDTO, CancellationToken ct) { var result = await _ReworkBLL.SaveReworkAsync(req.ReworkDTO, loginDTO, ct); return await GB5Shared.ResponseStandard.Response.CreateSuccessResponse(result, CacheKeyLevel.CLIENT_LEVEL, loginDTO); } }