Skip to content

Commit

Permalink
fixup! feat: also enable returning TSV #284
Browse files Browse the repository at this point in the history
  • Loading branch information
fengelniederhammer committed Aug 4, 2023
1 parent 2f6af2c commit b19f9d0
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ class LapisController(
@Operation(
description = DETAILS_ENDPOINT_DESCRIPTION,
operationId = "getDetailsAsCsv",
responses = [ApiResponse(responseCode = "200")],
)
fun getDetailsAsCsv(
@SequenceFilters
Expand Down Expand Up @@ -292,6 +293,7 @@ class LapisController(
@Operation(
description = DETAILS_ENDPOINT_DESCRIPTION,
operationId = "getDetailsAsTsv",
responses = [ApiResponse(responseCode = "200")],
)
fun getDetailsAsTsv(
@SequenceFilters
Expand Down Expand Up @@ -359,6 +361,7 @@ class LapisController(
@Operation(
description = DETAILS_ENDPOINT_DESCRIPTION,
operationId = "postDetailsAsCsv",
responses = [ApiResponse(responseCode = "200")],
)
fun postDetailsAsCsv(
@Parameter(schema = Schema(ref = "#/components/schemas/$DETAILS_REQUEST_SCHEMA"))
Expand All @@ -372,6 +375,7 @@ class LapisController(
@Operation(
description = DETAILS_ENDPOINT_DESCRIPTION,
operationId = "postDetailsAsTsv",
responses = [ApiResponse(responseCode = "200")],
)
fun postDetailsAsTsv(
@Parameter(schema = Schema(ref = "#/components/schemas/$DETAILS_REQUEST_SCHEMA"))
Expand Down
20 changes: 20 additions & 0 deletions siloLapisTests/test/details.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,4 +109,24 @@ Solothurn,EPI_ISL_1002052,B.1
`.trim()
);
});

it('should return the data as TSV', async () => {
const urlParams = new URLSearchParams({
fields: 'gisaid_epi_isl,pango_lineage,division',
orderBy: 'gisaid_epi_isl',
limit: '3',
dataFormat: 'tsv',
});

const result = await fetch(basePath + '/details?' + urlParams.toString());

expect(await result.text()).to.be.equal(
String.raw`
division gisaid_epi_isl pango_lineage
Vaud EPI_ISL_1001493 B.1.177.44
Bern EPI_ISL_1001920 B.1.177
Solothurn EPI_ISL_1002052 B.1
`.trim()
);
});
});

0 comments on commit b19f9d0

Please sign in to comment.