forked from vendure-ecommerce/vendure
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(core): Added Vendure entity event base class (vendure-ecommerce#…
- Loading branch information
Kevin
committed
Nov 15, 2021
1 parent
2cb9765
commit b09b966
Showing
1 changed file
with
29 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} |