fix: UPDATE route routes-by-agency-id

This commit is contained in:
dancingCycle 2023-11-24 14:58:46 +01:00
parent 74c8bef18c
commit f3a5a31240
2 changed files with 5 additions and 12 deletions

View File

@ -209,6 +209,7 @@ APP.use('/trips-oset-limit',tripsOsetLimit);
APP.use('/routes',routesByAgencyId);
//count
//get route count by providing agency_id
APP.use('/route-count', ROUTECOUNT);
APP.use('/trip-count', TRIPCOUNT);
APP.use('/number-of-routes', numberOfRoutes);

View File

@ -1,21 +1,13 @@
const debug=require('debug')('debug');
require('dotenv').config();
const db = require('./db');
async function get(agencyId = 0) {
//debug('routes-by-agency-id start...');
//debug('agencyId: '+agencyId);
const schema = process.env.DB_SCHEMA || 'schema';
debug('schema: ' + schema );
const query = `SELECT routes.route_id FROM ` + schema + `.routes WHERE agency_id='${agencyId}';`;
return await db.query(query);
};
const QUERY=`SELECT routes.route_id FROM ` + schema + `.routes WHERE agency_id='${agencyId}';`
//debug('QUERY: '+QUERY);
const res=await db.query(QUERY);
//debug('routes-by-agency-id done.');
return res;
}
module.exports = {
get
}
};