This commit is contained in:
2022-11-01 19:17:17 +07:00
+43 -43
View File
@@ -60,59 +60,59 @@ app.use("/api/", cashinRoute);
if (process.env.NODE_ENV.toUpperCase() == "PRODUCTION") {
// SCHEDULER FOR GENERATE INVOICE
const {
_generateInvoice,
_postingInvoice,
} = require("../application/modules/invoiceonline/invoice.controller");
// const {
// _generateInvoice,
// _postingInvoice,
// } = require("../application/modules/invoiceonline/invoice.controller");
// every 10 minutes
// cron.schedule('*/10 * * * *', async () => {
// every at 01:00
cron.schedule("0 1 * * *", async () => {
try {
// let ivoiceDate = moment().add(1, 'days').format("YYYY-MM-DD");
let ivoiceDate = moment().format("YYYY-MM-DD");
let uniqueCode = helper.getUniqueCode();
winston.logger.debug(
`STARTING SCHEDULER-FB70 GENERATE INVOICE ${ivoiceDate} `
);
const generate = await _generateInvoice(ivoiceDate, uniqueCode, false);
winston.logger.debug(
`END SCHEDULER-FB70 GENERATE INVOICE ${ivoiceDate} : ${JSON.stringify(
generate
)}`
);
} catch (error) {
// create log
winston.logger.error(
`500 internal server error - backend server | ${error.message}`
);
}
});
// cron.schedule("0 1 * * *", async () => {
// try {
// // let ivoiceDate = moment().add(1, 'days').format("YYYY-MM-DD");
// let ivoiceDate = moment().format("YYYY-MM-DD");
// let uniqueCode = helper.getUniqueCode();
// winston.logger.debug(
// `STARTING SCHEDULER-FB70 GENERATE INVOICE ${ivoiceDate} `
// );
// const generate = await _generateInvoice(ivoiceDate, uniqueCode, false);
// winston.logger.debug(
// `END SCHEDULER-FB70 GENERATE INVOICE ${ivoiceDate} : ${JSON.stringify(
// generate
// )}`
// );
// } catch (error) {
// // create log
// winston.logger.error(
// `500 internal server error - backend server | ${error.message}`
// );
// }
// });
// every 15 minutes
// cron.schedule('*/15 * * * *', async () => {
// every 2 hour
cron.schedule("0 */2 * * *", async () => {
try {
let uniqueCode = helper.getUniqueCode();
winston.logger.debug(`STARTING SCHEDULER-FB70 POSTING INVOICE`);
const posting = await _postingInvoice(uniqueCode);
winston.logger.debug(
`END SCHEDULER-FB70 POSTING INVOICE : ${JSON.stringify(posting)}`
);
} catch (error) {
// create log
winston.logger.error(
`500 internal server error - backend server | ${error.message}`
);
}
});
// cron.schedule("0 */2 * * *", async () => {
// try {
// let uniqueCode = helper.getUniqueCode();
// winston.logger.debug(`STARTING SCHEDULER-FB70 POSTING INVOICE`);
// const posting = await _postingInvoice(uniqueCode);
// winston.logger.debug(
// `END SCHEDULER-FB70 POSTING INVOICE : ${JSON.stringify(posting)}`
// );
// } catch (error) {
// // create log
// winston.logger.error(
// `500 internal server error - backend server | ${error.message}`
// );
// }
// });
}
// cash in
const {
_generateCashIn,
} = require("../application/modules/cashin/cahsin.controller");
// const {
// _generateCashIn,
// } = require("../application/modules/cashin/cahsin.controller");
// cron.schedule('* * * * *', async () => {
// try {