Compare commits

..

2 Commits

2 changed files with 9 additions and 3 deletions

View File

@ -174,7 +174,9 @@ export class SocketUser {
data.objectType, data.objectType,
data.filter data.filter
); );
callback({ success: true }); if (typeof callback === 'function') {
callback({ success: true });
}
} }
async handleSubscribeToObjectUpdateEvent(data, callback) { async handleSubscribeToObjectUpdateEvent(data, callback) {
@ -182,7 +184,9 @@ export class SocketUser {
data._id, data._id,
data.objectType data.objectType
); );
callback(result); if (typeof callback === 'function') {
callback(result);
}
} }
async handleSubscribeToObjectEventEvent(data) { async handleSubscribeToObjectEventEvent(data) {

View File

@ -2,6 +2,7 @@ import log4js from 'log4js';
import _ from 'lodash'; import _ from 'lodash';
import { loadConfig } from '../config.js'; import { loadConfig } from '../config.js';
import { natsServer } from '../database/nats.js'; import { natsServer } from '../database/nats.js';
import { expandObjectIds } from '../database/utils.js';
const config = loadConfig(); const config = loadConfig();
// Setup logger // Setup logger
@ -155,11 +156,12 @@ export class UpdateManager {
`${objectType}s.${id}.object`, `${objectType}s.${id}.object`,
this.socketClient.socketId, this.socketClient.socketId,
(key, value) => { (key, value) => {
const expandedValue = expandObjectIds(value);
logger.trace('Object update event:', id); logger.trace('Object update event:', id);
this.socketClient.socket.emit('objectUpdate', { this.socketClient.socket.emit('objectUpdate', {
_id: id, _id: id,
objectType: objectType, objectType: objectType,
object: { ...value } object: { ...expandedValue }
}); });
} }
); );