21 lines
533 B
TypeScript
21 lines
533 B
TypeScript
import DomainEvent from "../DomainEvent";
|
|
import DomainProjection from "../DomainProjection";
|
|
|
|
export type UpdateDefinition = {
|
|
id: string;
|
|
newVersion: string;
|
|
};
|
|
|
|
export default class ApplicationUpdates implements DomainProjection {
|
|
private readonly pendingUpdates: UpdateDefinition[] = [];
|
|
handle(event: DomainEvent<any>): void {
|
|
if (event.type === "ApplicationUpdateStarted") {
|
|
this.pendingUpdates.push(event.payload);
|
|
}
|
|
}
|
|
|
|
getPendingUpdates(): UpdateDefinition[] {
|
|
return this.pendingUpdates;
|
|
}
|
|
}
|