- 
                Notifications
    
You must be signed in to change notification settings  - Fork 2
 
es cqrs.Class.Repository
        Sclable CI edited this page Oct 7, 2024 
        ·
        7 revisions
      
    @sclable/nestjs-libs / es-cqrs / Repository
An aggregate repository is a storage handler for aggregates. It recreates an aggregate every time from the event store, but to speed things up, it first tries to load up a snapshot of the aggregate. It is also responsible for persisting the aggregate by saving its events.
• T extends Aggregate
an Aggregate
find(
id,userId?):Promise<T>
Recreate an aggregate from the events
• id: string
aggregate id
• userId?: string
user id for subsequent operations, can be omitted for reading
Promise<T>
an aggregate
packages/es-cqrs/src/repository.ts:43
persist(
aggregate):Promise<void>
Persist an aggregate by saving its events
• aggregate: T
Promise<void>