Skip to content

Documentation / @tenancy-node/core / InMemoryNotificationRepository

Class: InMemoryNotificationRepository ​

Defined in: core/src/infrastructure/memory/in-memory-notification-repository.ts:5

Avisos en memoria: tests y apps sin base central (se pierden al reiniciar).

Implements ​

Constructors ​

Constructor ​

new InMemoryNotificationRepository(): InMemoryNotificationRepository

Returns ​

InMemoryNotificationRepository

Methods ​

active() ​

active(now): Promise<Notification[]>

Defined in: core/src/infrastructure/memory/in-memory-notification-repository.ts:34

Avisos vigentes en now (ya empezaron y no vencieron), de cualquier audiencia.

Parameters ​

now ​

Date

Returns ​

Promise<Notification[]>

Implementation of ​

NotificationRepository.active


delete() ​

delete(id): Promise<boolean>

Defined in: core/src/infrastructure/memory/in-memory-notification-repository.ts:45

true si existía. Borra también sus lecturas.

Parameters ​

id ​

string

Returns ​

Promise<boolean>

Implementation of ​

NotificationRepository.delete


deleteDevices() ​

deleteDevices(tokens): Promise<number>

Defined in: core/src/infrastructure/memory/in-memory-notification-repository.ts:81

Borra dispositivos por token. Devuelve cuántos borró.

Parameters ​

tokens ​

readonly string[]

Returns ​

Promise<number>

Implementation of ​

NotificationRepository.deleteDevices


devices() ​

devices(tenantIds, userId?): Promise<NotificationDevice[]>

Defined in: core/src/infrastructure/memory/in-memory-notification-repository.ts:87

Dispositivos de estos tenants (y opcionalmente de un usuario).

Parameters ​

tenantIds ​

readonly string[]

userId? ​

string

Returns ​

Promise<NotificationDevice[]>

Implementation of ​

NotificationRepository.devices


findById() ​

findById(id): Promise<Notification | undefined>

Defined in: core/src/infrastructure/memory/in-memory-notification-repository.ts:15

Parameters ​

id ​

string

Returns ​

Promise<Notification | undefined>

Implementation of ​

NotificationRepository.findById


insert() ​

insert(notification): Promise<void>

Defined in: core/src/infrastructure/memory/in-memory-notification-repository.ts:11

Parameters ​

notification ​

Notification

Returns ​

Promise<void>

Implementation of ​

NotificationRepository.insert


list() ​

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

Defined in: core/src/infrastructure/memory/in-memory-notification-repository.ts:20

Más nuevos primero.

Parameters ​

query? ​
page? ​

number

perPage? ​

number

Returns ​

Promise<Page<Notification>>

Implementation of ​

NotificationRepository.list


markRead() ​

markRead(entries): Promise<void>

Defined in: core/src/infrastructure/memory/in-memory-notification-repository.ts:50

Marca leídos (idempotente).

Parameters ​

entries ​

readonly object[]

Returns ​

Promise<void>

Implementation of ​

NotificationRepository.markRead


readIds() ​

readIds(tenantId, userId, ids): Promise<Set<string>>

Defined in: core/src/infrastructure/memory/in-memory-notification-repository.ts:61

De notificationIds, cuáles leyó el usuario de ese tenant.

Parameters ​

tenantId ​

string

userId ​

string

ids ​

readonly string[]

Returns ​

Promise<Set<string>>

Implementation of ​

NotificationRepository.readIds


readStats() ​

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

Defined in: core/src/infrastructure/memory/in-memory-notification-repository.ts:65

Lecturas por aviso: tenants distintos y usuarios.

Parameters ​

ids ​

readonly string[]

Returns ​

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

Implementation of ​

NotificationRepository.readStats


saveDevice() ​

saveDevice(device): Promise<void>

Defined in: core/src/infrastructure/memory/in-memory-notification-repository.ts:77

Guarda o actualiza un dispositivo (por token).

Parameters ​

device ​

NotificationDevice

Returns ​

Promise<void>

Implementation of ​

NotificationRepository.saveDevice

Publicado bajo la licencia MIT.