Skip to content

Commit

Permalink
feat(systems): add a filter for signage systems
Browse files Browse the repository at this point in the history
  • Loading branch information
stakach committed Aug 2, 2024
1 parent 0f81824 commit 010909f
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 7 deletions.
8 changes: 8 additions & 0 deletions OPENAPI_DOC.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
12 changes: 6 additions & 6 deletions shard.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -235,19 +235,19 @@ 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
version: 0.11.4

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
Expand Down Expand Up @@ -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
Expand Down
11 changes: 10 additions & 1 deletion src/placeos-rest-api/controllers/systems.cr
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 010909f

Please sign in to comment.