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

This commit is contained in:
Tom Butcher 2026-07-04 15:18:04 +01:00
parent 7002e5a6c1
commit 083cc95523

View File

@ -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 }
});
}
);