Tools/domain/projections/ApplicationUpdates.ts

21 lines
533 B
TypeScript
Raw Normal View History

2024-03-10 09:49:36 +00:00
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;
}
}