final dev
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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)) {
|
||||
|
||||
Reference in New Issue
Block a user