Skip to content

Commit

Permalink
fix(console): deleting a pro plan app throws an error (#2660)
Browse files Browse the repository at this point in the history
  • Loading branch information
Cosmin-Parvulescu authored Sep 7, 2023
1 parent 85f2e49 commit 7708dd8
Showing 1 changed file with 12 additions and 15 deletions.
27 changes: 12 additions & 15 deletions platform/starbase/src/jsonrpc/methods/deleteApp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,27 +39,24 @@ export const deleteApp = async ({

const caller = router.createCaller(ctx)

const referenceEdges = await caller.edges.getEdges({
query: { src: { baseUrn: appURN }, tag: EDGE_HAS_REFERENCE_TO },
})
const [{ edges: srcEdges }, { edges: dstEdges }] = await Promise.all([
caller.edges.getEdges({
query: { src: { baseUrn: appURN } },
}),
caller.edges.getEdges({
query: { dst: { baseUrn: appURN } },
}),
])

const edgeRemovalPromises = [
//Reference edges
...referenceEdges.edges.map((e) =>
await Promise.all(
srcEdges.concat(dstEdges).map((e) =>
caller.edges.removeEdge({
tag: e.tag,
src: e.src.baseUrn,
dst: e.dst.baseUrn,
})
),
//Application edge
caller.edges.removeEdge({
src: ctx.identityURN,
dst: appURN,
tag: EDGE_APPLICATION,
}),
]
await Promise.all(edgeRemovalPromises)
)
)

await caller.edges.deleteNode({
urn: appURN,
Expand Down

0 comments on commit 7708dd8

Please sign in to comment.