Skip to content

Commit

Permalink
feat(core): update nestjs-notification vertion to 2
Browse files Browse the repository at this point in the history
BREAKING CHANGE: update nestjs-notification vertion to 2
  • Loading branch information
houssenedao committed Dec 22, 2021
1 parent 866c753 commit 8c6fd68
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 23 deletions.
4 changes: 2 additions & 2 deletions lib/bootstrap/webhook.channel.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { Injectable, InternalServerErrorException } from '@nestjs/common';
import { HttpService } from '@nestjs/axios';
import { INestjsNotifyChannel } from '@sinuos/nestjs-notification';
import { INestjsNotificationChannel } from '@sinuos/nestjs-notification';
import { AxiosResponse } from 'axios';
import { IWebhookChannel } from './webhook.interface';

@Injectable()
export class WebhookChannel implements INestjsNotifyChannel {
export class WebhookChannel implements INestjsNotificationChannel {
/**
* @constructor
* @param {HttpService} http
Expand Down
8 changes: 4 additions & 4 deletions lib/bootstrap/webhook.interface.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { NestJsNotify } from '@sinuos/nestjs-notification';
import { NestJsNotification } from '@sinuos/nestjs-notification';

/**
* Webhook channel model
* @interface IWebhookChannel
* @extends NestJsNotify
* @extends NestJsNotification
*/
export interface IWebhookChannel extends NestJsNotify {
export interface IWebhookChannel extends NestJsNotification {
/**
* Get the Http representation of the notification.
* @property
* @returns {any} http payload data
*/
toWebhook(): any;
toWebhook?(): any;
}
10 changes: 8 additions & 2 deletions lib/webhook-channel.module.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
import { Global, Module } from '@nestjs/common';
import { HttpModule } from '@nestjs/axios';
import { NestjsNotifyModule } from '@sinuos/nestjs-notification';
import {
NestjsNotificationModule,
NestjsNotificationModuleOptions,
} from '@sinuos/nestjs-notification';
import { WebhookChannelService } from './webhook-channel.service';
import { WebhookChannel } from './bootstrap';

@Global()
@Module({
imports: [NestjsNotifyModule.register({}), HttpModule],
imports: [
NestjsNotificationModule.register(<NestjsNotificationModuleOptions>{}),
HttpModule,
],
providers: [WebhookChannelService, WebhookChannel],
exports: [WebhookChannelService, HttpModule],
})
Expand Down
15 changes: 9 additions & 6 deletions lib/webhook-channel.service.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
import { Injectable } from '@nestjs/common';
import { NestJsNotify, NestjsNotifyService } from '@sinuos/nestjs-notification';
import {
NestJsNotification,
NestjsNotificationService,
} from '@sinuos/nestjs-notification';

@Injectable()
export class WebhookChannelService {
/**
* @constructor
* @param notifications
* @param {NestjsNotificationService} notifications
*/
constructor(private readonly notifications: NestjsNotifyService) {}
constructor(private readonly notifications: NestjsNotificationService) {}

/**
* Notify notification.
* @param notification
* Notify.
* @param {NestJsNotification} notification
*/
async notify(notification: NestJsNotify): Promise<any> {
async notify(notification: NestJsNotification): Promise<any> {
return this.notifications.send(notification);
}
}
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
},
"dependencies": {
"@nestjs/axios": "0.0.3",
"@sinuos/nestjs-notification": "^1.0.1"
"@sinuos/nestjs-notification": "^2.0.0"
},
"devDependencies": {
"@commitlint/cli": "15.0.0",
Expand All @@ -60,7 +60,7 @@
"jest": "^27.4.4",
"lint-staged": "12.1.2",
"prettier": "2.5.1",
"pretty-quick": "^3.1.2",
"pretty-quick": "^3.1.3",
"reflect-metadata": "0.1.13",
"rimraf": "3.0.2",
"rxjs": "7.4.0",
Expand Down

0 comments on commit 8c6fd68

Please sign in to comment.