fix test alert type
This commit is contained in:
1 parent
e878f51887
commit
15d8a8ba1f
9 files changed
+9
-9
No files matched your search
@@ -3,5 +3,5 @@ import type { NotificationMessage } from "@/types/notificationMessage.js";
|
||||
|
||||
export interface INotificationProvider {
|
||||
sendMessage: (notification: Notification, message: NotificationMessage) => Promise<boolean>;
|
||||
sendTestAlert(notification: Notification): Promise<boolean>;
|
||||
sendTestAlert(notification: Partial<Notification>): Promise<boolean>;
|
||||
}
|
||||
@@ -13,7 +13,7 @@ export class DiscordProvider implements INotificationProvider {
|
||||
this.logger = logger;
|
||||
}
|
||||
|
||||
sendTestAlert = async (notification: Notification) => {
|
||||
sendTestAlert = async (notification: Partial<Notification>) => {
|
||||
if (!notification.address) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ export class EmailProvider implements INotificationProvider {
|
||||
this.logger = logger;
|
||||
}
|
||||
|
||||
async sendTestAlert(notification: Notification): Promise<boolean> {
|
||||
async sendTestAlert(notification: Partial<Notification>): Promise<boolean> {
|
||||
const subject = "Test notification";
|
||||
const html = await buildTestEmail(this.emailService);
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ export class MatrixProvider implements INotificationProvider {
|
||||
this.logger = logger;
|
||||
}
|
||||
|
||||
sendTestAlert = async (notification: Notification) => {
|
||||
sendTestAlert = async (notification: Partial<Notification>) => {
|
||||
const { homeserverUrl, accessToken, roomId } = notification;
|
||||
if (!homeserverUrl || !accessToken || !roomId) {
|
||||
return false;
|
||||
|
||||
@@ -14,7 +14,7 @@ export class PagerDutyProvider implements INotificationProvider {
|
||||
this.logger = logger;
|
||||
}
|
||||
|
||||
async sendTestAlert(notification: Notification): Promise<boolean> {
|
||||
async sendTestAlert(notification: Partial<Notification>): Promise<boolean> {
|
||||
try {
|
||||
await got.post("https://events.pagerduty.com/v2/enqueue", {
|
||||
json: {
|
||||
|
||||
@@ -13,7 +13,7 @@ export class SlackProvider implements INotificationProvider {
|
||||
this.logger = logger;
|
||||
}
|
||||
|
||||
async sendTestAlert(notification: Notification): Promise<boolean> {
|
||||
async sendTestAlert(notification: Partial<Notification>): Promise<boolean> {
|
||||
if (!notification.address) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ export class TeamsProvider implements INotificationProvider {
|
||||
this.logger = logger;
|
||||
}
|
||||
|
||||
async sendTestAlert(notification: Notification): Promise<boolean> {
|
||||
async sendTestAlert(notification: Partial<Notification>): Promise<boolean> {
|
||||
if (!notification.address) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ export class WebhookProvider implements INotificationProvider {
|
||||
};
|
||||
}
|
||||
|
||||
sendTestAlert = async (notification: Notification) => {
|
||||
sendTestAlert = async (notification: Partial<Notification>) => {
|
||||
if (!notification.address) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -141,7 +141,7 @@ export class NotificationsService implements INotificationsService {
|
||||
return await this.sendNotifications(monitor, monitorStatusResponse, decision);
|
||||
};
|
||||
|
||||
sendTestNotification = async (notification: Notification) => {
|
||||
sendTestNotification = async (notification: Partial<Notification>) => {
|
||||
switch (notification.type) {
|
||||
case "email":
|
||||
return await this.emailProvider.sendTestAlert(notification);
|
||||
|
||||
Reference in new issue
Block a user