using FastEndpoints; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using PayRollBLL.EmployeeAttachmentImport; using static GB5Shared.GB5Constant.Constant; namespace PayRollSL.EndPoints.Employee { // GB4 parity: prs.Employee.AttachmentBulkImportAsynch — performs asynchronous bulk import // of employee attachments from the specified FileName (manifest: EMPLOYEECODE, FILENAME). public class AttachmentBulkImportAsynch : BaseEndpoint> { private readonly IEmployeeAttachmentImportBLL _employeeAttachmentImportBLL; public AttachmentBulkImportAsynch(IEmployeeAttachmentImportBLL employeeAttachmentImportBLL) { _employeeAttachmentImportBLL = employeeAttachmentImportBLL; } public override void Configure() { Post("/Employee/AttachmentBulkImportAsynch"); AllowAnonymous(); } public record AttachmentBulkImportAsynchParameters( [property: FromHeader] string Login, [property: QueryParam] string FileName, [property: QueryParam] int IsSkip ); protected override async Task> ExecuteAsync( AttachmentBulkImportAsynchParameters req, LoginDTO loginDTO, CancellationToken ct) { try { var result = await _employeeAttachmentImportBLL.AttachmentBulkImportAsynch(req.FileName, req.IsSkip, 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); } } } }