From 2d93b58652b4d1360d8fd007376c0d0778d3924d Mon Sep 17 00:00:00 2001 From: Raman Shekhawat Date: Thu, 12 Oct 2023 23:04:06 +0530 Subject: [PATCH] fix fuelTank destroy mapper --- src/mappings/fuelTanks/events/fuelTankDestroyed.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/mappings/fuelTanks/events/fuelTankDestroyed.ts b/src/mappings/fuelTanks/events/fuelTankDestroyed.ts index 0de40c78a..cbf88734c 100644 --- a/src/mappings/fuelTanks/events/fuelTankDestroyed.ts +++ b/src/mappings/fuelTanks/events/fuelTankDestroyed.ts @@ -36,13 +36,18 @@ export async function fuelTankDestroyed( const tankId = u8aToHex(eventData.tankId) - await ctx.store.delete(PermittedExtrinsics, { ruleSet: { tank: { id: tankId } } }) + const pE = await ctx.store.find(PermittedExtrinsics, { + relations: { ruleSet: true }, + where: { ruleSet: { tank: { id: tankId } } }, + }) + + await ctx.store.remove(pE) await Promise.all([ ctx.store.delete(FuelTankRuleSet, { tank: { id: tankId } }), ctx.store.delete(FuelTankAccountRules, { tank: { id: tankId } }), ]) - ctx.store.delete(FuelTank, { tank: { id: tankId } }) + ctx.store.delete(FuelTank, { id: tankId }) return new EventModel({ id: item.event.id,