From 7150ae131fd2988d71fbcc6ff21d09a70c0b605f Mon Sep 17 00:00:00 2001 From: AdisakKanthawilang Date: Wed, 9 Apr 2025 13:23:10 +0700 Subject: [PATCH] check null --- src/services/rabbitmq.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/services/rabbitmq.ts b/src/services/rabbitmq.ts index 79f9ef7f..8640472c 100644 --- a/src/services/rabbitmq.ts +++ b/src/services/rabbitmq.ts @@ -130,7 +130,7 @@ async function handler(msg: amqp.ConsumeMessage): Promise { message: `ระบบทำการออกคำสั่งเลขที่ ${command.commandNo}/${command.commandYear + 543}`, payload: command, }, - { userId: user.sub }, + { userId: user.sub ?? "" }, ).catch(console.error); const path = commandTypePath(command.commandType.code); if (path == null) throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบประเภทคำสั่งนี้ในระบบ"); @@ -174,7 +174,7 @@ async function handler(msg: amqp.ConsumeMessage): Promise { message: `ระบบออกคำสั่งเลขที่ ${command.commandNo}/${command.commandYear + 543} เสร็จสิ้น`, payload: command, }, - { userId: user.sub }, + { userId: user.sub ?? "" }, ).catch(console.error); return !!result; @@ -188,7 +188,7 @@ async function handler(msg: amqp.ConsumeMessage): Promise { message: `ระบบออกคำสั่งเลขที่ ${command.commandNo}/${command.commandYear + 543} ผิดพลาด`, payload: command, }, - { userId: user.sub }, + { userId: user.sub ?? "" }, ).catch(console.error); return false; });