This commit is contained in:
Sergey Yarkov 2026-03-04 15:37:16 +03:00
parent 821ee79873
commit 9e7daddf51
3 changed files with 16 additions and 14 deletions

View File

@ -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" });

View File

@ -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();

View File

@ -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 });
};