Update delete all method

This commit is contained in:
Alex Holliday committed 2024-09-11 11:22:33 +08:00
1 parent a89777333a
commit 3f5dc337a0
3 files changed
+18 -7

No files matched your search

+5 -3
View File
@@ -451,10 +451,12 @@ const deleteMonitor = async (req, res) => {
* DELETE ALL MONITORS (TEMP)
*/
const deleteAllMonitors = async (req, res) => {
const deleteAllMonitors = async (teamId) => {
try {
const deletedCount = await Monitor.deleteMany({});
return deletedCount.deletedCount;
const monitors = await Monitor.find({ teamId });
const { deletedCount } = await Monitor.deleteMany({ teamId });
return { monitors, deletedCount };
} catch (error) {
throw error;
}