extract reactors and pipeline
This commit is contained in:
1 parent
7ee30e12f5
commit
ee9c08b1bb
9 files changed
+380
-234
No files matched your search
@@ -0,0 +1,13 @@
|
||||
import { INotificationsService } from "@/domain/notifications/notification.service.js";
|
||||
import { IMonitorReactor } from "@/worker/reactors/reactor.interface.js";
|
||||
import { MonitorEvaluation } from "@/worker/worker.interface.js";
|
||||
export class NotificationReactor implements IMonitorReactor {
|
||||
readonly name = "notification";
|
||||
readonly blocking = false;
|
||||
constructor(private notificationService: INotificationsService) {}
|
||||
|
||||
react = async (evaluation: MonitorEvaluation) => {
|
||||
if (!evaluation.decision.shouldSendNotification) return;
|
||||
await this.notificationService.handleNotifications(evaluation.monitor, evaluation.status, evaluation.decision);
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user