Add customization to limiting
This commit is contained in:
1 parent
98be150d6d
commit
3e6b9049ec
2 files changed
+12
-3
No files matched your search
@@ -414,9 +414,13 @@ const createCheck = async (checkData) => {
|
||||
* @throws {Error}
|
||||
*/
|
||||
|
||||
const getChecks = async (monitorId) => {
|
||||
const getChecks = async (monitorId, limitedTo) => {
|
||||
try {
|
||||
const checks = await Check.find({ monitorId }).sort({ createdAt: -1 }).limit(25);
|
||||
if (limitedTo) {
|
||||
const checks = await Check.find({ monitorId }).sort({ createdAt: -1 }).limit(limitedTo);
|
||||
return checks;
|
||||
}
|
||||
const checks = await Check.find({ monitorId })
|
||||
return checks;
|
||||
} catch (error) {
|
||||
throw error;
|
||||
|
||||
Reference in new issue
Block a user