using FastEndpoints; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using PayRollBLL.Employee; using static GB5Shared.GB5Constant.Constant; namespace PayRollSL.EndPoints.Employee { // No explicit rights-check/event-log here — matches sibling DeleteEmployee.cs, which relies // purely on AllowAnonymous() + upstream gateway auth. public class DeleteEmployeeVersion : BaseEndpoint> { private readonly IEmployeeBLL _EmployeeBLL; public DeleteEmployeeVersion(IEmployeeBLL employeeBLL) { _EmployeeBLL = employeeBLL; } public override void Configure() { Delete("/Employee/VersionDelete"); AllowAnonymous(); } public record Params( [property: FromHeader] string Login, [property: QueryParam] int EmployeeVersionId ); protected override async Task> ExecuteAsync(Params req, LoginDTO LoginDTO, CancellationToken ct) { try { var result = await _EmployeeBLL.DeleteEmployeeVersion(req.EmployeeVersionId, LoginDTO, ct); return await GB5Shared.ResponseStandard.Response.CreateSuccessResponse(result, CacheKeyLevel.NOT_REQUIRED, LoginDTO); } catch (Exception ex) { return await GB5Shared.ResponseStandard.Response .CreateExceptionError(ex, CacheKeyLevel.NOT_REQUIRED, LoginDTO, ex.Message, 500); } } } }