mirror of
https://github.com/hcengineering/platform.git
synced 2026-09-27 12:04:56 +02:00
UBERF-7513: Improve notifications model to allow external notifications channels (#6037)
Signed-off-by: Kristina Fefelova <kristin.fefelova@gmail.com>
This commit is contained in:
@@ -16,7 +16,13 @@
|
||||
|
||||
import contact, { Employee, Person, PersonAccount } from '@hcengineering/contact'
|
||||
import { Account, Class, Doc, Mixin, Ref, Tx, TxCUD } from '@hcengineering/core'
|
||||
import { NotificationContent, NotificationType } from '@hcengineering/notification'
|
||||
import {
|
||||
BaseNotificationType,
|
||||
InboxNotification,
|
||||
NotificationContent,
|
||||
NotificationProvider,
|
||||
NotificationType
|
||||
} from '@hcengineering/notification'
|
||||
import { Metadata, Plugin, Resource, plugin } from '@hcengineering/platform'
|
||||
import type { TriggerControl, TriggerFunc } from '@hcengineering/server-core'
|
||||
|
||||
@@ -129,7 +135,28 @@ export interface NotificationPresenter extends Class<Doc> {
|
||||
presenter: Resource<NotificationContentProvider>
|
||||
}
|
||||
|
||||
export interface UserInfo {
|
||||
_id: Ref<Account>
|
||||
account?: PersonAccount
|
||||
person?: Person
|
||||
}
|
||||
|
||||
export type NotificationProviderFunc = (
|
||||
control: TriggerControl,
|
||||
types: BaseNotificationType[],
|
||||
object: Doc,
|
||||
data: InboxNotification,
|
||||
receiver: UserInfo,
|
||||
sender: UserInfo
|
||||
) => Promise<Tx[]>
|
||||
|
||||
export interface NotificationProviderResources extends Doc {
|
||||
provider: Ref<NotificationProvider>
|
||||
fn: Resource<NotificationProviderFunc>
|
||||
}
|
||||
|
||||
export const NOTIFICATION_BODY_SIZE = 50
|
||||
export const NOTIFICATION_TITLE_SIZE = 30
|
||||
|
||||
/**
|
||||
* @public
|
||||
@@ -140,6 +167,9 @@ export default plugin(serverNotificationId, {
|
||||
PushPrivateKey: '' as Metadata<string>,
|
||||
PushSubject: '' as Metadata<string>
|
||||
},
|
||||
class: {
|
||||
NotificationProviderResources: '' as Ref<Class<NotificationProviderResources>>
|
||||
},
|
||||
mixin: {
|
||||
HTMLPresenter: '' as Ref<Mixin<HTMLPresenter>>,
|
||||
TextPresenter: '' as Ref<Mixin<TextPresenter>>,
|
||||
|
||||
Reference in New Issue
Block a user