feat(notifications): added ability to send test notifications

closes #309
This commit is contained in:
sct
2020-12-20 21:41:25 +09:00
parent 764db94f1b
commit 44a305426f
12 changed files with 378 additions and 55 deletions

View File

@@ -1,5 +1,6 @@
import { Notification } from '..';
import { User } from '../../../entity/User';
import { NotificationAgentConfig } from '../../settings';
export interface NotificationPayload {
subject: string;
@@ -9,6 +10,15 @@ export interface NotificationPayload {
extra?: { name: string; value: string }[];
}
export abstract class BaseAgent<T extends NotificationAgentConfig> {
protected settings?: T;
public constructor(settings?: T) {
this.settings = settings;
}
protected abstract getSettings(): T;
}
export interface NotificationAgent {
shouldSend(type: Notification): boolean;
send(type: Notification, payload: NotificationPayload): Promise<boolean>;