feat(base): emit formula-related WS events

This commit is contained in:
Philipinho
2026-04-24 00:27:52 +01:00
parent e729e77bda
commit 230c4e35f0
@@ -3,6 +3,8 @@ import { OnEvent } from '@nestjs/event-emitter';
import { EventName } from '../../../common/events/event.contants';
import { BaseWsService } from './base-ws.service';
import {
BaseFormulaRecomputeCompletedEvent,
BaseFormulaRecomputeStartedEvent,
BasePropertyCreatedEvent,
BasePropertyDeletedEvent,
BasePropertyReorderedEvent,
@@ -10,6 +12,7 @@ import {
BaseRowCreatedEvent,
BaseRowDeletedEvent,
BaseRowsDeletedEvent,
BaseRowsUpdatedEvent,
BaseRowReorderedEvent,
BaseRowUpdatedEvent,
BaseSchemaBumpedEvent,
@@ -174,4 +177,40 @@ export class BaseWsConsumers {
schemaVersion: e.schemaVersion,
});
}
@OnEvent(EventName.BASE_ROWS_UPDATED)
onRowsUpdated(e: BaseRowsUpdatedEvent) {
this.ws.emitToBase(e.baseId, {
operation: 'base:rows:updated',
baseId: e.baseId,
rowIds: e.rowIds,
propertyIds: e.propertyIds,
actorId: e.actorId ?? null,
requestId: e.requestId ?? null,
});
}
@OnEvent(EventName.BASE_FORMULA_RECOMPUTE_STARTED)
onFormulaRecomputeStarted(e: BaseFormulaRecomputeStartedEvent) {
this.ws.emitToBase(e.baseId, {
operation: 'base:formula:recompute:started',
baseId: e.baseId,
propertyIds: e.propertyIds,
jobId: e.jobId,
actorId: e.actorId ?? null,
});
}
@OnEvent(EventName.BASE_FORMULA_RECOMPUTE_COMPLETED)
onFormulaRecomputeCompleted(e: BaseFormulaRecomputeCompletedEvent) {
this.ws.emitToBase(e.baseId, {
operation: 'base:formula:recompute:completed',
baseId: e.baseId,
propertyIds: e.propertyIds,
jobId: e.jobId,
processed: e.processed,
errored: e.errored,
actorId: e.actorId ?? null,
});
}
}