final dev

This commit is contained in:
2026-03-11 12:27:01 +00:00
parent 5e6ec13c06
commit 6591c33caa
5 changed files with 118 additions and 20 deletions

View File

@@ -53,4 +53,17 @@ router.post(
})
);
router.post(
'/activities/clear-recent',
asyncHandler(async (req, res) => {
logger.info('post:runtime:activities:clear-recent', { reqId: req.reqId });
const result = runtimeActivityService.clearRecent();
res.json({
ok: true,
removed: Number(result?.removed || 0),
snapshot: result?.snapshot || runtimeActivityService.getSnapshot()
});
})
);
module.exports = router;

View File

@@ -183,6 +183,19 @@ class RuntimeActivityService {
return this.buildSnapshot();
}
clearRecent() {
const removed = this.recent.length;
if (removed === 0) {
return { removed: 0, snapshot: this.buildSnapshot() };
}
this.recent = [];
this.broadcastSnapshot();
return {
removed,
snapshot: this.buildSnapshot()
};
}
setControls(activityId, handlers = {}) {
const id = normalizeNumber(activityId);
if (!id || !this.active.has(id)) {