getSoilAnalysesForFarm
@nmi-agro/fdm-source / fdm-core/src / getSoilAnalysesForFarm
Function: getSoilAnalysesForFarm()
getSoilAnalysesForFarm(
fdm,principal_id,b_id_farm,timeframe?):Promise<Map<string,SoilAnalysis[]>>
Defined in: fdm-core/src/soil.ts:423
Alpha
Retrieves all soil analyses for every field on a farm.
Instead of issuing one query per field, this function joins through
fieldAcquiring so that all soil analyses 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?
Optional timeframe to filter soil analyses.
Returns
Promise<Map<string, SoilAnalysis[]>>
A Promise resolving to a Map keyed by field ID (b_id), with arrays of SoilAnalysis as values.