From dbedfb937a5b5c9912d1f3c2a5ea766014dff2bb Mon Sep 17 00:00:00 2001 From: Eric Nguyen Date: Thu, 21 Mar 2024 11:58:09 +0100 Subject: [PATCH] fix: fix backwards compatibility for is:not:external search (#455) * fix: add backwards compatibility for is:not:external search * chore: update openapi.json --- backend/editor/models/search_models.py | 2 +- backend/openapi/openapi.json | 14 +++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/backend/editor/models/search_models.py b/backend/editor/models/search_models.py index 6e016979..445bf1c3 100644 --- a/backend/editor/models/search_models.py +++ b/backend/editor/models/search_models.py @@ -50,7 +50,7 @@ def build_cypher_query(self, _param_name: str) -> CypherQuery: case "external": return CypherQuery("n.is_external = true") case "not:external": - return CypherQuery("n.is_external = false") + return CypherQuery("(n.is_external IS NULL OR n.is_external = false)") case _: raise ValueError("Invalid filter value") diff --git a/backend/openapi/openapi.json b/backend/openapi/openapi.json index 50479060..55db7b78 100644 --- a/backend/openapi/openapi.json +++ b/backend/openapi/openapi.json @@ -1212,6 +1212,11 @@ }, "type": "object", "title": "Comments" + }, + "isExternal": { + "type": "boolean", + "title": "Isexternal", + "default": false } }, "type": "object", @@ -1330,7 +1335,14 @@ "IsFilterSearchTerm": { "properties": { "filterType": { "const": "is", "title": "Filtertype" }, - "filterValue": { "const": "root", "title": "Filtervalue" } + "filterValue": { + "anyOf": [ + { "const": "root" }, + { "const": "external" }, + { "const": "not:external" } + ], + "title": "Filtervalue" + } }, "type": "object", "required": ["filterType", "filterValue"],