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

    Function getPriceSeriesByProduct

    • Read every price-history series belonging to a product — its base row plus one row per tracked variant — via the productKey index. Used by the detail panel to render a product's full price history in one query. Returns [] when the product has no recorded history or the read fails.

      Parameters

      • productKey: string

        The product's identity key (shared by base and variants).

      Returns Promise<PriceHistoryEntry[]>

      All matching series (order unspecified), or [] when none.

      const series = await getPriceSeriesByProduct("3f9c2a…");
      // => [ base series, variant series, … ]
      export async function getPriceSeriesByProduct(productKey: string): Promise<PriceHistoryEntry[]> {
      try {
      const db = await getDB();
      return await db.getAllFromIndex(IDB_STORE.PRICE_HISTORY, 'productKey', productKey);
      } catch (error) {
      logger.error('Failed to get price series by product from IndexedDB', { error });
      return [];
      }
      }