EntityDuplicator
An EntityDuplicator is used to define the logic for duplicating entities when the duplicateEntity mutation is called.
This allows you to add support for duplication of both core and custom entities.
Example
The duplicator then gets passed to your VendureConfig object:
- Extends:
ConfigurableOperationDef<T>
constructor
method
(config: EntityDuplicatorConfig<T>) => EntityDuplicatorduplicate
method
(input: { ctx: RequestContext; entityName: string; id: ID; args: ConfigArg[]; }) => Promise<VendureEntity>A function which performs the duplication of an entity.
Configuration for creating a new EntityDuplicator.
- Extends:
ConfigurableOperationDefOptions<T>
requiresPermission
property
Array<Permission | string> | Permission | stringThe permissions required in order to execute this duplicator. If an array is passed, then the administrator must have at least one of the permissions in the array.
forEntities
property
string[]The entities for which this duplicator is able to duplicate.
duplicate
property
DuplicateEntityFn<T>The function which performs the duplication.
Example
Was this chapter helpful?