Skip to main content

getFertilizerApplicationsForFarm

@nmi-agro/fdm-source


@nmi-agro/fdm-source / fdm-core/src / getFertilizerApplicationsForFarm

Function: getFertilizerApplicationsForFarm()

getFertilizerApplicationsForFarm(fdm, principal_id, b_id_farm, timeframe?): Promise<Map<string, FertilizerApplication[]>>

Defined in: fdm-core/src/fertilizer.ts:1105

Alpha

Retrieves all fertilizer applications for every field on a farm.

Instead of issuing one query per field, this function joins through fieldAcquiring so that all fertilizer applications for the farm are fetched at once. A single farm-level permission check is performed instead of one per field.

Parameters

fdm

PgDatabase

The FDM instance providing the connection to the database.

principal_id

any

The ID of the principal making the request.

b_id_farm

any

The ID of the farm.

timeframe?

Timeframe

Optional timeframe to filter fertilizer applications.

Returns

Promise<Map<string, FertilizerApplication[]>>

A Promise resolving to a Map keyed by field ID (b_id), with arrays of FertilizerApplication as values.