Skip to main content

removeFarm

@svenvw/fdm-source


@svenvw/fdm-source / fdm-core/src / removeFarm

Function: removeFarm()

removeFarm(fdm, principal_id, b_id_farm): Promise<void>

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

Alpha

Removes a farm and all its associated data.

This function checks if the principal has permission to delete the farm, then proceeds to delete the farm and all cascading data, including fields, associated events and assets (like fertilizer application, soil analysis), farm-related data (like fertilizers, catalogue enabling), and principal permissions.

Parameters

fdm

any

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

principal_id

any

The unique identifier of the principal performing the operation.

b_id_farm

any

The unique identifier of the farm to be removed.

Returns

Promise<void>

A promise that resolves when the farm has been successfully removed.

Throws

If the principal does not have permission to delete the farm.