Skip to content

Commit

Permalink
fix(website): add /sample to LAPIS paths
Browse files Browse the repository at this point in the history
  • Loading branch information
fengelniederhammer committed Dec 14, 2023
1 parent c55d715 commit a376cf7
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 14 deletions.
22 changes: 13 additions & 9 deletions website/src/services/lapisApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,13 @@ import {
mutationsResponse,
} from '../types/lapis.ts';

function withSample<Path extends `/${string}`>(path: Path) {
return `/sample${path}` as const;
}

const detailsEndpoint = makeEndpoint({
method: 'post',
path: '/details',
path: withSample('/details'),
alias: 'details',
parameters: [
{
Expand All @@ -26,7 +30,7 @@ const detailsEndpoint = makeEndpoint({

const aggregatedEndpoint = makeEndpoint({
method: 'post',
path: '/aggregated',
path: withSample('/aggregated'),
alias: 'aggregated',
parameters: [
{
Expand All @@ -40,7 +44,7 @@ const aggregatedEndpoint = makeEndpoint({

const nucleotideMutationsEndpoint = makeEndpoint({
method: 'post',
path: '/nucleotideMutations',
path: withSample('/nucleotideMutations'),
alias: 'nucleotideMutations',
parameters: [
{
Expand All @@ -54,7 +58,7 @@ const nucleotideMutationsEndpoint = makeEndpoint({

const aminoAcidMutationsEndpoint = makeEndpoint({
method: 'post',
path: '/aminoAcidMutations',
path: withSample('/aminoAcidMutations'),
alias: 'aminoAcidMutations',
parameters: [
{
Expand All @@ -68,7 +72,7 @@ const aminoAcidMutationsEndpoint = makeEndpoint({

const nucleotideInsertionsEndpoint = makeEndpoint({
method: 'post',
path: '/nucleotideInsertions',
path: withSample('/nucleotideInsertions'),
alias: 'nucleotideInsertions',
parameters: [
{
Expand All @@ -82,7 +86,7 @@ const nucleotideInsertionsEndpoint = makeEndpoint({

const aminoAcidInsertionsEndpoint = makeEndpoint({
method: 'post',
path: '/aminoAcidInsertions',
path: withSample('/aminoAcidInsertions'),
alias: 'aminoAcidInsertions',
parameters: [
{
Expand All @@ -96,7 +100,7 @@ const aminoAcidInsertionsEndpoint = makeEndpoint({

const alignedNucleotideSequencesEndpoint = makeEndpoint({
method: 'post',
path: '/alignedNucleotideSequences',
path: withSample('/alignedNucleotideSequences'),
alias: 'alignedNucleotideSequences',
immutable: true,
parameters: [
Expand All @@ -111,7 +115,7 @@ const alignedNucleotideSequencesEndpoint = makeEndpoint({

const unalignedNucleotideSequencesEndpoint = makeEndpoint({
method: 'post',
path: '/unalignedNucleotideSequences',
path: withSample('/unalignedNucleotideSequences'),
alias: 'unalignedNucleotideSequences',
immutable: true,
parameters: [
Expand All @@ -126,7 +130,7 @@ const unalignedNucleotideSequencesEndpoint = makeEndpoint({

const alignedAminoAcidSequencesEndpoint = makeEndpoint({
method: 'post',
path: '/alignedAminoAcidSequences/:gene',
path: withSample('/alignedAminoAcidSequences/:gene'),
alias: 'alignedAminoAcidSequences',
immutable: true,
parameters: [
Expand Down
10 changes: 5 additions & 5 deletions website/vitest.setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const backendRequestMocks = {
const lapisRequestMocks = {
details: (statusCode: number = 200, response: DetailsResponse | LapisError) => {
testServer.use(
http.post(`${testConfig.serverSide.lapisUrls.dummy}/details`, () => {
http.post(`${testConfig.serverSide.lapisUrls.dummy}/sample/details`, () => {
return new Response(JSON.stringify(response), {
status: statusCode,
});
Expand All @@ -58,7 +58,7 @@ const lapisRequestMocks = {
},
nucleotideMutations: (statusCode: number = 200, response: MutationsResponse | LapisError) => {
testServer.use(
http.post(`${testConfig.serverSide.lapisUrls.dummy}/nucleotideMutations`, () => {
http.post(`${testConfig.serverSide.lapisUrls.dummy}/sample/nucleotideMutations`, () => {
return new Response(JSON.stringify(response), {
status: statusCode,
});
Expand All @@ -67,7 +67,7 @@ const lapisRequestMocks = {
},
aminoAcidMutations: (statusCode: number = 200, response: MutationsResponse | LapisError) => {
testServer.use(
http.post(`${testConfig.serverSide.lapisUrls.dummy}/aminoAcidMutations`, () => {
http.post(`${testConfig.serverSide.lapisUrls.dummy}/sample/aminoAcidMutations`, () => {
return new Response(JSON.stringify(response), {
status: statusCode,
});
Expand All @@ -76,7 +76,7 @@ const lapisRequestMocks = {
},
nucleotideInsertions: (statusCode: number = 200, response: InsertionsResponse | LapisError) => {
testServer.use(
http.post(`${testConfig.serverSide.lapisUrls.dummy}/nucleotideInsertions`, () => {
http.post(`${testConfig.serverSide.lapisUrls.dummy}/sample/nucleotideInsertions`, () => {
return new Response(JSON.stringify(response), {
status: statusCode,
});
Expand All @@ -85,7 +85,7 @@ const lapisRequestMocks = {
},
aminoAcidInsertions: (statusCode: number = 200, response: InsertionsResponse | LapisError) => {
testServer.use(
http.post(`${testConfig.serverSide.lapisUrls.dummy}/aminoAcidInsertions`, () => {
http.post(`${testConfig.serverSide.lapisUrls.dummy}/sample/aminoAcidInsertions`, () => {
return new Response(JSON.stringify(response), {
status: statusCode,
});
Expand Down

0 comments on commit a376cf7

Please sign in to comment.