From 4ec334f0d434fb119c3f6171aef6f7ea30243eae Mon Sep 17 00:00:00 2001 From: Adisak Date: Tue, 3 Feb 2026 10:27:48 +0700 Subject: [PATCH] fix: cronjob publish fail --- src/app.ts | 2 +- src/services/rabbitmq.ts | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/app.ts b/src/app.ts index 578a8e65..75d0bfea 100644 --- a/src/app.ts +++ b/src/app.ts @@ -52,7 +52,7 @@ async function main() { const APP_HOST = process.env.APP_HOST || "0.0.0.0"; const APP_PORT = +(process.env.APP_PORT || 3000); - const cronTime = "0 0 3 * * *"; // ตั้งเวลาทุกวันเวลา 08:00:00 + const cronTime = "0 0 3 * * *"; // ตั้งเวลาทุกวันเวลา 03:00:00 // const cronTime = "*/10 * * * * *"; cron.schedule(cronTime, async () => { try { diff --git a/src/services/rabbitmq.ts b/src/services/rabbitmq.ts index 8e9f11f4..784f3873 100644 --- a/src/services/rabbitmq.ts +++ b/src/services/rabbitmq.ts @@ -708,11 +708,11 @@ async function handler_org(msg: amqp.ConsumeMessage): Promise { posMasterId: newParentId, posMasterChildId: newChildId, createdAt: new Date(), - createdFullName: user.name, - createdUserId: user.sub, + createdFullName: user ? user.name : "system", + createdUserId: user ? user.sub : "system", lastUpdatedAt: new Date(), - lastUpdateFullName: user.name, - lastUpdateUserId: user.sub, + lastUpdateFullName: user ? user.name : "system", + lastUpdateUserId: user ? user.sub : "system", }; await posMasterActRepository.save(newAct);