Function: removeHarvest()
removeHarvest(
fdm
,principal_id
,b_id_harvesting
):Promise
<void
>
Defined in: fdm-core/src/harvest.ts:281
Removes a harvest record along with its related sampling, analyses, and harvestable entries.
This asynchronous function verifies that the principal has write permission on the specified harvest. In a single transaction, it retrieves the harvest details, deletes linked sampling entries, analyses, and the harvestable record, and finally removes the harvest record itself. For once-harvestable cultivations, it also clears the cultivation's terminating date.
Parameters
fdm
any
The FDM instance providing the connection to the database. The instance can be created with createFdmServer.
principal_id
any
b_id_harvesting
any
Identifier of the harvest record to remove.
Returns
Promise
<void
>
Throws
Error if an error occurs during the transaction.