2024-03-10 09:49:36 +00:00
|
|
|
import DomainEvent from "../DomainEvent";
|
|
|
|
import DomainProjection from "../DomainProjection";
|
|
|
|
|
2024-02-07 22:48:42 +00:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|