From b9cc09df2e311c891b95ab73f3cb2a73eb3adf94 Mon Sep 17 00:00:00 2001 From: Alex Layton Date: Thu, 17 Feb 2022 20:20:50 -0500 Subject: [PATCH] Fix bug with partial deletes --- oada/libs/lib-arangodb/src/libs/changes.ts | 2 +- oada/libs/lib-arangodb/src/libs/resources.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/oada/libs/lib-arangodb/src/libs/changes.ts b/oada/libs/lib-arangodb/src/libs/changes.ts index bf0f70ab..90431727 100644 --- a/oada/libs/lib-arangodb/src/libs/changes.ts +++ b/oada/libs/lib-arangodb/src/libs/changes.ts @@ -263,7 +263,7 @@ export async function putChange({ } const number = Number.parseInt(rev as string, 10); - trace('putChange: inserting change with body %O', change); + trace({ change }, 'putChange: inserting change'); return (await ( await database.query( aql` diff --git a/oada/libs/lib-arangodb/src/libs/resources.ts b/oada/libs/lib-arangodb/src/libs/resources.ts index 238cfe8e..0ed45e6d 100644 --- a/oada/libs/lib-arangodb/src/libs/resources.ts +++ b/oada/libs/lib-arangodb/src/libs/resources.ts @@ -723,7 +723,7 @@ export async function deletePartialResource( pointer.set(document, null); const name = aPath.pop(); - const sPath = JsonPointer.create(aPath) || null; + const sPath = JsonPointer.create(aPath).toString() || null; const cursor = await database.query({ query: ` LET res = DOCUMENT(${resources.name}, '${key}') @@ -740,7 +740,7 @@ export async function deletePartialResource( LET start = FIRST( FOR node IN ${graphNodes} LET path = node.path || null - FILTER node['resource_id'] == ${id} AND path == ${sPath ?? null} + FILTER node['resource_id'] == ${id} AND path == ${sPath} RETURN node._id ) LET vs = (