Compare commits
2 Commits
0748256ce8
...
083cc95523
| Author | SHA1 | Date | |
|---|---|---|---|
| 083cc95523 | |||
| 7002e5a6c1 |
@ -174,7 +174,9 @@ export class SocketUser {
|
||||
data.objectType,
|
||||
data.filter
|
||||
);
|
||||
callback({ success: true });
|
||||
if (typeof callback === 'function') {
|
||||
callback({ success: true });
|
||||
}
|
||||
}
|
||||
|
||||
async handleSubscribeToObjectUpdateEvent(data, callback) {
|
||||
@ -182,7 +184,9 @@ export class SocketUser {
|
||||
data._id,
|
||||
data.objectType
|
||||
);
|
||||
callback(result);
|
||||
if (typeof callback === 'function') {
|
||||
callback(result);
|
||||
}
|
||||
}
|
||||
|
||||
async handleSubscribeToObjectEventEvent(data) {
|
||||
|
||||
@ -2,6 +2,7 @@ import log4js from 'log4js';
|
||||
import _ from 'lodash';
|
||||
import { loadConfig } from '../config.js';
|
||||
import { natsServer } from '../database/nats.js';
|
||||
import { expandObjectIds } from '../database/utils.js';
|
||||
const config = loadConfig();
|
||||
|
||||
// Setup logger
|
||||
@ -155,11 +156,12 @@ export class UpdateManager {
|
||||
`${objectType}s.${id}.object`,
|
||||
this.socketClient.socketId,
|
||||
(key, value) => {
|
||||
const expandedValue = expandObjectIds(value);
|
||||
logger.trace('Object update event:', id);
|
||||
this.socketClient.socket.emit('objectUpdate', {
|
||||
_id: id,
|
||||
objectType: objectType,
|
||||
object: { ...value }
|
||||
object: { ...expandedValue }
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user