OpenVeo Core server

API Docs for: 7.0.0
Show:

TaxonomyProvider

Extends EntityProvider
Module: core-providers

Summary

Defines a TaxonomyProvider to get and save taxonomies.

Constructor

TaxonomyProvider

Syntax

TaxonomyProvider

(
  • database
)

Summary

Parameters:

  • database Database

    The database to interact with

Methods

add

Syntax

add

(
  • taxonomies
  • [callback]
)
async

Summary

Adds taxonomies.

Parameters:

  • taxonomies Array

    The list of taxonomies to store with for each taxonomy:

    • String name The taxonomy name
    • Array tree The list of terms in the taxonomy with for each term:
      • String id Term id
      • String title Term title
      • Array items Term sub terms
    • String id The taxonomy id, generated if not specified
  • [callback] Function optional

    The function to call when it's done

    • Error The error if an error occurred, null otherwise
    • Number The total amount of taxonomies inserted
    • Array The list of added taxonomies

createIndexes

Syntax

createIndexes

(
  • callback
)
async

Summary

Creates taxonomies indexes.

Parameters:

  • callback Function

    Function to call when it's done with :

    • Error An error if something went wrong, null otherwise

getTaxonomyTerms

Syntax

getTaxonomyTerms

(
  • name
  • callback
)
async

Summary

Gets the list of terms of a taxonomy.

Parameters:

  • name String

    The taxonomy name

  • callback Function

    Function to call when it's done

    • Error An error if something went wrong
    • Array The taxonomy terms

updateOne

Syntax

updateOne

(
  • [filter]
  • data
  • [callback]
)
async

Summary

Updates a taxonomy.

Parameters:

  • [filter] ResourceFilter optional

    Rules to filter the taxonomy to update

  • data Object

    The modifications to perform

    • [name] String optional

      The taxonomy name

    • [tree] Array optional

      The list of terms in the taxonomy with for each term:

      • String id Term id
      • String title Term title
      • Array items Term sub terms
  • [callback] Function optional

    The function to call when it's done

    • Error The error if an error occurred, null otherwise
    • Number 1 if everything went fine