using FastEndpoints; using FrameworkBLL.Lock; using FrameworkDAL.DTO.Lock; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using static GB5Shared.GB5Constant.Constant; namespace FrameworkSL.Endpoints.Lock { // GB4 parity: Lock.svc/Generic/Lock/Validate/?LockId={LockId} (GenericLockValidate). // Text/log output only — GenericLockCriteriaDTO.IsExcelOutput = 0 (Excel export) is not // yet migrated and returns a controlled 400 rather than a silent wrong response. public class GenericLockValidate : BaseEndpoint> { private readonly ILockBLL _LockBLL; public GenericLockValidate(ILockBLL LockBLL) => _LockBLL = LockBLL; public override void Configure() { Post("/Lock/GenericLockValidate"); AllowAnonymous(); } public record Parameters( [property: FromHeader] string Login, [property: QueryParam] int LockId, [property: FromBody] GenericLockCriteriaDTO GenericLockCriteriaDTO ); protected override string? GetCacheKey(Parameters req, LoginDTO login) => null; protected override async Task> ExecuteAsync( Parameters req, LoginDTO LoginDTO, CancellationToken ct) { var result = await _LockBLL.GenericLockValidate(req.LockId, req.GenericLockCriteriaDTO, LoginDTO, ct); return await GB5Shared.ResponseStandard.Response.CreateSuccessResponse( result, CacheKeyLevel.NOT_REQUIRED, LoginDTO); } } }