From 901b049c0c2c5c1d2da0d0b23f2b7ad3588c6324 Mon Sep 17 00:00:00 2001 From: Maks Nowak <64966099+f2reninj5@users.noreply.github.com> Date: Tue, 9 Jul 2024 02:16:24 +0100 Subject: [PATCH] Fixed lint error --- server/src/routes/points/index.ts | 6 +++--- server/src/routes/points/point_handlers.ts | 5 +---- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/server/src/routes/points/index.ts b/server/src/routes/points/index.ts index 0c73af71..6301d138 100644 --- a/server/src/routes/points/index.ts +++ b/server/src/routes/points/index.ts @@ -1,10 +1,10 @@ import { Router as ExpressRouter } from "express" import { handleFailedAuthentication, handleMethodNotAllowed, parseRouteId } from "@server/common/middleware" - -import handlers from "./point_handlers" +import PointHandlers from "./point_handlers" const points_router = ExpressRouter() +const handlers = new PointHandlers() points_router .route("/") @@ -15,7 +15,7 @@ points_router points_router .route("/:point_id") .all(parseRouteId("point_id")) - .get(handlers.getPointDetails) + .get(handlers.getPointDetails.bind(handlers)) .patch(handlers.patchPointDetails, handleFailedAuthentication) .delete(handlers.deletePoint, handleFailedAuthentication) .all(handleMethodNotAllowed) diff --git a/server/src/routes/points/point_handlers.ts b/server/src/routes/points/point_handlers.ts index 3e5ae8cd..9e518920 100644 --- a/server/src/routes/points/point_handlers.ts +++ b/server/src/routes/points/point_handlers.ts @@ -29,7 +29,7 @@ point_transform_factories.set("redeemer_id", value => { return { condition: { redeemer_id: parsed_value } } }) -class PointHandlers { +export default class PointHandlers { /** * Handles a GET request to /points. * For transparency, returns a list of points in the database with their values and redeemer's ID. @@ -146,6 +146,3 @@ class PointHandlers { response.json({ status: response.statusCode, message: "OK" }) } } - -const PointHandlersInstance = new PointHandlers() -export default PointHandlersInstance