diff --git a/handlers/reports/parseExcel.handler.js b/handlers/reports/parseExcel.handler.js index 90f69ac..e957ea3 100644 --- a/handlers/reports/parseExcel.handler.js +++ b/handlers/reports/parseExcel.handler.js @@ -47,22 +47,10 @@ export default async (ctx) => { let parseResultCount = { equipments: 0, applicants: 0, executors: 0, reportsFullfilled: 0 }; - // res.res.setHeaders( - // new Headers({ - // Connection: "keep-alive", - // "Cache-Control": "no-cache", - // "Content-Type": "text/event-stream" - // }) - // ); - - // ctx.res.res.on("close", () => (isReqClosed = true)); - if (excelFilePath) { const workbook = xlsx.readFile(excelFilePath, xlsxParseOptions); const sheet = workbook.Sheets[sheetName]; - console.log(); - if (!sheet) throw new Error("Invalid reports workbook.", { cause: { statusCode: 400 } }); res.sendJson({ message: "OK" }); diff --git a/handlers/reports/statusParse.handler.js b/handlers/reports/statusParse.handler.js index 82b63fc..ceb985f 100644 --- a/handlers/reports/statusParse.handler.js +++ b/handlers/reports/statusParse.handler.js @@ -1,7 +1,13 @@ import { clients } from "#root/index.js"; import crypto from "node:crypto"; -/** @type {import("#root/http-server/types/http-server.js").HttpRouteHandler} */ +/** + * URL: /api/reports_status_parse + * Method: GET + * Description: Отправляет частями в формате JSON информацию о текущем статусе парсинга отчетов + * + * @type {import("#root/http-server/types/http-server.js").HttpRouteHandler} + */ export default (ctx) => { const { res } = ctx; const clientId = crypto.randomUUID(); diff --git a/handlers/reports/syncParsed.handler.js b/handlers/reports/syncParsed.handler.js index d86ba64..c042ad4 100644 --- a/handlers/reports/syncParsed.handler.js +++ b/handlers/reports/syncParsed.handler.js @@ -11,7 +11,13 @@ var reportItemSchema = yup.object({ executor_ids: yup.array(yup.number()).required() }); -/** @type {import("#root/http-server/types/http-server.js").HttpRouteHandler} */ +/** + * URL: /api/reports_sync + * Method: POST + * Description: Синхронизирует принятые отчеты с отчетами в БД + * + * @type {import("#root/http-server/types/http-server.js").HttpRouteHandler} + */ export default async ({ res, data }) => { const inputSchema = yup.object({ reports: yup.array(reportItemSchema).required() }).required(); @@ -19,5 +25,7 @@ export default async ({ res, data }) => { throw new BadRequestError(err.message); }); + // TODO ... + res.sendJson({ data }); };