Skip to content

Commit

Permalink
feat(core): Added Vendure entity event base class (vendure-ecommerce#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Kevin committed Nov 15, 2021
1 parent 2cb9765 commit b09b966
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions packages/core/src/event-bus/vendure-entity-event.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { RequestContext } from '../api';

import { VendureEvent } from './vendure-event';

/**
* @description
* The base class for all entity events used by the EventBus system.
*
* @docsCategory events
* */
export abstract class VendureEntityEvent<Entity, Input = any> extends VendureEvent {
public readonly entity: Entity;
public readonly type: 'created' | 'updated' | 'deleted';
public readonly ctx?: RequestContext;
public readonly input?: Input;

protected constructor(
entity: Entity,
type: 'created' | 'updated' | 'deleted',
ctx?: RequestContext,
input?: Input,
) {
super();
this.entity = entity;
this.type = type;
this.ctx = ctx;
this.input = input;
}
}

0 comments on commit b09b966

Please sign in to comment.