Skip to main content

Function: updateCultivation()

updateCultivation(fdm, principal_id, b_lu, b_lu_catalogue?, b_lu_start?, b_lu_end?): Promise<void>

Defined in: fdm-core/src/cultivation.ts:866

Alpha

Updates the specified cultivation's details.

Performs permission checks and validates that the new dates are logically consistent and that the referenced cultivation and catalogue entries exist. Depending on the inputs, it updates the main cultivation record along with its related sowing, termination, and, if applicable, harvest records.

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 authorized to perform this update.

b_lu

any

The unique cultivation identifier.

b_lu_catalogue?

any

(Optional) The new catalogue ID; if provided, it must correspond to an existing catalogue entry.

b_lu_start?

any

(Optional) The updated sowing date; when provided with a termination date, it must precede it.

b_lu_end?

any

(Optional) The updated termination date; if provided, it must be later than the sowing date.

Returns

Promise<void>

A Promise that resolves upon successful completion of the update.

Throws

If the cultivation does not exist, if date validations fail, or if the update operation encounters an issue.