diff --git a/src/routes/bulk-add-route.ts b/src/routes/bulk-add-route.ts index e34e59cf..522bbbdb 100644 --- a/src/routes/bulk-add-route.ts +++ b/src/routes/bulk-add-route.ts @@ -31,11 +31,6 @@ export const bulkAddRouter = createRoute( bulkRouteModel, async (request, app, params) => { - // TODO: DELETE as not used - if (typeof params === 'undefined' || typeof params.UID !== 'string') { - throw new Error('UID of Bulk was not given, but route with obligatory parameter was called'); - } - const bulkMemory: BulkStorage = app.get('bulk'); const bulk = await bulkMemory.read(params.UID); diff --git a/src/routes/bulk-done-route.ts b/src/routes/bulk-done-route.ts index 4f979f73..5e8c1f55 100644 --- a/src/routes/bulk-done-route.ts +++ b/src/routes/bulk-done-route.ts @@ -31,11 +31,6 @@ export const bulkDoneRouter = createRoute bulkDoneRouteModel, async (_request, app, params) => { - // TODO: DELETE as not used - if (typeof params === 'undefined' || typeof params.UID !== 'string') { - throw new Error('UID of Bulk was not given, but route with obligatory parameter was called'); - } - const bulkMemory: BulkStorage = app.get('bulk'); const bulk = await bulkMemory.read(params.UID); diff --git a/src/routes/route.ts b/src/routes/route.ts index acf7accb..3de475a3 100644 --- a/src/routes/route.ts +++ b/src/routes/route.ts @@ -29,7 +29,7 @@ import {isHttpMethod} from './http-types'; /** * Creates a router from a route class and a handler function which implements the logic * - * The given router performs a request and respone validation, sets status codes and checks if the given handler + * The given router performs a request and response validation, sets status codes and checks if the given handler * only returns errors that are allowed for the client to see * * @param routeClass Model of a route @@ -39,7 +39,7 @@ export function createRoute( routeClass: SCRoute, handler: ( validatedBody: REQUESTTYPE, - app: Application, params?: { [parameterName: string]: string; }, + app: Application, params: { [parameterName: string]: string; }, ) => Promise, ): Router { // create router @@ -49,23 +49,6 @@ export function createRoute( // the given type has no index signature so we have to cast to get the IRouteHandler when a HTTP method is given const route = router.route(routeClass.urlFragment); - // get route parameters (path parameters) TODO: DELETE as not used - if (Array.isArray(routeClass.obligatoryParameters) && routeClass.obligatoryParameters.length > 0) { - routeClass.obligatoryParameters.forEach((parameterName) => { - router.param(parameterName, async (req, _res, next, parameterValue: string) => { - - if (typeof req.params === 'undefined') { - req.params = {}; - } - - // set parameter values on request object - req.params[parameterName] = parameterValue; - // hand over the request to the next handler (our method route handler) - next(); - }); - }); - } - const verb = routeClass.method.toLowerCase(); // check if route has a valid http verb