Skip to content

Commit

Permalink
Update routes with correct names
Browse files Browse the repository at this point in the history
  • Loading branch information
BenjaminCharmes committed Oct 21, 2024
1 parent 4125278 commit e4a8237
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions pydatalab/src/pydatalab/routes/v0_1/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from pydatalab import __version__
from pydatalab.blocks import BLOCK_TYPES
from pydatalab.config import CONFIG, FEATURE_FLAGS, FeatureFlags
from pydatalab.models import Person
from pydatalab.models import Collection, Equipment, Person, Sample, StartingMaterial
from pydatalab.mongo import flask_mongo

from ._version import __api_version__
Expand Down Expand Up @@ -76,8 +76,7 @@ def strip_maintainer_fields(cls, v):
def _get_deployment_metadata_once() -> Dict:
identifier_prefix = CONFIG.IDENTIFIER_PREFIX
metadata = (
CONFIG.DEPLOYMENT_METADATA.dict(
exclude_none=True) if CONFIG.DEPLOYMENT_METADATA else {}
CONFIG.DEPLOYMENT_METADATA.dict(exclude_none=True) if CONFIG.DEPLOYMENT_METADATA else {}
)
metadata.update({"identifier_prefix": identifier_prefix})
return metadata
Expand All @@ -95,8 +94,7 @@ def get_info():
jsonify(
json.loads(
JSONAPIResponse(
data=Data(id="/", type="info",
attributes=Info(**metadata)),
data=Data(id="/", type="info", attributes=Info(**metadata)),
meta=Meta(query=request.query_string),
links=Links(self=request.url),
).json()
Expand All @@ -115,8 +113,7 @@ def get_stats():
cell_count = flask_mongo.db.items.count_documents({"type": "cells"})

return (
jsonify({"counts": {"users": user_count,
"samples": sample_count, "cells": cell_count}}),
jsonify({"counts": {"users": user_count, "samples": sample_count, "cells": cell_count}}),
200,
)

Expand Down Expand Up @@ -152,9 +149,9 @@ def list_block_types():
def list_supported_types_schemas():
"""Returns a dictionary of supported item types and their schemas."""
schemas = {
"sample": Sample.schema(),
"collection": Collection.schema(),
"starting_material": StartingMaterial.schema(),
"samples": Sample.schema(),
"collections": Collection.schema(),
"starting_materials": StartingMaterial.schema(),
"equipment": Equipment.schema(),
}
return jsonify(schemas)
Expand All @@ -166,7 +163,7 @@ def get_sample_schema():
return jsonify(Sample.schema())


@INFO.route("/info/types/collection", methods=["GET"])
@INFO.route("/info/types/collections", methods=["GET"])
def get_collection_schema():
"""Returns the JSON schema for the Collection type."""
return jsonify(Collection.schema())
Expand Down

0 comments on commit e4a8237

Please sign in to comment.