TimetableAPI-Upgrade #64
2
app.js
2
app.js
@ -20,14 +20,12 @@ const authenticate = require("./src/middlewares/auth.middlewares");
|
||||
|
||||
// Internal Requires
|
||||
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 ref2Rtr = require("./src/routes/ref.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 user2Rtr = require("./src/routes/user.routes"); // API Version 2 Routes
|
||||
const miscRtr = require("./src/routes/misc.routes"); // Non-Public API Routes
|
||||
const testRtr = require("./src/routes/test.routes");
|
||||
|
||||
// Set Server Configurations
|
||||
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 = {
|
||||
byStartEndCRS,
|
||||
byCode,
|
||||
random,
|
||||
testingTiplocArray,
|
||||
};
|
||||
|
@ -1,6 +1,10 @@
|
||||
import { logger } from "../utils/logger.utils";
|
||||
|
||||
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;
|
||||
|
@ -5,6 +5,5 @@ const pisCtr = require("../controllers/pis.controllers");
|
||||
// PIS
|
||||
router.get("/byCode/:code", pisCtr.byCode);
|
||||
router.get("/byStartEnd/:startCrs/:endCrs", pisCtr.byStartEndCRS);
|
||||
router.get("/test/bytiplocarray/:array", pisCtr.testingTiplocArray);
|
||||
|
||||
module.exports = router;
|
||||
|
@ -33,7 +33,7 @@ export async function findByHeadcode(
|
||||
const shortDay = getShortDay(searchDate);
|
||||
|
||||
const query = {
|
||||
headcode: sanitizedHeadcode,
|
||||
headcode: sanitizedHeadcode.toUpperCase(),
|
||||
scheduleStartDate: { $lte: searchDate },
|
||||
scheduleEndDate: { $gte: searchDate },
|
||||
daysRun: { $in: [shortDay] },
|
||||
@ -64,7 +64,7 @@ export async function findByTrainUid(
|
||||
|
||||
// Build query
|
||||
const query = {
|
||||
trainUid: uid,
|
||||
trainUid: uid.toUpperCase(),
|
||||
scheduleStartDate: { $lte: queryDate },
|
||||
scheduleEndDate: { $gte: queryDate },
|
||||
daysRun: { $in: [getShortDay(queryDate)] },
|
||||
|
Loading…
Reference in New Issue
Block a user