using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.DTO.PubSub; using GB5Shared.FastEndPoint; using PayRollBLL.Calendar; using PayRollBLL.PayProduction; using PayRollDAL.DTO.PayProduction; using PayRollSL.EndPoints.PayProduction; using static GB5Shared.GB5Constant.Constant; namespace PayRollSL.EndPoints.Calendar { public class GetCalendarInfo : BaseEndpoint { private readonly ICalendarBLL _calendarBLL; public GetCalendarInfo(ICalendarBLL ICalendarBLL) { _calendarBLL = ICalendarBLL; } public override void Configure() { Get("/Calendar/GetCalendarInfo"); AllowAnonymous(); } protected override async Task> ExecuteAsync(GetCalendarInfoParameters req, LoginDTO LoginDTO, CancellationToken ct) { try { var Result = await _calendarBLL.GetCalendarInfo( req.EmployeeId, req.EmployeeLevel, req.FromDate, req.ToDate, req.ShowAllEmployees, 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); } } public record GetCalendarInfoParameters( [property: FastEndpoints.QueryParam] int EmployeeId, [property: FastEndpoints.QueryParam] int EmployeeLevel, [property: FastEndpoints.QueryParam] string FromDate, [property: FastEndpoints.QueryParam] string ToDate, [property: FastEndpoints.QueryParam] bool ShowAllEmployees, [property: FastEndpoints.FromHeader] LoginDTO Login ); } }