From 792bf861815d1a0a739b6fae8dd743461f64b493 Mon Sep 17 00:00:00 2001 From: Nick Stokoe Date: Thu, 24 Oct 2024 12:40:16 +0100 Subject: [PATCH] [back-end] rename getDataset as getDatasetLocations Tests pass --- apps/back-end/src/routes.ts | 6 +++--- apps/back-end/test/plugin.test.ts | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/apps/back-end/src/routes.ts b/apps/back-end/src/routes.ts index 40eaa87d..cafbb8a2 100644 --- a/apps/back-end/src/routes.ts +++ b/apps/back-end/src/routes.ts @@ -85,11 +85,11 @@ export function MykomapRouter( // Construct and return the implementation object return { - async getDataset({ params: { datasetId }, request, reply }) { + async getDatasetLocations({ params: { datasetId }, request, reply }) { // Validate the parameters some more if (!sendJson(request, reply, filePath("datasets", datasetId))) - throw new TsRestResponseError(contract.getDataset, { + throw new TsRestResponseError(contract.getDatasetLocations, { status: 404, body: { message: `unknown datasetId '${datasetId}'` }, }); @@ -141,7 +141,7 @@ export function MykomapRouter( // Validate the parameters some more if (!sendJson(request, reply, filePath("datasets", datasetId, "config"))) - throw new TsRestResponseError(contract.getDataset, { + throw new TsRestResponseError(contract.getConfig, { status: 404, body: { message: `unknown datasetId '${datasetId}'` }, }); diff --git a/apps/back-end/test/plugin.test.ts b/apps/back-end/test/plugin.test.ts index f43a3bae..851db9b9 100644 --- a/apps/back-end/test/plugin.test.ts +++ b/apps/back-end/test/plugin.test.ts @@ -17,7 +17,7 @@ const opts: MykomapRouterConfig = { // // Operation: dataset -// URL: /dataset/:datasetId +// URL: /dataset/:datasetId/locations // summary: obtains a dataset // req.params // type: object @@ -54,7 +54,7 @@ test("testing dataset", async (t) => { const res = await fastify.inject({ method: "GET", - url: "/dataset/test-A", + url: "/dataset/test-A/locations", payload: undefined, headers: undefined, });