ChemPal Documentation - v1.6.0
    Preparing search index...

    Function deleteSupplierStatsEntries

    • Deletes specific days of supplier stats in one transaction, used to prune days that have aged out of the retention window.

      Parameters

      • dateKeys: string[]

        The days to delete, as YYYY-MM-DD strings.

      Returns Promise<void>

      Resolves once every row is deleted.

      await deleteSupplierStatsEntries(["2026-06-01", "2026-06-02"]);
      
      export async function deleteSupplierStatsEntries(dateKeys: string[]): Promise<void> {
      try {
      const db = await getDB();
      const tx = db.transaction(IDB_STORE.SUPPLIER_STATS, 'readwrite');
      for (const dateKey of dateKeys) {
      tx.store.delete(dateKey);
      }
      await tx.done;
      } catch (error) {
      logger.error('Failed to delete supplier stats entries from IndexedDB', { error });
      }
      }