import type ISnapshotStoreDBAL from "./SnapshotStoreDBAL"; import { decorate, inject, injectable } from 'inversify'; import type EventSourcedAggregateRoot from "../../Domain/EventSourcedAggregateRoot"; import { SERVICES_ALIAS } from "../../Framework"; export default class SnapshotStore { constructor( private readonly store: ISnapshotStoreDBAL ) {} public async retrieve(aggregateRootId: string): Promise { return this.store.get(aggregateRootId); } public async snapshot(entity: T): Promise { await this.store.store(entity); } } decorate(injectable(), SnapshotStore); decorate(inject(SERVICES_ALIAS.DEFAULT_EVENT_STORE_SNAPSHOT_DBAL) as ParameterDecorator, SnapshotStore, 0);