remove mongo middleware

This commit is contained in:
Alex Holliday committed 2026-01-15 19:36:41 +00:00
1 parent 74a7f0a701
commit 68559741ba
19 files changed
+247 -141

No files matched your search

@@ -5,5 +5,6 @@ export interface IMonitorStatsRepository {
findByMonitorId(monitorId: string): Promise<MonitorStats>;
// update
// delete
deleteByMonitorId(monitorId: string): Promise<MonitorStats>;
// other
}
@@ -39,6 +39,14 @@ class MongoMonitorStatsRepository implements IMonitorStatsRepository {
}
return this.toEntity(monitorStats);
};
deleteByMonitorId = async (monitorId: string) => {
const deleted = await MonitorStatsModel.findOneAndDelete({ monitorId: new mongoose.Types.ObjectId(monitorId) });
if (!deleted) {
throw new AppError({ message: "Monitor stats not found", status: 404 });
}
return this.toEntity(deleted);
};
}
export default MongoMonitorStatsRepository;