diff --git a/src/features/vars-schema/hooks/vars-update-trigger.ts b/src/features/vars-schema/hooks/vars-update-trigger.ts index c5ad5016a..f0363a588 100644 --- a/src/features/vars-schema/hooks/vars-update-trigger.ts +++ b/src/features/vars-schema/hooks/vars-update-trigger.ts @@ -198,6 +198,7 @@ const addDeviceEnvHooks = (resource: keyof BalenaModel) => { addDeviceEnvHooks('device_config_variable'); addDeviceEnvHooks('device_environment_variable'); +addDeviceEnvHooks('device_service_environment_variable'); addEnvHooks('service_environment_variable', async (args) => { if (args.req.body.service != null) { @@ -293,44 +294,6 @@ addEnvHooks('service_environment_variable', async (args) => { ]; }); -addEnvHooks('device_service_environment_variable', async (args) => { - if (args.req.body.service_install != null) { - return { - service_install: { - $any: { - $alias: 's', - $expr: { s: { id: args.req.body.service_install } }, - }, - }, - }; - } - - const envVarIds = await sbvrUtils.getAffectedIds(args); - if (envVarIds.length === 0) { - return; - } - return [ - envVarIds, - (envVarIdsChunk) => ({ - service_install: { - $any: { - $alias: 's', - $expr: { - s: { - device_service_environment_variable: { - $any: { - $alias: 'e', - $expr: { e: { id: { $in: envVarIdsChunk } } }, - }, - }, - }, - }, - }, - }, - }), - ]; -}); - addEnvHooks('image_environment_variable', async (args) => { if (args.req.body.release_image != null) { return {