Skip to main content

Function: getFields()

getFields(fdm, principal_id, b_id_farm, timeframe?): Promise<getFieldType[]>

Defined in: fdm-core/src/field.ts:193

Alpha

Retrieves all fields associated with a specified farm.

This function first verifies that the requesting principal has read access to the farm, then returns an array of field detail objects. Each object includes the field's identifier, name, source, geometry, area, acquiring and discarding dates, as well as the creation and update timestamps.

Parameters

fdm

any

The FDM instance providing the connection to the database. The instance can be created with createFdmServer.

principal_id

any

The ID of the principal making the request.

b_id_farm

any

The unique identifier of the farm.

timeframe?

Timeframe

Optional timeframe to filter fields by start and end dates.

Returns

Promise<getFieldType[]>

A Promise resolving to an array of field detail objects.