Tools/domain/projections/ApplicationUpdates.ts
2024-03-10 10:49:36 +01:00

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;
}
}