mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-06 03:50:26 +02:00
Refactor notifier
This commit is contained in:
parent
2bee9db56a
commit
d26836cd95
37 changed files with 1627 additions and 1231 deletions
23
server/lib/notifier/shared/common/abstract-notification.ts
Normal file
23
server/lib/notifier/shared/common/abstract-notification.ts
Normal 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
|
||||
}
|
||||
|
||||
}
|
1
server/lib/notifier/shared/common/index.ts
Normal file
1
server/lib/notifier/shared/common/index.ts
Normal file
|
@ -0,0 +1 @@
|
|||
export * from './abstract-notification'
|
Loading…
Add table
Add a link
Reference in a new issue