Skip to main content

Function: updateFarm()

updateFarm(fdm, principal_id, b_id_farm, b_name_farm, b_businessid_farm, b_address_farm, b_postalcode_farm): Promise<any>

Defined in: fdm-core/src/farm.ts:153

Alpha

Updates a farm's details after confirming the principal has write access.

This function first checks if the specified principal is authorized to update the farm, then updates the farm's name, business ID, address, and postal code along with a new timestamp.

Parameters

fdm

any

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

principal_id

any

ID of the principal initiating the update.

b_id_farm

any

Unique identifier of the farm to update.

b_name_farm

any

New name for the farm.

b_businessid_farm

any

New business ID for the farm.

b_address_farm

any

New address for the farm.

b_postalcode_farm

any

New postal code for the farm.

Returns

Promise<any>

A Promise resolving to the updated farm details.

Throws

If the principal lacks the necessary write permission or the update operation fails.