OpenVeo Publish server

API Docs for: 8.0.0
Show:

PropertyProvider

Extends EntityProvider
Module: providers

Summary

Defines a PropertyProvider to get and save custom properties.

Constructor

PropertyProvider

Syntax

PropertyProvider

(
  • database
)

Summary

Parameters:

  • database Database

    The database to interact with

Item Index

Properties

Methods

add

Syntax

add

(
  • customProperties
  • [callback]
)
async

Summary

Adds custom properties.

Parameters:

  • customProperties Array

    The list of custom properties to store with for each custom property:

    • String name The property name
    • String description The property description
    • String type The property type (see PropertyProvider.availableTypes)
    • String [id] The property id, generated if not specified
    • Array [values] The list of values if type is PropertyProvider.TYPES.LIST
  • [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 properties inserted
    • Array The list of added properties

createIndexes

Syntax

createIndexes

(
  • callback
)
async

Summary

Creates properties indexes.

Parameters:

  • callback Function

    Function to call when it's done with :

    • Error An error if something went wrong, null otherwise

remove

Syntax

remove

(
  • [filter]
  • [callback]
)
async

Summary

Removes custom properties.

This will execute publish hook "PROPERTIES_DELETED" after removing custom properties with:

  • Array The list of removed properties

Parameters:

  • [filter] ResourceFilter optional

    Rules to filter properties to remove

  • [callback] Function optional

    The function to call when it's done

    • Error The error if an error occurred, null otherwise
    • Number The number of removed properties

updateOne

Syntax

updateOne

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

Summary

Updates a custom property.

Parameters:

  • [filter] ResourceFilter optional

    Rules to filter property to update

  • data Object

    The modifications to perform

    • [name] String optional

      The property name

    • [description] String optional

      The property description

    • [type] String optional

      The property type (see PropertyProvider.availableTypes)

    • [id] String optional

      The property id, generated if not specified

    • [values] Array optional

      The list of values if type is PropertyProvider.TYPES.LIST

  • [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

Properties

availableTypes

Syntax

availableTypes

Array final static

Summary

The list of available property types.

TYPES

Syntax

TYPES

Object final static

Summary

Property types.