1.0.4 • Published 3 years ago

@notifications-system/storage-typeorm-0.2 v1.0.4

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

Notifications System TypeORM-v0.2 storage

Description

TypeORM v0.2 storage for Notifications System

Install

npm i @notifications-system/storage-typeorm-0.2

Migrations:

  • Copy migrations from library to project migrations directory
cp ./node_modules/@notifications-system/storage-typeorm-0.2/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, TRANSPORT_CONSOLE } from '@notifications-system/core';
import { TypeormStorage } from '@notifications-system/storage-typeorm-0.2';

let service: NotificationService;

async function main() {
  // Instantiate Notification Service
  service = new NotificationService(
    await new TypeormStorage().initialize(require('./ormconfig.js')),
    [
      new ConsoleTransport(), // Log all notification to console (for test/demo purpose)
    ],
  );
  new NotificationQueueManager(service).queueStart();


  // Sample usage
  service.send(TRANSPORT_CONSOLE, { recipient: 'user@mail.test', payload: 'Test Notification' });
}
1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago