Skip to main content

addSoilAnalysis

@svenvw/fdm-source


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

Function: addSoilAnalysis()

addSoilAnalysis(fdm, principal_id, a_date, a_source, b_id, a_depth_lower, b_sampling_date, soilAnalysisData?, a_depth_upper?): Promise<any>

Defined in: fdm-core/src/soil.ts:35

Adds a new soil analysis record along with its soil sampling details.

This function verifies that the principal has write access to the specified field, then creates new entries in the soil analysis and soil sampling tables within a database transaction. The ID of the newly created soil analysis record is returned.

Parameters

fdm

any

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

principal_id

any

The identifier of the principal performing the operation.

a_date

any

The date when the soil analysis was performed.

a_source

any

The source of the soil analysis data.

b_id

any

The identifier of the field where the soil sample was collected.

a_depth_lower

any

The lower depth up to which the soil sample was taken.

b_sampling_date

any

The date when the soil sample was collected.

soilAnalysisData?

any

Optional additional data for the soil analysis (e.g., pH, nutrient levels).

a_depth_upper?

any = 0

The upper depth from which the soil sample was taken. Defaults to 0

Returns

Promise<any>

The ID of the newly added soil analysis record.

Throws

If the database transaction fails.