save profile salary

This commit is contained in:
kittapath 2025-01-08 14:15:28 +07:00
parent 3a0fc39397
commit 479e9a3938
14 changed files with 817 additions and 129 deletions

View file

@ -24,10 +24,10 @@ export async function init() {
const channel = await connection.createChannel(); //----> (1.4) create Channel
console.log(channel ? "[AMQ] Create channel success" : "[AMQ] Create channel failed");
channel.assertQueue(queue, { durable: true }), //----> (1.5) assert queue and set durable (if "true" save to disk on RabbitMQ)
channel.assertQueue(queue_org, { durable: true }),
channel.prefetch(1)
channel.assertQueue(queue_org, { durable: true }),
channel.prefetch(1);
sendToQueue = (payload: any, persistent = true) => {
//----> (2) sendQueue To RabbitMQ and set persistent (if "true" redo the failed queue when server run again)
@ -42,7 +42,7 @@ export async function init() {
console.log("[AMQ] Listening for message...");
createConsumer(queue, channel, handler), //----> (3) Process Consumer
createConsumer(queue_org, channel, handler_org)
createConsumer(queue_org, channel, handler_org);
// createConsumer(queue2, channel, handler2);
}
@ -82,7 +82,7 @@ async function handler(msg: amqp.ConsumeMessage): Promise<boolean> {
const path = commandTypePath(command.commandType.code);
if (path == null) throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบประเภทคำสั่งนี้ในระบบ");
return await new CallAPI()
.PostData(
{
headers: { authorization: token },
@ -102,6 +102,8 @@ async function handler(msg: amqp.ConsumeMessage): Promise<boolean> {
amountSpecial: x.amountSpecial,
positionSalaryAmount: x.positionSalaryAmount,
mouthSalaryAmount: x.mouthSalaryAmount,
refCommandCode: command.commandType.refCommandCode,
refCommandName: command.commandType.name,
})),
},
false,