diff --git a/OPENAPI_DOC.yml b/OPENAPI_DOC.yml index 47a82696..18ec40cc 100644 --- a/OPENAPI_DOC.yml +++ b/OPENAPI_DOC.yml @@ -5438,6 +5438,14 @@ paths: - websocket - logic nullable: true + - name: update_available + in: query + description: list only drivers for which update is available + 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) @@ -19165,6 +19173,26 @@ components: ignore_connected: type: boolean nullable: true + update_available: + type: boolean + nullable: true + update_info: + type: object + properties: + commit: + type: string + message: + type: string + author: + type: string + nullable: true + date: + type: string + nullable: true + required: + - commit + - message + nullable: true repository_id: type: string nullable: true diff --git a/shard.lock b/shard.lock index 711052cb..5b67a59b 100644 --- a/shard.lock +++ b/shard.lock @@ -7,7 +7,7 @@ shards: action-controller: git: https://github.com/spider-gazelle/action-controller.git - version: 7.2.3 + version: 7.3.0 active-model: git: https://github.com/spider-gazelle/active-model.git @@ -267,7 +267,7 @@ shards: placeos-models: git: https://github.com/placeos/models.git - version: 9.26.0 + version: 9.27.0 placeos-resource: git: https://github.com/place-labs/resource.git diff --git a/src/placeos-rest-api/controllers/drivers.cr b/src/placeos-rest-api/controllers/drivers.cr index f020310f..fdedb1c8 100644 --- a/src/placeos-rest-api/controllers/drivers.cr +++ b/src/placeos-rest-api/controllers/drivers.cr @@ -38,7 +38,9 @@ module PlaceOS::Api @[AC::Route::GET("/")] def index( @[AC::Param::Info(description: "filter by the type of driver", example: "Logic")] - role : Model::Driver::Role? = nil + role : Model::Driver::Role? = nil, + @[AC::Param::Info(description: "list only drivers for which update is available", example: "true")] + update_available : Bool? = nil ) : Array(Model::Driver) elastic = Model::Driver.elastic query = elastic.query(search_params) @@ -49,6 +51,12 @@ module PlaceOS::Api }) end + if update_available + query.filter({ + "update_available" => [update_available.as(Bool)], + }) + end + query.search_field "name" query.sort(NAME_SORT_ASC) paginate_results(elastic, query)