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