fix: UPDATE route route-short-name
This commit is contained in:
parent
a833b9513e
commit
c9f92d8885
|
@ -214,6 +214,7 @@ APP.use('/trip-count', TRIPCOUNT);
|
|||
APP.use('/number-of-routes', numberOfRoutes);
|
||||
APP.use('/number-of-trips', numberOfTrips);
|
||||
|
||||
//get route_short-name by providing trip_short_name
|
||||
APP.use('/route-short-name', ROUTESHORTNAME);
|
||||
|
||||
APP.use('/pt-by-ifleet', ptByIfleet);
|
||||
|
|
|
@ -9,7 +9,7 @@ const db = require('./db');
|
|||
*/
|
||||
async function get() {
|
||||
const schema = process.env.DB_SCHEMA || 'schema';
|
||||
const query = 'SELECT agency.agency_id, agency.agency_name FROM ' + schema + '.agency;'
|
||||
const query = 'SELECT agency.agency_id, agency.agency_name FROM ' + schema + '.agency ORDER BY agency_name;'
|
||||
return await db.query(query );
|
||||
}
|
||||
module.exports = {
|
||||
|
|
|
@ -1,18 +1,13 @@
|
|||
const DEBUG=require('debug')('route-short-name');
|
||||
DEBUG('route-short-name start...');
|
||||
require('dotenv').config();
|
||||
|
||||
const db = require('./db');
|
||||
|
||||
async function getRouteShortName(tripshortname = 0) {
|
||||
DEBUG('tripshortname: '+tripshortname);
|
||||
const QUERY=`SELECT routes.route_short_name FROM routes, trips WHERE trips.trip_short_name='${tripshortname}' AND routes.route_id=trips.route_id;`
|
||||
//DEBUG('QUERY: '+QUERY);
|
||||
const ROUTESHORTNAME = await db.query(QUERY);
|
||||
DEBUG('ROUTESHORTNAME: '+ROUTESHORTNAME[0].route_short_name);
|
||||
return ROUTESHORTNAME;
|
||||
}
|
||||
const schema = process.env.DB_SCHEMA || 'schema';
|
||||
const query=`SELECT routes.route_short_name FROM ` + schema + `.routes, ` + schema + `.trips WHERE trips.trip_short_name='${tripshortname}' AND routes.route_id=trips.route_id;`
|
||||
return await db.query(query);
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
getRouteShortName
|
||||
}
|
||||
DEBUG('route-short-name done.');
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue