template-for-typescript-projects
    Preparing search index...

    Persists and retrieves Alert aggregates.

    interface AlertRepository {
        countUnread(): Promise<number>;
        deleteAll(): Promise<void>;
        deleteOne(id: AlertId): Promise<void>;
        existsRecentUnread(thresholdId: string, since: Date): Promise<boolean>;
        findAll(): Promise<Alert[]>;
        findById(id: AlertId): Promise<Alert | null>;
        save(alert: Alert): Promise<void>;
    }

    Implemented by

    Index

    Methods

    • Checks if an unread alert exists for a specific threshold created after the given timestamp.

      Parameters

      • thresholdId: string

        The threshold identifier to check.

      • since: Date

        The timestamp to check against (inclusive).

      Returns Promise<boolean>

      true if a recent unread alert exists.