1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-06 03:50:26 +02:00

Refactor notifier

This commit is contained in:
Chocobozzz 2021-07-30 16:51:27 +02:00
parent 2bee9db56a
commit d26836cd95
No known key found for this signature in database
GPG key ID: 583A612D890159BE
37 changed files with 1627 additions and 1231 deletions

View file

@ -0,0 +1,23 @@
import { MUserWithNotificationSetting, UserNotificationModelForApi } from '@server/types/models'
import { EmailPayload, UserNotificationSettingValue } from '@shared/models'
export abstract class AbstractNotification <T, U = MUserWithNotificationSetting> {
constructor (protected readonly payload: T) {
}
abstract prepare (): Promise<void>
abstract log (): void
abstract getSetting (user: U): UserNotificationSettingValue
abstract getTargetUsers (): U[]
abstract createNotification (user: U): Promise<UserNotificationModelForApi>
abstract createEmail (to: string): EmailPayload | Promise<EmailPayload>
isDisabled (): boolean | Promise<boolean> {
return false
}
}

View file

@ -0,0 +1 @@
export * from './abstract-notification'