2020-12-18 - Catalog Manager - Functions
Jump to navigation
Jump to search
Lambda Functions
CatalogServiceName/ListServiceNameTags
/**
* List all catalogServiceNameTags from Config table
*
* @returns {object[]} catalogServiceNameTags
*/
HdrApi
- Validator: (standard/none)
Authorizer
- AppLevel
handler logic
- (standard)
logic
- query DynamoDB Config table for configTag = "catalogServiceName" and return an array of the serviceNameTags (configKeys)
CategoryTreeServiceName/ListServiceNameTags
/**
* List all categoryTreeServiceNameTags from Config table
*
* @returns {object[]} categoryTreeServiceNameTags
*/
HdrApi
- Validator: (standard/none)
Authorizer
- AppLevel
handler logic
- (standard)
logic
- query DynamoDB Config table for configTag = "categoryTreeServiceName" and return array of the serviceNameTags (configKeys)
Catalog/List
/**
* List catalogs
* @param {string} catalogNameFilter
*
* @returns {object[]} catalogs
*/
HdrApi
- Validator: (standard/none)
Authorizer
- AppLevel
handler logic
- (standard)
logic
- Not yet sure how to implement categoryNameFilter syntax, will depend on effective graph querying
- Will probably need to work in pagination
- const catalogGraphServiceName = {from Config table: CatalogGraphServiceName}
- const catalogs = NPM module - izara-shared#graphSharedLib.getVerticesByVertexLabel
- graphServiceName: catalogGraphServiceName
- vertexLabel: NPM module - izara-market-shared#CatalogStandardLib.catalogGraphTag
- return catalogs
Category/List
/**
* List categories
* @param {string} categoryNameFilter
*
* @returns {object[]} catalogs
*/
HdrApi
- Validator: (standard/none)
Authorizer
- AppLevel
handler logic
- (standard)
logic
- Not yet sure how to implement categoryNameFilter syntax, will depend on effective graph querying
- Will probably need to work in pagination
- const catalogGraphServiceName = {from Config table: CatalogGraphServiceName}
- const categories = NPM module - izara-shared#graphSharedLib.getVerticesByVertexLabel
- graphServiceName: catalogGraphServiceName
- vertexLabel: NPM module - izara-market-shared#CategoryStandardLib.categoryGraphTag
- return categories
Catalog/Browse
/**
* Client request to browse a category in a catalog, including any additional filters
* @param {string} catalogId
* @param {string} [categoryNodeId=""] - if empty will browse catalog level
* @param {numeric} [browseQuantity=0]
* @param {numeric} [locationNodeId=""] - if empty will not filter by locationNodeId
* @param {string} [searchType=""] - overwrite default searchType
* @param {Object} [filter={}] - complex filter object, adds additional filters
* @param {Object} [requiredData={}] - overwrite default requiredData
*
* @returns {Object} if successful returns object with searchResultId and requestDetailId, or sortResultId
*/
HdrApi
- Validator: (standard/none)
Authorizer
- AppLevel
handler logic
- (standard)
logic
- const catalogGraphServiceName = {from Config table: CatalogGraphServiceName}
- const catalog = NPM module - izara-shared#graphSharedLib.getVertexByVertexTagAndVertexUniqueId
- graphServiceName: catalogGraphServiceName
- vertexTag: NPM module - izara-market-shared#CatalogStandardLib.catalogGraphTag
- vertexUniqueId: catalogId
- if not exist return error object to handler, which then ?throws error for API client
// adjust to default values
- if browseQuantity empty
- browseQuantity = catalog.defaultBrowseQuantity
// get browseRequest from category tree service
- const searchResultRequest = invoke sync 2020-12-19 - Category Tree Standard - Functions#CategoryNode/BuildBrowseRequest
- catalogId: catalogId
- categoryNodeId: categoryNodeId
- searchType: searchType
- filter: filter
- requiredData: requiredData
- // add in additionalParams
- searchResultRequest.additionalParams = {
- browseQuantity: browseQuantity
- locationNodeId = locationNodeId
- const searchTypeConfig = {from Config table: searchType matching ...browseConfig setting after building in category tree service}
- const searchResultId = invoke sync ... search result request in service set by ''searchTypeConfig.serviceName''
- searchResultRequest: searchResultRequest
- ..
- return searchResultId
Functions
...
/**
* ...
* @param {string} ...
*
* @returns {string} ...
*/
logic
...