From 49b4ed94f6e261a1b86d410feeac9753f30c4ec8 Mon Sep 17 00:00:00 2001 From: marlon-erler Date: Mon, 8 Jul 2024 19:51:56 +0200 Subject: [PATCH] add expiry date to mailbox --- subscriptionHandler.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/subscriptionHandler.ts b/subscriptionHandler.ts index 4a08c91..cf5e992 100644 --- a/subscriptionHandler.ts +++ b/subscriptionHandler.ts @@ -8,8 +8,15 @@ export interface Subscriber { export class Mailbox implements Subscriber { // basic id = Crypto.randomUUID(); + dateLastChecked = new Date(); messages = new Set(); + get expiryDate() { + const expiryDate = new Date(this.dateLastChecked); + expiryDate.setDate(expiryDate.getDate() + 7); + return expiryDate; + } + // websocket _ws: WS | undefined;