eventlog getAllPaged is now getByQueryPaged

This commit is contained in:
Johannes Zellner
2016-05-06 17:27:52 +02:00
parent 4fa8ab596b
commit 3af95508f5
4 changed files with 8 additions and 44 deletions

View File

@@ -18,17 +18,9 @@ function get(req, res, next) {
if (req.query.action && typeof req.query.action !== 'string') return next(new HttpError(400, 'action must be a string'));
if (req.query.search && typeof req.query.search !== 'string') return next(new HttpError(400, 'search must be a string'));
if (req.query.action || req.query.search) {
eventlog.getByQueryPaged(req.query.action || null, req.query.search || null, page, perPage, function (error, result) {
if (error) return next(new HttpError(500, error));
eventlog.getAllPaged(req.query.action || null, req.query.search || null, page, perPage, function (error, result) {
if (error) return next(new HttpError(500, error));
next(new HttpSuccess(200, { eventlogs: result }));
});
} else {
eventlog.getAllPaged(page, perPage, function (error, result) {
if (error) return next(new HttpError(500, error));
next(new HttpSuccess(200, { eventlogs: result }));
});
}
next(new HttpSuccess(200, { eventlogs: result }));
});
}