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
10 changes: 9 additions & 1 deletion app/serializers/contributed_resource_serializer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,18 @@ def get_version
end
end

def _meta
meta = super
meta[:metrics] ||= {}
meta[:metrics][:view_count] = object.view_count
meta[:metrics][:run_count] = object.run_count if object.respond_to?(:can_run?) && object.can_run?
meta[:metrics][:download_count] = object.download_count if object.respond_to?(:contains_downloadable_items?) && object.contains_downloadable_items?
meta
end

private

def version_number
(@scope.try(:[], :requested_version) || object)&.version
end

end
14 changes: 14 additions & 0 deletions public/api/definitions/_schemas.yml
Original file line number Diff line number Diff line change
Expand Up @@ -335,13 +335,27 @@ meta:
$ref: "#/components/schemas/dateTimeString"
uuid:
$ref: "#/components/schemas/nonEmptyString"
metrics:
$ref: '#/components/schemas/metrics'
required:
- created
- modified
- uuid
- base_url
- api_version
additionalProperties: false
metrics:
type: object
properties:
view_count:
$ref: "#/components/schemas/nullableInteger"
download_count:
$ref: "#/components/schemas/nullableInteger"
run_count:
$ref: "#/components/schemas/nullableInteger"
required:
- view_count
additionalProperties: false
collectionItemMeta:
type: object
properties:
Expand Down
22 changes: 10 additions & 12 deletions public/api/examples/assayPatch.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"data": {
"type": "assays",
"id": "1035386775",
"id": "1035387536",
"attributes": {
"title": "A Maximal Assay",
"assay_class": {
Expand All @@ -20,68 +20,66 @@
"permissions": [
{
"resource": {
"id": "1022251326",
"id": "1022266447",
"type": "projects"
},
"access": "manage"
}
]
},
"tags": [

]
"tags": []
},
"relationships": {
"study": {
"data": {
"id": "1060385047",
"id": "1060385861",
"type": "studies"
}
},
"publications": {
"data": [
{
"id": "93",
"id": "356",
"type": "publications"
}
]
},
"organisms": {
"data": [
{
"id": "627234330",
"id": "627234477",
"type": "organisms"
}
]
},
"sops": {
"data": [
{
"id": "1055250474",
"id": "1055250955",
"type": "sops"
}
]
},
"data_files": {
"data": [
{
"id": "883654344",
"id": "1055250879",
"type": "data_files"
}
]
},
"documents": {
"data": [
{
"id": "35",
"id": "537",
"type": "documents"
}
]
},
"creators": {
"data": [
{
"id": "1039987255",
"id": "1040002373",
"type": "people"
}
]
Expand Down
68 changes: 27 additions & 41 deletions public/api/examples/assayPatchResponse.json
Original file line number Diff line number Diff line change
@@ -1,26 +1,22 @@
{
"data": {
"id": "1035386775",
"id": "1035387536",
"type": "assays",
"attributes": {
"policy": {
"access": "download",
"permissions": [
{
"resource": {
"id": "1022251326",
"id": "1022266447",
"type": "projects"
},
"access": "manage"
}
]
},
"discussion_links": [

],
"snapshots": [

],
"discussion_links": [],
"snapshots": [],
"title": "A Maximal Assay",
"description": "A Western Blot Assay",
"other_creators": "Anonymous creator",
Expand All @@ -38,15 +34,13 @@
"label": "Rna-seq",
"uri": "http://jermontology.org/ontology/JERMOntology#RNA-Seq"
},
"tags": [

],
"tags": [],
"creators": [
{
"profile": "/people/1039987255",
"profile": "/people/1040002373",
"family_name": "Last",
"given_name": "Person679",
"affiliation": "An Institution: 787",
"given_name": "Person2762",
"affiliation": "An Institution: 3206",
"orcid": null
}
]
Expand All @@ -55,117 +49,109 @@
"creators": {
"data": [
{
"id": "1039987255",
"id": "1040002373",
"type": "people"
}
]
},
"submitter": {
"data": [
{
"id": "1039987255",
"id": "1040002373",
"type": "people"
}
]
},
"organisms": {
"data": [
{
"id": "627234330",
"id": "627234477",
"type": "organisms"
}
]
},
"human_diseases": {
"data": [

]
"data": []
},
"people": {
"data": [
{
"id": "1039987255",
"id": "1040002373",
"type": "people"
}
]
},
"projects": {
"data": [
{
"id": "1022251326",
"id": "1022266447",
"type": "projects"
}
]
},
"investigation": {
"data": {
"id": "973655011",
"id": "973656015",
"type": "investigations"
}
},
"study": {
"data": {
"id": "1060385047",
"id": "1060385861",
"type": "studies"
}
},
"data_files": {
"data": [
{
"id": "883654344",
"id": "1055250879",
"type": "data_files"
}
]
},
"samples": {
"data": [

]
"data": []
},
"models": {
"data": [

]
"data": []
},
"sops": {
"data": [
{
"id": "1055250474",
"id": "1055250955",
"type": "sops"
}
]
},
"publications": {
"data": [
{
"id": "93",
"id": "356",
"type": "publications"
}
]
},
"placeholders": {
"data": [

]
"data": []
},
"documents": {
"data": [
{
"id": "35",
"id": "537",
"type": "documents"
}
]
}
},
"links": {
"self": "/assays/1035386775"
"self": "/assays/1035387536"
},
"meta": {
"created": "2026-06-16T14:23:10.458Z",
"modified": "2026-06-16T14:23:11.382Z",
"created": "2026-08-27T08:44:34.849Z",
"modified": "2026-08-27T08:44:35.934Z",
"api_version": "0.3",
"base_url": "http://localhost:3000",
"uuid": "eb1d9c96-da66-4b61-b50a-413e9370c228"
"uuid": "8765e72a-0f66-46e8-9c68-f56db9ad05f5"
}
},
"jsonapi": {
Expand Down
Loading
Loading