Files
ts-etl-tat/build/lib_order.js
2024-07-25 12:38:41 +07:00

31 lines
1.2 KiB
JavaScript

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.get_order = void 0;
const axios_1 = __importDefault(require("axios"));
const config_1 = __importDefault(require("./config/config"));
const logging_1 = __importDefault(require("./config/logging"));
const server_1 = require("./server");
const get_order = async (row_per_batch) => {
const url_patient = config_1.default.base_url + "/etl/getorder/getdata?limit=" + row_per_batch;
logging_1.default.info(server_1.NAME_SPACE, "Info : " + url_patient);
try {
const resp = await axios_1.default.get(url_patient, {
responseType: "arraybuffer",
});
const jresp = JSON.parse(resp.data.toString());
return jresp;
}
catch (e) {
if (axios_1.default.isAxiosError(e)) {
logging_1.default.error(server_1.NAME_SPACE, e.response?.data.toString());
}
else if (e instanceof Error) {
logging_1.default.error(server_1.NAME_SPACE, e.message);
}
}
};
exports.get_order = get_order;