mirror of
https://github.com/docmost/docmost.git
synced 2026-07-24 21:52:54 +10:00
feat(base): emit formula-related WS events
This commit is contained in:
@@ -3,6 +3,8 @@ import { OnEvent } from '@nestjs/event-emitter';
|
|||||||
import { EventName } from '../../../common/events/event.contants';
|
import { EventName } from '../../../common/events/event.contants';
|
||||||
import { BaseWsService } from './base-ws.service';
|
import { BaseWsService } from './base-ws.service';
|
||||||
import {
|
import {
|
||||||
|
BaseFormulaRecomputeCompletedEvent,
|
||||||
|
BaseFormulaRecomputeStartedEvent,
|
||||||
BasePropertyCreatedEvent,
|
BasePropertyCreatedEvent,
|
||||||
BasePropertyDeletedEvent,
|
BasePropertyDeletedEvent,
|
||||||
BasePropertyReorderedEvent,
|
BasePropertyReorderedEvent,
|
||||||
@@ -10,6 +12,7 @@ import {
|
|||||||
BaseRowCreatedEvent,
|
BaseRowCreatedEvent,
|
||||||
BaseRowDeletedEvent,
|
BaseRowDeletedEvent,
|
||||||
BaseRowsDeletedEvent,
|
BaseRowsDeletedEvent,
|
||||||
|
BaseRowsUpdatedEvent,
|
||||||
BaseRowReorderedEvent,
|
BaseRowReorderedEvent,
|
||||||
BaseRowUpdatedEvent,
|
BaseRowUpdatedEvent,
|
||||||
BaseSchemaBumpedEvent,
|
BaseSchemaBumpedEvent,
|
||||||
@@ -174,4 +177,40 @@ export class BaseWsConsumers {
|
|||||||
schemaVersion: e.schemaVersion,
|
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,
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user