Skip to main content
Skip to main content

upsertTypes - Product Module Reference

This documentation provides a reference to the upsertTypes method. This belongs to the Product Module.

upsertTypes(data, sharedContext?): Promise<ProductTypeDTO[]>

This method updates existing types, or creates new ones if they don't exist.

Example

const productTypes = await productModuleService.upsertTypes([
{
id: "ptyp_123",
metadata: {
test: true,
},
},
{
value: "Digital",
},
])

Parameters

dataUpsertProductTypeDTO[]Required
The attributes to update or create for each type.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<ProductTypeDTO[]>Required
The updated and created types.

upsertTypes(data, sharedContext?): Promise<ProductTypeDTO>

This method updates an existing type, or creates a new one if it doesn't exist.

Example

const productType = await productModuleService.upsertTypes({
id: "ptyp_123",
metadata: {
test: true,
},
})

Parameters

The attributes to update or create for the type.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<ProductTypeDTO>Required
The updated or created type.
Was this section helpful?