feat(api): add routes stop-names-part-gi, stop-names-no-gi, stop-names-count-part-gi, stop-names-count-no-gi
This commit is contained in:
parent
e1a6c977f3
commit
4478622035
|
@ -16,6 +16,12 @@ const STOPS_GTFS_DE_ROUTER = require('./route/gtfs-stops-de');
|
|||
const STOPS_GTFS_DE_NO_GI_ROUTER = require('./route/gtfs-stops-de-not-dhid');
|
||||
const STOPS_GTFS_DE_NO_GI_REFINE_ROUTER = require('./route/gtfs-stops-de-not-dhid-refine');
|
||||
|
||||
const STOP_NAME_COUNT_NO_GI_ROUTER = require('./route/stop-names-count-no-gi');
|
||||
const STOP_NAME_COUNT_PART_GI_ROUTER = require('./route/stop-names-count-part-gi');
|
||||
|
||||
const STOP_NAME_NO_GI_ROUTER = require('./route/stop-names-no-gi');
|
||||
const STOP_NAME_PART_GI_ROUTER = require('./route/stop-names-part-gi');
|
||||
|
||||
const STOPS_COUNT_GTFS_LT_0 = require('./route/stops-count-gtfs-lt-0');
|
||||
|
||||
const STOPS_COUNT_GTFS = require('./route/stops-count-gtfs');
|
||||
|
@ -106,6 +112,12 @@ APP.use('/stops-count-gtfs',STOPS_COUNT_GTFS);
|
|||
APP.use('/stops-count-gtfs-de',STOPS_COUNT_GTFS_DE);
|
||||
APP.use('/stops-count-gtfs-de-not-dhid',STOPS_COUNT_GTFS_DE_NO_GI);
|
||||
|
||||
APP.use('/stop-names-count-no-gi',STOP_NAME_COUNT_NO_GI_ROUTER);
|
||||
APP.use('/stop-names-count-part-gi',STOP_NAME_COUNT_PART_GI_ROUTER);
|
||||
|
||||
APP.use('/stop-names-no-gi',STOP_NAME_NO_GI_ROUTER);
|
||||
APP.use('/stop-names-part-gi',STOP_NAME_PART_GI_ROUTER);
|
||||
|
||||
APP.use('/stops-count-gtfs-de-hb',STOPS_COUNT_GTFS_DE_HB);
|
||||
APP.use('/stops-count-gtfs-de-hh',STOPS_COUNT_GTFS_DE_HH);
|
||||
APP.use('/stops-count-gtfs-de-ni',STOPS_COUNT_GTFS_DE_NI);
|
||||
|
@ -147,3 +159,18 @@ module.exports=APP;
|
|||
|
||||
//end
|
||||
debug('api done..');
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
const EXPRESS = require('express');
|
||||
const ROUTER = EXPRESS.Router();
|
||||
const STOPS_DE_OSET_LIMIT = require('../service/gtfs-stops-de-oset-limit');
|
||||
const express = require('express');
|
||||
const router = express.Router();
|
||||
const stopsDeOsetLimit = require('../service/gtfs-stops-de-oset-limit');
|
||||
const UTILS=require('../utils');
|
||||
|
||||
//GET listing
|
||||
ROUTER.get('/', async function(req, res, next) {
|
||||
router.get('/', async function(req, res, next) {
|
||||
try {
|
||||
res.json(await STOPS_DE_OSET_LIMIT.get(req.query.oset, req.query.limit));
|
||||
res.json(await stopsDeOsetLimit.get(req.query.oset, req.query.limit));
|
||||
} catch (err) {
|
||||
console.error(`Error while getting data with oset and limit `, err.message);
|
||||
console.error(`Error while getting stops de with oset and limit `, err.message);
|
||||
res.status(err.statusCode || 500).json(UTILS.MSGS.error);
|
||||
}
|
||||
});
|
||||
|
||||
module.exports = ROUTER;
|
||||
module.exports = router;
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
const express = require('express');
|
||||
const router = express.Router();
|
||||
const stopNames = require('../service/stop-names-count-no-gi');
|
||||
const utils=require('../utils');
|
||||
|
||||
//GET listing
|
||||
router.get('/', async function(req, res, next) {
|
||||
try {
|
||||
res.json(await stopNames.get(req.query.state));
|
||||
} catch (err) {
|
||||
console.error(`Error while getting stop names with oset and limit `, err.message);
|
||||
res.status(err.statusCode || 500).json(utils.MSGS.error);
|
||||
}
|
||||
});
|
||||
|
||||
module.exports = router;
|
|
@ -0,0 +1,16 @@
|
|||
const express = require('express');
|
||||
const router = express.Router();
|
||||
const stopNames = require('../service/stop-names-count-part-gi');
|
||||
const utils=require('../utils');
|
||||
|
||||
//GET listing
|
||||
router.get('/', async function(req, res, next) {
|
||||
try {
|
||||
res.json(await stopNames.get(req.query.state));
|
||||
} catch (err) {
|
||||
console.error(`Error while getting stop names with oset and limit `, err.message);
|
||||
res.status(err.statusCode || 500).json(utils.MSGS.error);
|
||||
}
|
||||
});
|
||||
|
||||
module.exports = router;
|
|
@ -0,0 +1,16 @@
|
|||
const express = require('express');
|
||||
const router = express.Router();
|
||||
const stopNames = require('../service/stop-names-no-gi');
|
||||
const utils=require('../utils');
|
||||
|
||||
//GET listing
|
||||
router.get('/', async function(req, res, next) {
|
||||
try {
|
||||
res.json(await stopNames.get(req.query.state));
|
||||
} catch (err) {
|
||||
console.error(`Error while getting stop names with oset and limit `, err.message);
|
||||
res.status(err.statusCode || 500).json(utils.MSGS.error);
|
||||
}
|
||||
});
|
||||
|
||||
module.exports = router;
|
|
@ -0,0 +1,16 @@
|
|||
const express = require('express');
|
||||
const router = express.Router();
|
||||
const stopNames = require('../service/stop-names-part-gi');
|
||||
const utils=require('../utils');
|
||||
|
||||
//GET listing
|
||||
router.get('/', async function(req, res, next) {
|
||||
try {
|
||||
res.json(await stopNames.get(req.query.state));
|
||||
} catch (err) {
|
||||
console.error(`Error while getting stop names with oset and limit `, err.message);
|
||||
res.status(err.statusCode || 500).json(utils.MSGS.error);
|
||||
}
|
||||
});
|
||||
|
||||
module.exports = router;
|
|
@ -0,0 +1,23 @@
|
|||
const debug=require('debug')('debug');
|
||||
const db = require('./db');
|
||||
|
||||
require('dotenv').config();
|
||||
|
||||
async function get(state = 'bb') {
|
||||
debug('stop-names-count-no-gi start...');
|
||||
|
||||
const schema = process.env.DB_SCHEMA || 'schema';
|
||||
debug('stop-names-count-no-gi schema: ' + schema);
|
||||
debug('stop-names-count-no-gi state: ' + state);
|
||||
|
||||
const query = 'SELECT count(count_id) FROM ' + schema + '.tbl_gtfs_stop_names_de_' + state + '_no_dhid;'
|
||||
debug('stop-names-count-no-gi query: ' + query);
|
||||
|
||||
const data = await db.query(query);
|
||||
|
||||
debug('stop-names-count-no-gi done.');
|
||||
return data;
|
||||
};
|
||||
module.exports = {
|
||||
get
|
||||
};
|
|
@ -0,0 +1,23 @@
|
|||
const debug=require('debug')('debug');
|
||||
const db = require('./db');
|
||||
|
||||
require('dotenv').config();
|
||||
|
||||
async function get(state = 'bb') {
|
||||
debug('stop-names-count-part-gi start...');
|
||||
|
||||
const schema = process.env.DB_SCHEMA || 'schema';
|
||||
debug('stop-names-count-part-gi schema: ' + schema);
|
||||
debug('stop-names-count-part-gi state: ' + state);
|
||||
|
||||
const query = 'SELECT count(count_id) FROM ' + schema + '.tbl_gtfs_stop_names_de_' + state + '_part_dhid;'
|
||||
debug('stop-names-count-part-gi query: ' + query);
|
||||
|
||||
const data = await db.query(query);
|
||||
|
||||
debug('stop-names-count-part-gi done.');
|
||||
return data;
|
||||
};
|
||||
module.exports = {
|
||||
get
|
||||
};
|
|
@ -0,0 +1,23 @@
|
|||
const debug=require('debug')('debug');
|
||||
const db = require('./db');
|
||||
|
||||
require('dotenv').config();
|
||||
|
||||
async function get(state = 'bb') {
|
||||
debug('stop-names-count-no-gi start...');
|
||||
|
||||
const schema = process.env.DB_SCHEMA || 'schema';
|
||||
debug('stop-names-count-no-gi schema: ' + schema);
|
||||
debug('stop-names-count-no-gi state: ' + state);
|
||||
|
||||
const query = 'SELECT * FROM ' + schema + '.tbl_gtfs_stop_names_de_' + state + '_no_dhid;'
|
||||
debug('stop-names-count-no-gi query: ' + query);
|
||||
|
||||
const data = await db.query(query);
|
||||
|
||||
debug('stop-names-count-no-gi done.');
|
||||
return data;
|
||||
};
|
||||
module.exports = {
|
||||
get
|
||||
};
|
|
@ -0,0 +1,23 @@
|
|||
const debug=require('debug')('debug');
|
||||
const db = require('./db');
|
||||
|
||||
require('dotenv').config();
|
||||
|
||||
async function get(state = 'bb') {
|
||||
debug('stop-names-count-part-gi start...');
|
||||
|
||||
const schema = process.env.DB_SCHEMA || 'schema';
|
||||
debug('stop-names-count-part-gi schema: ' + schema);
|
||||
debug('stop-names-count-part-gi state: ' + state);
|
||||
|
||||
const query = 'SELECT * FROM ' + schema + '.tbl_gtfs_stop_names_de_' + state + '_part_dhid;'
|
||||
debug('stop-names-count-part-gi query: ' + query);
|
||||
|
||||
const data = await db.query(query);
|
||||
|
||||
debug('stop-names-count-part-gi done.');
|
||||
return data;
|
||||
};
|
||||
module.exports = {
|
||||
get
|
||||
};
|
Loading…
Reference in New Issue