- Ensure headcodes and trainUIDs can be accepted in lower case.
- Remove testing endpoints - Add deprecation notices to APIv1 functions Signed-off-by: Fred Boniface <fred@fjla.uk>
This commit is contained in:
parent
47056d2dae
commit
4b69dc3af5
2
app.js
2
app.js
@ -20,14 +20,12 @@ const authenticate = require("./src/middlewares/auth.middlewares");
|
|||||||
|
|
||||||
// Internal Requires
|
// Internal Requires
|
||||||
const version = require("./src/configs/version.configs");
|
const version = require("./src/configs/version.configs");
|
||||||
//const trainRtr = require("./src/routes/train.routes");
|
|
||||||
const pis2Rtr = require("./src/routes/pis.routes"); // API Version 2 Routes
|
const pis2Rtr = require("./src/routes/pis.routes"); // API Version 2 Routes
|
||||||
const ref2Rtr = require("./src/routes/ref.routes"); // API Version 2 Routes
|
const ref2Rtr = require("./src/routes/ref.routes"); // API Version 2 Routes
|
||||||
const live2Rtr = require("./src/routes/live.routes"); // API Version 2 Routes
|
const live2Rtr = require("./src/routes/live.routes"); // API Version 2 Routes
|
||||||
const tt2Rtr = require("./src/routes/timetable.routes"); // API Version 2
|
const tt2Rtr = require("./src/routes/timetable.routes"); // API Version 2
|
||||||
const user2Rtr = require("./src/routes/user.routes"); // API Version 2 Routes
|
const user2Rtr = require("./src/routes/user.routes"); // API Version 2 Routes
|
||||||
const miscRtr = require("./src/routes/misc.routes"); // Non-Public API Routes
|
const miscRtr = require("./src/routes/misc.routes"); // Non-Public API Routes
|
||||||
const testRtr = require("./src/routes/test.routes");
|
|
||||||
|
|
||||||
// Set Server Configurations
|
// Set Server Configurations
|
||||||
const srvListen = process.env.OWL_SRV_LISTEN || "0.0.0.0";
|
const srvListen = process.env.OWL_SRV_LISTEN || "0.0.0.0";
|
||||||
|
@ -47,14 +47,8 @@ async function random(req, res, next) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function testingTiplocArray(req, res, next) {
|
|
||||||
let array = JSON.parse(req.params.array);
|
|
||||||
res.json(await pis.findByTiplocArray(array));
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
byStartEndCRS,
|
byStartEndCRS,
|
||||||
byCode,
|
byCode,
|
||||||
random,
|
random,
|
||||||
testingTiplocArray,
|
|
||||||
};
|
};
|
||||||
|
@ -1,6 +1,10 @@
|
|||||||
|
import { logger } from "../utils/logger.utils";
|
||||||
|
|
||||||
const train = require("../services/trainService.services");
|
const train = require("../services/trainService.services");
|
||||||
|
|
||||||
async function getByHeadcodeToday(req, res, next) {
|
async function getByHeadcodeToday(req, res, next) {
|
||||||
|
// Deprecated - for future removal.
|
||||||
|
logger.warn("Deprecated Function Called - trainService.services-getByHeadcodeToday")
|
||||||
if (!req.isAuthed) {
|
if (!req.isAuthed) {
|
||||||
const err = new Error("Unauthorized");
|
const err = new Error("Unauthorized");
|
||||||
err.status = 401;
|
err.status = 401;
|
||||||
|
@ -5,6 +5,5 @@ const pisCtr = require("../controllers/pis.controllers");
|
|||||||
// PIS
|
// PIS
|
||||||
router.get("/byCode/:code", pisCtr.byCode);
|
router.get("/byCode/:code", pisCtr.byCode);
|
||||||
router.get("/byStartEnd/:startCrs/:endCrs", pisCtr.byStartEndCRS);
|
router.get("/byStartEnd/:startCrs/:endCrs", pisCtr.byStartEndCRS);
|
||||||
router.get("/test/bytiplocarray/:array", pisCtr.testingTiplocArray);
|
|
||||||
|
|
||||||
module.exports = router;
|
module.exports = router;
|
||||||
|
@ -33,7 +33,7 @@ export async function findByHeadcode(
|
|||||||
const shortDay = getShortDay(searchDate);
|
const shortDay = getShortDay(searchDate);
|
||||||
|
|
||||||
const query = {
|
const query = {
|
||||||
headcode: sanitizedHeadcode,
|
headcode: sanitizedHeadcode.toUpperCase(),
|
||||||
scheduleStartDate: { $lte: searchDate },
|
scheduleStartDate: { $lte: searchDate },
|
||||||
scheduleEndDate: { $gte: searchDate },
|
scheduleEndDate: { $gte: searchDate },
|
||||||
daysRun: { $in: [shortDay] },
|
daysRun: { $in: [shortDay] },
|
||||||
@ -64,7 +64,7 @@ export async function findByTrainUid(
|
|||||||
|
|
||||||
// Build query
|
// Build query
|
||||||
const query = {
|
const query = {
|
||||||
trainUid: uid,
|
trainUid: uid.toUpperCase(),
|
||||||
scheduleStartDate: { $lte: queryDate },
|
scheduleStartDate: { $lte: queryDate },
|
||||||
scheduleEndDate: { $gte: queryDate },
|
scheduleEndDate: { $gte: queryDate },
|
||||||
daysRun: { $in: [getShortDay(queryDate)] },
|
daysRun: { $in: [getShortDay(queryDate)] },
|
||||||
|
Loading…
Reference in New Issue
Block a user