feat: ORDER BY agency_id or route_short_name or trip_short_name (sth static)

This commit is contained in:
dancingCycle 2024-01-30 07:37:26 +01:00
parent 4d8856d7cc
commit b3462b2da0
5 changed files with 6 additions and 6 deletions

View File

@ -12,8 +12,8 @@ REST API to request GTFS data from postgres database
Requirements:
* Node.js <=18.13.0
* PostgreSQL database
* Node.js
* PostgreSQL dbms
* Check [dependencies](./package.json)
# Quick Start Guide

View File

@ -6,7 +6,7 @@ async function get() {
const schema = process.env.DB_SCHEMA || 'schema';
const query = 'SELECT * FROM ' + schema + '.tbl_rts_stps_trps_cnt;';
const query = 'SELECT * FROM ' + schema + '.tbl_rts_stps_trps_cnt ORDER BY agency_name;';
return await db.query( query );
};

View File

@ -20,7 +20,7 @@ async function get(agencyid = 0, day = '2023-12-27') {
+ schema
+ `.vw_join_gncy_rts_trps_srvcs_pdts WHERE dates like '%${day}%' AND agency_id = '${agencyid}' AND ((timestamp_pgsql >= '${day}' AND timestamp_pgsql < '`
+ tomorrow.toISOString().substring(0, 10)
+ `') OR timestamp_pgsql IS NULL) GROUP BY route_id, route_short_name, agency_id, agency_name ORDER BY timestamp_pgsql ASC, route_short_name ASC;`
+ `') OR timestamp_pgsql IS NULL) GROUP BY route_id, route_short_name, agency_id, agency_name ORDER BY agency_name ASC, route_short_name ASC;`
return await db.query(query);
};

View File

@ -20,7 +20,7 @@ async function get(day = '2024-01-21') {
+ schema
+ `.vw_join_gncy_rts_trps_srvcs_pdts WHERE dates like '%${day}%' AND ((timestamp_pgsql >= '${day}' AND timestamp_pgsql < '`
+ tomorrow.toISOString().substring(0, 10)
+ `') OR timestamp_pgsql IS NULL) GROUP BY agency_name, agency_id ORDER BY timestamp_pgsql ASC;`;
+ `') OR timestamp_pgsql IS NULL) GROUP BY agency_name, agency_id ORDER BY agency_name ASC;`
return await db.query(query);
};

View File

@ -18,7 +18,7 @@ async function get(routeid = 0, day = '2023-12-16') {
+ schema
+ `.vw_join_gncy_rts_trps_srvcs_pdts WHERE dates like '%${day}%' AND route_id = '${routeid}' AND ((timestamp_pgsql >= '${day}' AND timestamp_pgsql < '`
+ tomorrow.toISOString().substring(0, 10)
+ `') OR timestamp_pgsql IS NULL) ORDER BY timestamp_pgsql, route_short_name ASC;`
+ `') OR timestamp_pgsql IS NULL) ORDER BY agency_name ASC, route_short_name ASC, trip_short_name ASC;`
return await db.query(query);
};