Skip to main content

Function: updateField()

updateField(fdm, principal_id, b_id, b_name?, b_id_source?, b_geometry?, b_start?, b_acquiring_method?, b_end?): Promise<getFieldType>

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

Alpha

Updates the details of an existing field.

This function applies updates to the field's basic information and its associated acquiring and discarding records. It performs a permission check to ensure the principal has write access and validates that the acquiring date is earlier than the discarding date, when applicable.

Parameters

fdm

any

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

principal_id

any

The identifier of the principal performing the update.

b_id

any

The unique identifier of the field to update.

b_name?

any

(Optional) New name for the field.

b_id_source?

any

(Optional) New source identifier for the field.

b_geometry?

any

(Optional) Updated field geometry in GeoJSON format.

b_start?

any

(Optional) Updated start date for managing the field.

b_acquiring_method?

any

(Optional) Updated method for field management.

b_end?

any

(Optional) Updated end date for managing the field.

Returns

Promise<getFieldType>

A Promise that resolves to the updated field details.

Throws

If the acquiring date is not before the discarding date.