Skip to content

Documentation / @tenancy-node/core / NotificationsApi

Interface: NotificationsApi ​

Defined in: core/src/notifications/notification-service.ts:58

Properties ​

channels ​

readonly channels: readonly string[]

Defined in: core/src/notifications/notification-service.ts:92

Nombres de los canales configurados.


devices ​

readonly devices: object

Defined in: core/src/notifications/notification-service.ts:86

Dispositivos para push. Se registran desde la app del tenant (el token lo da el SDK del proveedor).

list() ​

list(options?): Promise<NotificationDevice[]>

Parameters ​
options? ​
tenant? ​

Tenant

userId? ​

string

Returns ​

Promise<NotificationDevice[]>

register() ​

register(input, tenant?): Promise<void>

Parameters ​
input ​

RegisterDeviceInput

tenant? ​

Tenant

Returns ​

Promise<void>

unregister() ​

unregister(token): Promise<void>

Parameters ​
token ​

string

Returns ​

Promise<void>

Methods ​

delete() ​

delete(id): Promise<void>

Defined in: core/src/notifications/notification-service.ts:69

Retira un aviso: deja de mostrarse y se borran sus lecturas.

Parameters ​

id ​

string

Returns ​

Promise<void>


deliver() ​

deliver(id): Promise<NotificationDelivery[]>

Defined in: core/src/notifications/notification-service.ts:84

Vuelve a entregar un aviso por los canales (por ejemplo, después de configurar Firebase).

Parameters ​

id ​

string

Returns ​

Promise<NotificationDelivery[]>


forTenant() ​

forTenant(options?): Promise<TenantNotification[]>

Defined in: core/src/notifications/notification-service.ts:71

Avisos vigentes para un tenant (por defecto, el del contexto).

Parameters ​

options? ​

ForTenantOptions

Returns ​

Promise<TenantNotification[]>


get() ​

get(id): Promise<Notification | undefined>

Defined in: core/src/notifications/notification-service.ts:65

Parameters ​

id ​

string

Returns ​

Promise<Notification | undefined>


list() ​

list(query?): Promise<Page<Notification>>

Defined in: core/src/notifications/notification-service.ts:67

Todos los avisos (panel), más nuevos primero.

Parameters ​

query? ​
page? ​

number

perPage? ​

number

Returns ​

Promise<Page<Notification>>


markRead() ​

markRead(ids, userId, options?): Promise<void>

Defined in: core/src/notifications/notification-service.ts:74

Marca leídos uno, varios o 'all' (todos los vigentes del tenant).

Parameters ​

ids ​

string | readonly string[]

userId ​

string

options? ​
roles? ​

readonly string[]

tenant? ​

Tenant

Returns ​

Promise<void>


reach() ​

reach(audience): Promise<number>

Defined in: core/src/notifications/notification-service.ts:80

Cuántos tenants (activos) alcanza una audiencia. Para la vista previa del panel.

Parameters ​

audience ​

NotificationAudience

Returns ​

Promise<number>


send() ​

send(input): Promise<Notification>

Defined in: core/src/notifications/notification-service.ts:64

Envía un aviso a todos los tenants, a algunos ({ type: 'tenants', tenants }) o a los de ciertos planes ({ type: 'plans', plans }). Publica notification.sent y, con canales configurados (Firebase...), lo entrega a los dispositivos registrados en segundo plano.

Parameters ​

input ​

NewNotification

Returns ​

Promise<Notification>


stats() ​

stats(ids): Promise<Map<string, { tenants: number; users: number; }>>

Defined in: core/src/notifications/notification-service.ts:82

Lecturas por aviso.

Parameters ​

ids ​

readonly string[]

Returns ​

Promise<Map<string, { tenants: number; users: number; }>>


unreadCount() ​

unreadCount(options): Promise<number>

Defined in: core/src/notifications/notification-service.ts:72

Parameters ​

options ​

ForTenantOptions & object

Returns ​

Promise<number>

Publicado bajo la licencia MIT.