fix: publish system.notification.send in {pattern, data} format for NestJS RMQ

This commit is contained in:
Kyryll O. 2026-06-18 16:45:12 +03:00
parent 8209f4ac82
commit fb0bb36bdd
2 changed files with 4 additions and 8 deletions

View File

@ -1,6 +1,6 @@
{
"name": "@erp/plugin-sdk",
"version": "1.11.1",
"version": "1.11.2",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"bin": {

View File

@ -410,10 +410,9 @@ export class CoreService {
const conn = await amqp.connect(this.getRMQUrl());
const ch = await conn.createChannel();
await ch.assertExchange('system_events', 'topic', { durable: true });
const eventData = {
eventId: uuidv4(),
ch.publish('system_events', 'system.notification.send', Buffer.from(JSON.stringify({
pattern: 'system.notification.send',
payload: {
data: {
userId: payload.userId,
title: payload.title,
message: payload.message,
@ -421,10 +420,7 @@ export class CoreService {
image: payload.image,
details: payload.details,
},
source: this.serviceName,
timestamp: Date.now(),
};
ch.publish('system_events', 'system.notification.send', Buffer.from(JSON.stringify(eventData)));
})));
await ch.close();
await conn.close();
} catch (err: any) {