Skip to main content

isOrganicCertificationValid

@svenvw/fdm-source


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

Function: isOrganicCertificationValid()

isOrganicCertificationValid(fdm, principal_id, b_id_farm, date): Promise<boolean>

Defined in: fdm-core/src/organic.ts:357

Checks if a farm has a valid organic certification on a specific date.

This function checks if the principal has 'read' permission on the farm. A certification is considered valid if the given date falls within its issued and expires dates.

Parameters

fdm

any

The FDM instance providing the connection to the database.

principal_id

any

The identifier of the principal making the request.

b_id_farm

any

The identifier of the farm.

date

Date

The date to check for a valid certification.

Returns

Promise<boolean>

A Promise that resolves to true if a valid organic certification is found, false otherwise.

Throws

If the principal does not have permission to read the farm's certifications.