Skip to main content
Skip to main content

upsert - Region Module Reference

This documentation provides a reference to the upsert method. This belongs to the Region Module.

upsert(data, sharedContext?): Promise<RegionDTO[]>

This method updates or creates regions if they don't exist.

Example

const region = await regionModuleService.upsert([
{
id: "reg_123",
automatic_taxes: false,
},
{
name: "Europe",
currency_code: "eur",
},
])

Parameters

dataUpsertRegionDTO[]Required
The attributes in the regions to be created or updated.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<RegionDTO[]>Required
The created or updated regions.

upsert(data, sharedContext?): Promise<RegionDTO>

This method updates or creates a region if it doesn't exist.

Example

const region = await regionModuleService.upsert({
id: "reg_123",
automatic_taxes: false,
})

Parameters

dataUpsertRegionDTORequired
The attributes in the region to be created or updated.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<RegionDTO>Required
The created or updated region.
Was this section helpful?