Skip to content

Commit

Permalink
feat: add metadata-fields endpoint (#50)
Browse files Browse the repository at this point in the history
  • Loading branch information
rainandbare authored Dec 19, 2023
1 parent 5022c50 commit 3c16bfc
Show file tree
Hide file tree
Showing 7 changed files with 3,094 additions and 7 deletions.
21 changes: 15 additions & 6 deletions .meshrc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,21 @@ sources:
method: GET
responseSchema: ./json-schemas/consensusGenomeWorkflowResults.json
responseTypeName: ConsensusGenomeWorkflowResults
- type: Query
field: CoverageVizSummary
path: /pub/{args.snapshotLinkId}/samples/{args.sampleId}/coverage_viz_summary
method: GET
responseSchema: ./json-schemas/coverageVizSummary.json
responseTypeName: CoverageVizSummary
- type: Query
field: MetadataFields
path: /pub/{args.snapshotLinkId}/samples/metadata_fields
method: POST
requestSchema: ./json-schemas/sampleArray.json
responseSchema: ./json-schemas/metadataFields.json
responseTypeName: MetadataFields
headers:
Cookie: "{context.headers['cookie']}"
- type: Query
field: MngsWorkflowResults
path: /pub/{args.snapshotLinkId}/samples/{args.sampleId}.json
Expand All @@ -57,12 +72,6 @@ sources:
method: GET
responseSchema: ./json-schemas/mngsWorkflowResults.json
responseTypeName: MngsWorkflowResults
- type: Query
field: CoverageVizSummary
path: /pub/{args.snapshotLinkId}/samples/{args.sampleId}/coverage_viz_summary
method: GET
responseSchema: ./json-schemas/coverageVizSummary.json
responseTypeName: CoverageVizSummary
- type: Query
field: Pathogens
path: /pub/{args.snapshotLinkId}/samples/{args.sampleId}/report_v2?&id={args.sampleId}&pipeline_version={args.workflowVersionId}&merge_nt_nr=false
Expand Down
52 changes: 52 additions & 0 deletions json-schemas/metadataFields.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
"type": "array",
"items": {
"type": "object",
"properties": {
"key": {
"type": "string"
},
"dataType": {
"type": "string"
},
"name": {
"type": "string"
},
"options": {
"type": "NoneType"
},
"group": {
"type": "string"
},
"host_genome_ids": {
"type": "array",
"items": {
"type": "integer"
}
},
"description": {
"type": "string"
},
"is_required": {
"type": "integer"
},
"examples": {
"type": "object",
"properties": {
"all": {
"type": "array",
"items": {
"type": "string"
}
}
}
},
"default_for_new_host_genome": {
"type": "integer"
},
"isBoolean": {
"type": "boolean"
}
}
}
}
15 changes: 15 additions & 0 deletions json-schemas/sampleArray.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"type": "object",
"properties": {
"sampleIds": {
"type": "array",
"items": {
"type": "string"
}
},
"authenticityToken": {
"type": "string"
}
},
"required": ["sampleIds", "authenticityToken"]
}
12 changes: 12 additions & 0 deletions resolvers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,18 @@ export const resolvers: Resolvers = {
},
};
},
MetadataFields: async (root, args, context, info) => {
const body = {
sampleIds: args?.input?.sampleIds
};
const res = await postWithCSRF(
`/samples/metadata_fields`,
body,
args,
context
);
return res;
},
MngsWorkflowResults: async (root, args, context, info) => {
const data = await get(`/samples/${args.sampleId}.json`, args, context);
const pipelineRun = data?.pipeline_runs?.[0] || {};
Expand Down
3 changes: 3 additions & 0 deletions sample-requests/sampleArray.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"sampleIds": [ "1234", "12345" ]
}
Loading

0 comments on commit 3c16bfc

Please sign in to comment.