1 import { MUserWithNotificationSetting, UserNotificationModelForApi } from '@server/types/models'
2 import { EmailPayload, UserNotificationSettingValue } from '@shared/models'
4 export abstract class AbstractNotification <T, U = MUserWithNotificationSetting> {
6 constructor (protected readonly payload: T) {
10 abstract prepare (): Promise<void>
13 abstract getSetting (user: U): UserNotificationSettingValue
14 abstract getTargetUsers (): U[]
16 abstract createNotification (user: U): Promise<UserNotificationModelForApi>
17 abstract createEmail (to: string): EmailPayload | Promise<EmailPayload>
19 isDisabled (): boolean | Promise<boolean> {