3.1.0 • Published 11 months ago

@node-notifications/storage-typeorm-0.3 v3.1.0

Weekly downloads
-
License
ISC
Repository
github
Last release
11 months ago

Notification System TypeORM-v0.3 storage

Description

TypeORM v0.3 storage for Notification System

Install

yarn add @node-notifications/storage-typeorm-0.3

Migrations:

  • Copy migrations from library to project migrations directory
cp ./node_modules/@node-notifications/storage-typeorm-0.3/migrations/*.js ./migrations/
  • Run migrations
./node_modules/.bin/typeorm migration:run
  • Revert migrations
./node_modules/.bin/typeorm migration:revert

TypeORM config:

Sample usage:

import { ConsoleTransport, NotificationQueueManager, NotificationService } from '@node-notifications/core';
import { TypeormStorage } from '@node-notifications/storage-typeorm-0.3';

let service: NotificationService;
let queueManager: NotificationQueueManager;

async function main() {
  // Instantiate Notification Service
  service = new NotificationService(
    // eslint-disable-next-line @typescript-eslint/no-var-requires
    await new TypeormStorage().initialize(require('./ormconfig.js')),
    {
      // Log all notification to console (for test/demo purpose)
      console: new ConsoleTransport(),
    },
  );

  // Instantiate Notification Queue Manager and start Queue Processing
  queueManager = new NotificationQueueManager(service).start();
  // To stop Queue Processing:
  // queueManager.stop();

  // ...

  // Sample usage (data: INotification)
  service.send({ recipient: 'user@mail.test', payload: 'Test Notification', transports: ['console'] }).then();
}
3.1.0

11 months ago

3.0.1

11 months ago

3.0.0

11 months ago

2.1.5

1 year ago

2.1.4

1 year ago

2.1.3

1 year ago

2.1.2

1 year ago

2.1.1

1 year ago

2.1.0

1 year ago

2.0.1

1 year ago