From d7dae5a76c8b407ff4857de3ee36a1ea6f5bedb5 Mon Sep 17 00:00:00 2001 From: Johannes Terblanche Date: Fri, 19 Jul 2024 17:14:53 +0200 Subject: [PATCH] Updates for blob entry bugfix --- src/NavAbilitySDK.jl | 1 + src/graphql/Factor.jl | 2 +- src/graphql/UserRobotSession.jl | 4 ++-- src/graphql/Variable/Variable.jl | 16 +++++++++------- src/services/Variable.jl | 17 +++++++++++++++++ test/integration/InterfaceTests.jl | 7 +++++-- 6 files changed, 35 insertions(+), 12 deletions(-) diff --git a/src/NavAbilitySDK.jl b/src/NavAbilitySDK.jl index 565f7fb..50fb677 100644 --- a/src/NavAbilitySDK.jl +++ b/src/NavAbilitySDK.jl @@ -60,6 +60,7 @@ import DistributedFactorGraphs: getSessionBlobEntries, addSessionBlobEntry!, addSessionBlobEntries!, + listSessionBlobEntries, exists, listNeighbors, findVariableNearTimestamp diff --git a/src/graphql/Factor.jl b/src/graphql/Factor.jl index 905f8ad..56d68bd 100644 --- a/src/graphql/Factor.jl +++ b/src/graphql/Factor.jl @@ -171,7 +171,7 @@ mutation deleteFactor($factorId: ID!) { delete: { blobEntries: { where: { - node: { factorConnection_ALL: { node: { id: $factorId } } } + node: { parentConnection: {Factor: { node: { id: $factorId } } } } } } } diff --git a/src/graphql/UserRobotSession.jl b/src/graphql/UserRobotSession.jl index 16820c8..45fcf38 100644 --- a/src/graphql/UserRobotSession.jl +++ b/src/graphql/UserRobotSession.jl @@ -141,7 +141,7 @@ mutation deleteSession($sessionId: ID!) { where: { id: $sessionId } delete: { blobEntries: { - where: { node: { sessionConnection_ALL: { node: { id: $sessionId } } } } + where: { node: { parentConnection: {Session: {node: {id: $sessionId } } } } } } } ) { @@ -160,7 +160,7 @@ mutation deleteRobot($robotId: ID!) { where: { id: $robotId } delete: { blobEntries: { - where: { node: { robotConnection_ALL: { node: { id: $robotId } } } } + where: { node: { parentConnection: {Robot: {node: {id: $robotId } } } } } } } ) { diff --git a/src/graphql/Variable/Variable.jl b/src/graphql/Variable/Variable.jl index 6b1e601..d87ca89 100644 --- a/src/graphql/Variable/Variable.jl +++ b/src/graphql/Variable/Variable.jl @@ -207,7 +207,7 @@ mutation deleteVariable($variableId: ID!) { } blobEntries: { where: { - node: { variableConnection_ALL: { node: { id: $variableId } } } + node: { parentConnection: {Variable: {node: {id: $variableId } } } } } } } @@ -264,12 +264,14 @@ mutation deleteVariable( blobEntries: { where: { node: { - variableConnection_ALL: { - node: { - userLabel: $userLabel - robotLabel: $robotLabel - sessionLabel: $sessionLabel - label: $variableLabel + parentConnection: { + Variable: { + node: { + userLabel: $userLabel + robotLabel: $robotLabel + sessionLabel: $sessionLabel + label: $variableLabel + } } } } diff --git a/src/services/Variable.jl b/src/services/Variable.jl index 83a588f..0ba1e1c 100644 --- a/src/services/Variable.jl +++ b/src/services/Variable.jl @@ -16,6 +16,23 @@ function VariableCreateInput(fgclient::DFGClient, v::Variable) robotLabel = fgclient.robot.label, sessionLabel = fgclient.session.label, variableLabel = string(variableLabel), + parent = + Dict("Variable" => + Dict("connect" => + Dict("where" => + Dict("node" => + Dict("AND" => + ( + userLabel = fgclient.user.label, + robotLabel = fgclient.robot.label, + sessionLabel = fgclient.session.label, + label = string(variableLabel) + ) + ) + ) + ) + ) + ), getCommonProperties(BlobEntryCreateInput, entry)..., blobId = if isnothing(entry.blobId) entry.originId diff --git a/test/integration/InterfaceTests.jl b/test/integration/InterfaceTests.jl index 256dd77..9bbeace 100644 --- a/test/integration/InterfaceTests.jl +++ b/test/integration/InterfaceTests.jl @@ -26,7 +26,7 @@ sessionLabel = get(ENV, "SESSION_ID", "TestSession_$(randstring(4))") display(fgclient) # test easy constructor - fgclient2 = DFGClient(userLabel, robotLabel, sessionLabel) + fgclient2 = DFGClient(userLabel, robotLabel, sessionLabel; apiUrl) @test fgclient.session == fgclient2.session end @@ -37,7 +37,7 @@ end user = NvaSDK.User(client, userLabel) @test user.id == UUID("d4bfaaf6-7d55-49eb-b03a-7806457e09d2") - @test user.label == "guest@navability.io" + @test user.label == userLabel robot = addRobot!(client, user, temp_robotLabel) @test robot.label == temp_robotLabel @@ -378,6 +378,9 @@ a_facts = addFactor!.(fgclient, facts) end +deleteVariable!.(fgclient, listVariables(fgclient)) +deleteFactor!.(fgclient, getFactorsSkeleton(fgclient)) +deleteSession!(fgclient) # batch delete #TODO deleteVariables #TODO deleteFactors