From 8e0b928f27a51cc4ca7d277ec5a1bf494d422956 Mon Sep 17 00:00:00 2001 From: Fred Boniface Date: Fri, 1 Mar 2024 22:16:56 +0000 Subject: [PATCH] Temporarily disable PIS and TRAIN auth reference: https://git.fjla.uk/OwlBoard/backend/issues/71 Signed-off-by: Fred Boniface --- src/configs/version.configs.ts | 2 +- src/controllers/pis.controllers.js | 30 ++++++++++++++-------------- src/controllers/train.controllers.js | 20 +++++++++---------- 3 files changed, 26 insertions(+), 26 deletions(-) diff --git a/src/configs/version.configs.ts b/src/configs/version.configs.ts index 08ce5c4..3dc0d20 100644 --- a/src/configs/version.configs.ts +++ b/src/configs/version.configs.ts @@ -5,7 +5,7 @@ interface versions { const version: versions = { api: ["/api/v2"], - app: "2024.2.3", + app: "2024.3.0", }; module.exports = version; diff --git a/src/controllers/pis.controllers.js b/src/controllers/pis.controllers.js index bdc1e65..2b87874 100644 --- a/src/controllers/pis.controllers.js +++ b/src/controllers/pis.controllers.js @@ -2,11 +2,11 @@ const pis = require("../services/pis.services"); /* Used in /api/v2 */ async function byStartEndCRS(req, res, next) { - if (!req.isAuthed) { - const err = new Error("Unauthorized"); - err.status = 401; - return next(err); - } +// if (!req.isAuthed) { +// const err = new Error("Unauthorized"); +// err.status = 401; +// return next(err); +// } try { let startCrs = req.params.startCrs; let endCrs = req.params.endCrs; @@ -19,11 +19,11 @@ async function byStartEndCRS(req, res, next) { /* Used in /api/v2 */ async function byCode(req, res, next) { - if (!req.isAuthed) { - const err = new Error("Unauthorized"); - err.status = 401; - return next(err); - } +// if (!req.isAuthed) { +// const err = new Error("Unauthorized"); +// err.status = 401; +// return next(err); +// } try { let code = req.params.code; res.json(await pis.findPisByCode(code)); @@ -34,11 +34,11 @@ async function byCode(req, res, next) { } async function random(req, res, next) { - if (!req.isAuthed) { - const err = new Error("Unauthorized"); - err.status = 401; - return next(err); - } +// if (!req.isAuthed) { +// const err = new Error("Unauthorized"); +// err.status = 401; +// return next(err); +// } try { res.json(await pis.findRandom()); } catch (err) { diff --git a/src/controllers/train.controllers.js b/src/controllers/train.controllers.js index 986b59f..fabc1d9 100644 --- a/src/controllers/train.controllers.js +++ b/src/controllers/train.controllers.js @@ -5,11 +5,11 @@ const train = require("../services/trainService.services"); async function getByHeadcodeToday(req, res, next) { // Deprecated - for future removal. logger.warn("Deprecated Function Called - trainService.services-getByHeadcodeToday") - if (!req.isAuthed) { - const err = new Error("Unauthorized"); - err.status = 401; - next(err); - } +// if (!req.isAuthed) { +// const err = new Error("Unauthorized"); +// err.status = 401; +// next(err); +// } try { var searchHeadcode = req.params.id; res.json(await train.findByHeadcodeToday(searchHeadcode)); @@ -21,11 +21,11 @@ async function getByHeadcodeToday(req, res, next) { } async function get(req, res, next) { - if (!req.isAuthed) { - const err = new Error("Unauthorized"); - err.status = 401; - next(err); - } +// if (!req.isAuthed) { +// const err = new Error("Unauthorized"); +// err.status = 401; +// next(err); +// } let date = req.params.date; let searchType = req.params.searchType; let id = req.params.id;