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