How to use the @nestjs/cqrs.EventsHandler function in @nestjs/cqrs

To help you get started, we’ve selected a few @nestjs/cqrs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github qas / examples-nodejs-cqrs-es-swagger / src / users / events / handlers / user-deleted.handler.ts View on Github external
import { IEventHandler, EventsHandler } from '@nestjs/cqrs';
import { UserDeletedEvent } from '../impl/user-deleted.event';
import { Logger } from '@nestjs/common';

@EventsHandler(UserDeletedEvent)
export class UserDeletedHandler
  implements IEventHandler {
  handle(event: UserDeletedEvent) {
    Logger.log(event, 'UserDeletedEvent'); // write here
  }
}
github notadd / next / packages / injection / events / handlers / addon-after-enable.event.handler.js View on Github external
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", { value: true });
const _1 = require("../");
const cqrs_1 = require("@nestjs/cqrs");
let AddonAfterEnableEventHandler = class AddonAfterEnableEventHandler {
    handle(event) {
        console.log("Addon After Enable Event applied: " + event.identification);
        return undefined;
    }
};
AddonAfterEnableEventHandler = __decorate([
    cqrs_1.EventsHandler(_1.AddonAfterEnableEvent)
], AddonAfterEnableEventHandler);
exports.AddonAfterEnableEventHandler = AddonAfterEnableEventHandler;

//# sourceMappingURL=addon-after-enable.event.handler.js.map
github juicycleff / ultimate-backend / libs / core / src / cqrs / events / handlers / auth / user-loggedin.handler.ts View on Github external
import {Logger} from '@nestjs/common';
import {EventsHandler, IEventHandler} from '@nestjs/cqrs';
import {UserLoggedInEvent} from '../../impl/auth';

@EventsHandler(UserLoggedInEvent)
export class UserLoggedInHandler implements IEventHandler {
  handle(event: UserLoggedInEvent): any {
    Logger.log(event, 'UserLoggedInHandler');
  }
}
github notadd / next / packages / injection / events / handlers / addon-before-install.event.handler.js View on Github external
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", { value: true });
const _1 = require("../");
const cqrs_1 = require("@nestjs/cqrs");
let AddonBeforeInstallEventHandler = class AddonBeforeInstallEventHandler {
    handle(event) {
        return undefined;
    }
};
AddonBeforeInstallEventHandler = __decorate([
    cqrs_1.EventsHandler(_1.AddonBeforeInstallEvent)
], AddonBeforeInstallEventHandler);
exports.AddonBeforeInstallEventHandler = AddonBeforeInstallEventHandler;

//# sourceMappingURL=addon-before-install.event.handler.js.map
github santaz1995 / nestjs-cqrs-starter / src / application / event / feedback / store-feedback.handler.ts View on Github external
import { EventsHandler, IEventHandler } from '@nestjs/cqrs';
import { Inject } from '@nestjs/common';
import { FeedbackQueryRepository } from '../../../domains/feedback/feedback-query.repository';
import { StoreFeedbackEvent } from './store-feedback.event';

@EventsHandler(StoreFeedbackEvent)
export class StoreFeedbackHandler implements IEventHandler {

    constructor(
        @Inject('FeedbackQueryRepository') private feedbackRepository: FeedbackQueryRepository) {
    }

    /**
     * @param {StoreFeedbackEvent} event
     * @returns {Promise}
     */
    async handle(event: StoreFeedbackEvent) {
        await this.feedbackRepository.store(event.feedback);
    }
}
github new-eden-social / new-eden-social / src / api / src / modules / post / events / handlers / create.character.wall.handler.ts View on Github external
import { CommandBus, EventsHandler, IEventHandler } from '@nestjs/cqrs';
import {
  CharacterPostedOnAllianceWallEvent,
  CharacterPostedOnCharacterWallEvent, CharacterPostedOnCorporationWallEvent,
  CharacterPostedOnWallEvent,
} from '../create.character.event';
import { NOTIFICATION_TYPE } from '../../../notification/notification.constants';
import { Character } from '../../../character/character.entity';
import { Notification } from '../../../notification/notification.entity';
import * as uuidv4 from 'uuid/v4';
import { CreateNotificationCommand } from '../../../notification/commands/create.command';

@EventsHandler(
  CharacterPostedOnCharacterWallEvent,
  CharacterPostedOnCorporationWallEvent,
  CharacterPostedOnAllianceWallEvent,
)
export class CharacterPostedOnWallEventHandler
  implements IEventHandler {

  constructor(
    private readonly commandBus: CommandBus,
  ) {
  }

  async handle(event: CharacterPostedOnWallEvent) {
    const notificationType = this.notificationType(event);
    const characters = await this.getCharactersToReceiveNotification(event, notificationType);
    const eventUuid = uuidv4();
github notadd / next / src / injection / events / handlers / addon-after-install.event.handler.ts View on Github external
import { AddonAfterInstallEvent } from "../";
import { EventsHandler, IEventHandler } from "@nestjs/cqrs";

@EventsHandler(AddonAfterInstallEvent)
export class AddonAfterInstallEventHandler implements IEventHandler {
    handle(event: AddonAfterInstallEvent): any {
        return undefined;
    }
}
github notadd / next / packages / injection / events / handlers / extension-after-uninstall.event.handler.js View on Github external
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", { value: true });
const cqrs_1 = require("@nestjs/cqrs");
const _1 = require("../");
let ExtensionAfterUninstallEventHandler = class ExtensionAfterUninstallEventHandler {
    handle(event) {
        return undefined;
    }
};
ExtensionAfterUninstallEventHandler = __decorate([
    cqrs_1.EventsHandler(_1.ExtensionAfterUninstallEvent)
], ExtensionAfterUninstallEventHandler);
exports.ExtensionAfterUninstallEventHandler = ExtensionAfterUninstallEventHandler;

//# sourceMappingURL=extension-after-uninstall.event.handler.js.map
github notadd / next / src / injection / events / handlers / addon-after-uninstall.event.handler.ts View on Github external
import { AddonAfterUninstallEvent } from "../";
import { EventsHandler, IEventHandler } from "@nestjs/cqrs";

@EventsHandler(AddonAfterUninstallEvent)
export class AddonAfterUninstallEventHandler implements IEventHandler {
    handle(event: AddonAfterUninstallEvent): any {
        return undefined;
    }
}
github santaz1995 / nestjs-cqrs-starter / src / application / event / feedback / create-feedback.handler.ts View on Github external
import { EventsHandler, IEventHandler } from '@nestjs/cqrs';
import { CreateFeedbackEvent } from './create-feedback.event';
import { Inject } from "@nestjs/common";
import { FeedbackCommandRepository } from '../../../domains/feedback/feedback-command.repository';

@EventsHandler(CreateFeedbackEvent)
export class CreateFeedbackHandler implements IEventHandler {

    constructor(
        @Inject('FeedbackQueryRepository') private feedbackRepository: FeedbackCommandRepository) {
    }

    async handle(feedback: CreateFeedbackEvent) {
        await this.feedbackRepository.store(feedback.feedback);
    }
}

@nestjs/cqrs

A lightweight CQRS module for Nest framework (node.js)

MIT
Latest version published 2 months ago

Package Health Score

86 / 100
Full package analysis

Similar packages