2021-02-16 - Translations - Functions

From Izara Wiki
Jump to navigation Jump to search

Service - Translations

Lambda Functions

Translation/Get

/**
 * Finds a matching current translation from an ordered list of language preferences, or return the default translation if none found
 * @param {string[]} subjectIdentifierLabels
 * @param {object} subjectUniqueIdProperties
 * @param {string[]} languageCodes - array of languageCodes, ordered by preference
 *
 * @returns {string} translation
 */

HdrApi

  • Validator: (standard)

handler logic

  • (standard)

logic

Translation/List

/**
 * Finds all possible translations for one subject and language (or all languages)
 * @param {string[]} subjectIdentifierLabels
 * @param {object} subjectUniqueIdProperties
 * @param {string} [languageCode=""] - if empty will show all
 *
 * @returns {object[]} array of translation objects (maybe has translation relationships as well so can see weight)
 */

HdrApi

  • Validator: (standard)

handler logic

  • (standard)

logic

Translation/CreateSubject

/**
 * Create a new node for the subject of translations
 * @param {Object} _izContext
 * @param {string[]} nodeLabels                       - array of labels
 * @param {object} nodeProperties                     - node properties
 * @param {string} createdByUserId
 * @param {object} [createdByRelationshipProperties={}]
 * @param {string[]} [nodeIdentifierLabels=[]]  - array of Identifier labels for query
 * @param {object} [nodeUniqueIdPropertyNames=[]]   - array of PropertyNames for query
 *
 */

HdrSqs

  • Triggered from InCreateTranslationSubject topic
  • Validator: (standard)

handler logic

  • (standard)

logic

Translation/Create

/**
 * Create a new translation for an existing subject vertex
 * @param {string[]} subjectIdentifierLabels
 * @param {object} subjectUniqueIdProperties
 * @param {string} languageCode
 * @param {string} translation
 * @param {string} createdByUserId
 * @param {object} [createdByRelationshipProperties={}]
 *
 */

HdrSqs

  • Triggered from InCreateTranslation topic
  • Validator: (standard)

handler logic

  • (standard)

HdrApi

  • Validator: (standard)

Authorizer

  • AppLevel

handler logic

  • userId = ?_izContext.authorized/signedInUser..?

logic

Expects subject node to already exist, but if not retry behaviour should give enough time for subject to create


Translation/CreateNewSubjectAndTranslation

/**
 * Create a new translation subject and an intitial translation
 * @param {string[]} subjectNodeLabels
 * @param {object} subjectNodeProperties
 * @param {string} createdByUserId
 * @param {string} languageCode
 * @param {string} translationText
 * @param {string[]} subjectIdentifierLabels
 * @param {object} subjectUniqueIdPropertyNames //will need to build properties object
 * @param {object} [createdByRelationshipProperties={}]
 *
 */

HdrSqs

  • Triggered from InCreateNewSubjectAndTranslation topic
  • Validator: (standard)

handler logic

  • (standard)

HdrApi

  • Validator: (standard)

Authorizer

  • AppLevel

handler logic

  • (standard)

logic

Functions