Skip to main content

addDerogation

@svenvw/fdm-source


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

Function: addDerogation()

addDerogation(fdm, principal_id, b_id_farm, b_derogation_year): Promise<any>

Defined in: fdm-core/src/derogation.ts:22

Adds a new derogation for a specific farm and year.

This function checks if the principal has 'write' permission on the farm, then creates a new derogation and links it to the farm.

Parameters

fdm

any

The FDM instance providing the connection to the database.

principal_id

any

The identifier of the principal creating the derogation.

b_id_farm

any

The identifier of the farm receiving the derogation.

b_derogation_year

any

The year for which the derogation is granted.

Returns

Promise<any>

The unique identifier for the new derogation.

Throws

If the principal does not have permission to add a derogation or if the database transaction fails.