Renaming the variable
This commit is contained in:
1 parent
3e6b9049ec
commit
7db5433361
2 files changed
+6
-6
No files matched your search
@@ -42,13 +42,13 @@ const getChecks = async (req, res, next) => {
|
||||
return;
|
||||
}
|
||||
|
||||
let limitedTo = null;
|
||||
let limit = null;
|
||||
|
||||
try {
|
||||
if (req.query && req.query.limit) {
|
||||
limitedTo = parseInt(req.query.limit);
|
||||
limit = parseInt(req.query.limit);
|
||||
}
|
||||
const checks = await req.db.getChecks(req.params.monitorId, limitedTo);
|
||||
const checks = await req.db.getChecks(req.params.monitorId, limit);
|
||||
return res
|
||||
.status(200)
|
||||
.json({ success: true, msg: successMessages.CHECK_GET, data: checks });
|
||||
|
||||
@@ -414,10 +414,10 @@ const createCheck = async (checkData) => {
|
||||
* @throws {Error}
|
||||
*/
|
||||
|
||||
const getChecks = async (monitorId, limitedTo) => {
|
||||
const getChecks = async (monitorId, limit) => {
|
||||
try {
|
||||
if (limitedTo) {
|
||||
const checks = await Check.find({ monitorId }).sort({ createdAt: -1 }).limit(limitedTo);
|
||||
if (limit) {
|
||||
const checks = await Check.find({ monitorId }).sort({ createdAt: -1 }).limit(limit);
|
||||
return checks;
|
||||
}
|
||||
const checks = await Check.find({ monitorId })
|
||||
|
||||
Reference in new issue
Block a user