Skip to content

Commit

Permalink
Changed order of reports params for consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasholderness committed Feb 24, 2017
1 parent 9fd6a48 commit c63e888
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/api/routes/reports/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export default ({ config, db, logger }) => {
geoformat: Joi.any().valid(config.GEO_FORMATS).default(config.GEO_FORMAT_DEFAULT)
}
}),
(req, res, next) => reports(config, db, logger).all(req.query.city,req.query.timeperiod)
(req, res, next) => reports(config, db, logger).all(req.query.timeperiod, req.query.city)
.then((data) => handleGeoResponse(data, req, res, next))
.catch((err) => {
logger.error(err);
Expand Down
9 changes: 6 additions & 3 deletions src/api/routes/reports/model.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@ import Promise from 'bluebird';

export default (config, db, logger) => ({

// Return all reports within the defined max period
// Optional: city (Petabencana.id Instance Region 3 letter code)
all: (city,timeperiod) => new Promise((resolve, reject) => {
/**
* Return all reports within a defined time period, and optionally city
* @param {integer} timeperiod Length of time period in seconds
* @param {string} city Optional, instance region code (e.g. 'jbd')
*/
all: (timeperiod, city) => new Promise((resolve, reject) => {

// Setup query
let query = `SELECT pkey, created_at, source,
Expand Down

0 comments on commit c63e888

Please sign in to comment.