From 010909f66f2b6d8bec7438509e0615f9a820c4e7 Mon Sep 17 00:00:00 2001 From: Stephen von Takach Date: Fri, 2 Aug 2024 10:34:20 +1000 Subject: [PATCH] feat(systems): add a filter for signage systems --- OPENAPI_DOC.yml | 8 ++++++++ shard.lock | 12 ++++++------ src/placeos-rest-api/controllers/systems.cr | 11 ++++++++++- 3 files changed, 24 insertions(+), 7 deletions(-) diff --git a/OPENAPI_DOC.yml b/OPENAPI_DOC.yml index 61f114b1..16d7e198 100644 --- a/OPENAPI_DOC.yml +++ b/OPENAPI_DOC.yml @@ -8165,6 +8165,14 @@ paths: schema: type: boolean nullable: true + - name: signage + in: query + description: return systems which are signage + example: "true" + required: false + schema: + type: boolean + nullable: true - name: q in: query description: returns results based on a [simple query string](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-simple-query-string-query.html) diff --git a/shard.lock b/shard.lock index db215a9b..7fd4adcf 100644 --- a/shard.lock +++ b/shard.lock @@ -35,7 +35,7 @@ shards: bindata: git: https://github.com/spider-gazelle/bindata.git - version: 2.0.0 + version: 2.1.0 connect-proxy: git: https://github.com/spider-gazelle/connect-proxy.git @@ -175,7 +175,7 @@ shards: openai: git: https://github.com/spider-gazelle/crystal-openai.git - version: 0.9.1+git.commit.5ff22991f74b1fa09361728bec3e99c9d9661ab8 + version: 0.9.1+git.commit.bf862d19e3c9a84cd6dd01bbec6b06931697a6d3 openssl_ext: git: https://github.com/spider-gazelle/openssl_ext.git @@ -235,11 +235,11 @@ shards: placeos-driver: git: https://github.com/placeos/driver.git - version: 7.2.0 + version: 7.2.1 placeos-frontend-loader: git: https://github.com/placeos/frontend-loader.git - version: 2.7.1+git.commit.60634d3a8e3263cba70cf9c87b834b0cd0e8eeab + version: 2.7.1+git.commit.6afa4e3f6f491441c86ef6c2dab03fb05510d8cb placeos-log-backend: git: https://github.com/place-labs/log-backend.git @@ -247,7 +247,7 @@ shards: placeos-models: git: https://github.com/placeos/models.git - version: 9.53.3 + version: 9.54.0 placeos-resource: git: https://github.com/place-labs/resource.git @@ -303,7 +303,7 @@ shards: search-ingest: git: https://github.com/placeos/search-ingest.git - version: 2.11.1+git.commit.ff2733da5c41371f0e75c1d6e93578fabfd0d0a9 + version: 2.11.1+git.commit.6f22b75089c57f3b5995dfeaa56c3ff823ac1880 secrets-env: # Overridden git: https://github.com/spider-gazelle/secrets-env.git diff --git a/src/placeos-rest-api/controllers/systems.cr b/src/placeos-rest-api/controllers/systems.cr index 5d35b47c..2a7b2252 100644 --- a/src/placeos-rest-api/controllers/systems.cr +++ b/src/placeos-rest-api/controllers/systems.cr @@ -156,7 +156,9 @@ module PlaceOS::Api @[AC::Param::Info(description: "return systems which are in the zone provided", example: "zone-1234")] zone_id : String? = nil, @[AC::Param::Info(description: "return systems which are public", example: "true")] - public : Bool? = nil + public : Bool? = nil, + @[AC::Param::Info(description: "return systems which are signage", example: "true")] + signage : Bool? = nil ) : Array(::PlaceOS::Model::ControlSystem) elastic = ::PlaceOS::Model::ControlSystem.elastic query = ::PlaceOS::Model::ControlSystem.elastic.query(search_params) @@ -220,6 +222,13 @@ module PlaceOS::Api }) end + # filter by signage + if public + query.should({ + "signage" => [true], + }) + end + query.search_field "name" query.sort(NAME_SORT_ASC) paginate_results(elastic, query)