Skip to content

Commit

Permalink
move default parameters from db/ip to dataController
Browse files Browse the repository at this point in the history
  • Loading branch information
matyaskopp committed Nov 30, 2021
1 parent e84ba40 commit e6d878c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
11 changes: 9 additions & 2 deletions app/controllers/dataController.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,17 @@ exports.getUsers = (userId) => {
});
};

exports.getTopIPs = (userId) => {
exports.getTopIPs = ( userId,
filter={},
period_start = (new Date().getFullYear())+'-01-01 00:00:00',
period_end = (new Date().getFullYear() + 1)+'-01-01 00:00:00',
measure='units',
level='month',
min_exist = 0
) => {
logger.trace();
return new promise((resolve, reject) => {
db.ip.getTop()
db.ip.getTop(filter,period_start,period_end,measure,level,min_exist)
.then(data => {
db.user.logAction(userId, 'listIPs');
resolve(data);
Expand Down
12 changes: 6 additions & 6 deletions app/db/ip.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,12 @@ function createFilter(filter){



exports.getTop = (filter={},
period_start = (new Date().getFullYear())+'-01-01 00:00:00',
period_end = (new Date().getFullYear() + 1)+'-01-01 00:00:00',
measure='units',
level='month',
min_exist = 0
exports.getTop = (filter,
period_start,
period_end,
measure,
level,
min_exist
) => {
logger.trace();
logger.warn('db.ip.getTop() uses only default settings !!!');
Expand Down

0 comments on commit e6d878c

Please sign in to comment.