Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
116 changes: 116 additions & 0 deletions OPENAPI_DOC.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1550,6 +1550,15 @@ paths:
- AssetCategories
operationId: PlaceOS::Api::AssetCategories_index
parameters:
- name: hidden
in: query
description: Filter categories by hidden status. `true` returns only hidden
categories, `false` returns only non-hidden categories, and `nil` returns
all categories.
example: "true"
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 Expand Up @@ -23073,6 +23082,9 @@ components:
description:
type: string
nullable: true
hidden:
type: boolean
nullable: true
parent_category_id:
type: string
nullable: true
Expand Down Expand Up @@ -23175,6 +23187,58 @@ components:
barcode:
type: string
nullable: true
name:
type: string
nullable: true
client_ids:
type: object
nullable: true
map_id:
type: string
nullable: true
bookable:
type: boolean
nullable: true
accessible:
type: boolean
nullable: true
zones:
type: array
items:
type: string
nullable: true
place_groups:
type: array
items:
type: string
nullable: true
assigned_to:
type: string
nullable: true
assigned_name:
type: string
nullable: true
features:
type: array
items:
type: string
nullable: true
images:
type: array
items:
type: string
nullable: true
notes:
type: string
nullable: true
security_system_groups:
type: array
items:
type: string
nullable: true
parent_id:
type: string
nullable: true
asset_type_id:
type: string
nullable: true
Expand Down Expand Up @@ -23212,6 +23276,58 @@ components:
barcode:
type: string
nullable: true
name:
type: string
nullable: true
client_ids:
type: object
nullable: true
map_id:
type: string
nullable: true
bookable:
type: boolean
nullable: true
accessible:
type: boolean
nullable: true
zones:
type: array
items:
type: string
nullable: true
place_groups:
type: array
items:
type: string
nullable: true
assigned_to:
type: string
nullable: true
assigned_name:
type: string
nullable: true
features:
type: array
items:
type: string
nullable: true
images:
type: array
items:
type: string
nullable: true
notes:
type: string
nullable: true
security_system_groups:
type: array
items:
type: string
nullable: true
parent_id:
type: string
nullable: true
asset_type_id:
type: string
nullable: true
Expand Down
6 changes: 3 additions & 3 deletions shard.lock
Original file line number Diff line number Diff line change
Expand Up @@ -207,15 +207,15 @@ shards:

placeos-frontend-loader:
git: https://github.com/placeos/frontend-loader.git
version: 2.7.1+git.commit.2159535a3132a6db257f4b0d37a0261510240023
version: 2.7.1+git.commit.57f36cfb54f4ff1088ea9e76b000951ade401466

placeos-log-backend:
git: https://github.com/place-labs/log-backend.git
version: 0.13.0

placeos-models:
git: https://github.com/placeos/models.git
version: 9.76.0
version: 9.76.1

placeos-resource:
git: https://github.com/place-labs/resource.git
Expand Down Expand Up @@ -263,7 +263,7 @@ shards:

search-ingest:
git: https://github.com/placeos/search-ingest.git
version: 2.11.2+git.commit.af0796e3f4d695ad304ab24eb4f06b9b529134e7
version: 2.11.2+git.commit.158f5838832c1f1219ace0d12b63fa84a6490570

secrets-env: # Overridden
git: https://github.com/spider-gazelle/secrets-env.git
Expand Down
12 changes: 11 additions & 1 deletion src/placeos-rest-api/controllers/asset_categories.cr
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,19 @@ module PlaceOS::Api

# list the asset categories
@[AC::Route::GET("/")]
def index : Array(::PlaceOS::Model::AssetCategory)
def index(
@[AC::Param::Info(description: "Filter categories by hidden status. `true` returns only hidden categories, `false` returns only non-hidden categories, and `nil` returns all categories.",
example: "true")]
hidden : Bool? = nil,
) : Array(::PlaceOS::Model::AssetCategory)
elastic = ::PlaceOS::Model::AssetCategory.elastic
query = elastic.query(search_params)

if value = hidden
query.must({
"hidden" => [value],
})
end
query.sort(NAME_SORT_ASC)
paginate_results(elastic, query)
end
Expand Down
Loading