using FastEndpoints; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using PayRollBLL.EmployeeReference; using static GB5Shared.GB5Constant.Constant; namespace PayRollSL.EndPoints.EmployeeReference { public class DeleteEmployeeReference : BaseEndpoint> { private readonly IEmployeeReferenceBLL _EmployeeReferenceBLL; public DeleteEmployeeReference(IEmployeeReferenceBLL IEmployeeReferenceBLL) { _EmployeeReferenceBLL = IEmployeeReferenceBLL; } public override void Configure() { Delete("/EmployeeReference/DeleteEmployeeReference"); AllowAnonymous(); } public record DeleteEmployeeReferenceParameters( [property: FromHeader] string Login, [property: QueryParam] int EmployeeId ); protected override async Task> ExecuteAsync(DeleteEmployeeReferenceParameters req, LoginDTO LoginDTO, CancellationToken ct) { try { var Result = await _EmployeeReferenceBLL.DeleteEmployeeReference(req.EmployeeId, LoginDTO!); 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); } } } }