21 lines
814 B
JavaScript
21 lines
814 B
JavaScript
const debug=require('debug')('trip-count-day-agency');
|
|
const express = require('express');
|
|
const router = express.Router();
|
|
const tripCountDayAgency = require('../service/trip-count-day-agency');
|
|
const utils=require('../utils');
|
|
router.get('/', async function(req, res, next) {
|
|
//debug('trip-count-day-agency start...');
|
|
const agencyId=req.query.agencyid;
|
|
//debug(`trip-count-day-agency agency id: ${agencyId}`);
|
|
const day=req.query.day;
|
|
//debug(`trip-count-day-agency day: ${day}`);
|
|
try {
|
|
res.json(await tripCountDayAgency.get(agencyId, day));
|
|
} catch (err) {
|
|
console.error(`Error while getting trip calendar by agency_id, msg: `, err.message);
|
|
res.status(err.statusCode || 500).json(utils.MSGS.error);
|
|
}
|
|
//debug('trip-count-day-agency done.');
|
|
});
|
|
module.exports = router;
|