Your First Shop App
1. Set Up the Migration
// api/services/maintenance/install/migrations/1/index.js
const MigratorErp = require('vario-app-framework/backend/utils/migrator.js');
const eavGroupShop = require('./static/erp/eav-groups/myShop.json');
const handle = async function ()
{
const migratorErp = new MigratorErp('migration1');
// ERP-level: EAV groups for article listings
await migratorErp.setMigration('eavStructureErp', async (methods) =>
{
await methods.createEavGroup(eavGroupShop);
});
// ERP-level: sales channel
await migratorErp.setMigration('salesChannel', async (methods) =>
{
const backend = await methods.createSalesChannelBackend('My Shop', ['ECOMMERCE']);
await methods.createSalesChannel(backend, 'My Shop', '', 'ECOMMERCE');
await methods.activateSalesChannelBackend(backend);
});
// ERP-level: webhooks
await migratorErp.setMigration('webhooks', async (methods) =>
{
await methods.registerWebhook(
'sales_channel.create',
'/api/webhooks/sales_channel.create',
);
await methods.registerWebhook(
'sales_channel.delete',
'/api/webhooks/sales_channel.delete',
);
});
// App-level: cron webhooks (destinationOwner = 'APP')
await migratorErp.setMigration('cronWebhooks', async (methods) =>
{
await methods.registerWebhook(
'ORDER_IMPORT',
'/api/cron-webhooks/ORDER_IMPORT',
'APP',
);
await methods.registerWebhook(
'PROCESS_QUEUES',
'/api/cron-webhooks/PROCESS_QUEUES',
'APP',
);
});
};
module.exports = { handle };2. Define the Shop EAV Group
3. Query Articles via VQL
Next Steps
Last updated
Was this helpful?