Skip to content

Commit

Permalink
Add identifier and clz fields to the data stores response (#894)
Browse files Browse the repository at this point in the history
  • Loading branch information
jbirddog authored Jan 12, 2024
1 parent 3aabc2c commit 8e05e1e
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,10 @@ def create_instance(name: str, identifier: str, location: str, schema: dict[str,
def existing_data_stores() -> list[dict[str, Any]]:
data_stores = []

keys = db.session.query(JSONDataStoreModel.name).distinct().order_by(JSONDataStoreModel.name).all() # type: ignore
query = db.session.query(JSONDataStoreModel.name, JSONDataStoreModel.identifier)
keys = query.distinct().order_by(JSONDataStoreModel.name).all() # type: ignore
for key in keys:
data_stores.append({"name": key[0], "type": "json"})
data_stores.append({"name": key[0], "type": "json", "identifier": key[1], "clz": "JSONDataStore"})

return data_stores

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def existing_data_stores() -> list[dict[str, Any]]:
.all()
)
for key in keys:
data_stores.append({"name": key[0], "type": "kkv"})
data_stores.append({"name": key[0], "type": "kkv", "identifier": "", "clz": "KKVDataStore"})

return data_stores

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def existing_data_stores() -> list[dict[str, Any]]:

keys = db.session.query(TypeaheadModel.category).distinct().order_by(TypeaheadModel.category).all() # type: ignore
for key in keys:
data_stores.append({"name": key[0], "type": "typeahead"})
data_stores.append({"name": key[0], "type": "typeahead", "identifier": key[0], "clz": "TypeaheadDataStore"})

return data_stores

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,10 @@ def test_get_list_of_data_stores(

self.load_data_store(app, client, with_db_and_bpmn_file_cleanup, with_super_admin_user)
results = client.get("/v1.0/data-stores", headers=self.logged_in_headers(with_super_admin_user))
assert results.json == [{"name": "albums", "type": "typeahead"}, {"name": "cereals", "type": "typeahead"}]
assert results.json == [
{"name": "albums", "type": "typeahead", "identifier": "albums", "clz": "TypeaheadDataStore"},
{"name": "cereals", "type": "typeahead", "identifier": "cereals", "clz": "TypeaheadDataStore"},
]

def test_get_data_store_returns_paginated_results(
self,
Expand Down

0 comments on commit 8e05e1e

Please sign in to comment.