Integrate expandObjectIds utility in UpdateManager to enhance object update handling, ensuring expanded values are emitted in socket events.
All checks were successful
farmcontrol/farmcontrol-ws/pipeline/head This commit looks good
All checks were successful
farmcontrol/farmcontrol-ws/pipeline/head This commit looks good
This commit is contained in:
parent
7002e5a6c1
commit
083cc95523
@ -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 }
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user