Run a series of updates on multiple products. Updates will be performed using the bulkWrite method.
TODO: Add transaction support in the future
Cleans an update payload for a product so that it can be saved into mongoDB.
Create multiple products in the database.
Create a single product in the database. Internally, this method calls createManyProducts with a single product.
Expand a list of products with image data from the attachment service
Note: This expand always expands, as images are expanded by default
Optional expand: ExpandExpand a list of products with organization data from the organization API
Optional expand: ExpandProductResponse[]
Expand the products with other microservices and data types
Optional expand: ExpandOptional applyExpression: ApplyExpressionProductResponse[]
Private getGet product from database. Optionally, you can pass forOrganizationId to filter products by organizationId.
Optional forOrganizationId: stringPromise<Product | undefined> Product data if fetched successfully, or null if data not found by id
Get multiple specific products from database.
Promise<Product[]>
Private getType guard to check if the products have been processed by the $apply param
TODO: This method is a workaround for the current implementation of the $apply param, and isn't ideal. I think we should just not support $expand on $apply, but we need to provide backwards compatibility for existing clients on the list products endpoints. In future, let's remove this method and encourage customers to either use two queries or make their own custom endpoint.
Optional applyExpression: ApplyExpressionList paginated products. This also supports extra filters:
paginated list query options
Optional extraFilters: { additional filters for certain endpoints
Optional mustOptional organizationOptional productOptional searchOptional logger: Loggerpaginated product list query result
Normalize a single product response
Normalize a list of product responses
Optional applyExpression: ApplyExpressionUpdate Product data
id of the product to update
Data of product
object contains id of the updated record blocks-58c1
Private attachmentPrivate dbPrivate expandPrivate organizationAPIPrivate organizationStatic Readonly COLLECTION_Static Readonly DEFAULT_Generated using TypeDoc
Product service