Options
All
  • Public
  • Public/Protected
  • All
Menu

An aggregate root's representation.

Aggregate roots are clusters of domain objects (Entity or ValueObject) that can be treated as single units.

Example:

class Post extends Entity<{ title: string; content: string, comments: Array<Comment> }> {
  get title() {
    return this.props.title
  }

  get content() {
    return this.props.content
  }

  get comments() {
    return cloneDeep(this.props.comments)
  }
}

const post = new Post({ title: 'Hello Rimo!', content: 'You are amazing :)', comments: [] })
// post.id -> generated
// post.title -> 'Hello Rimo!'
// post.content -> 'You are amazing :)'
// post.comments -> []

Type parameters

  • T

    The properties of this aggregate root.

Hierarchy

Implements

Index

Constructors

Properties

Accessors

Methods

Constructors

constructor

Properties

Protected _id

props

props: T = {} as T

Accessors

id

Methods

equals

  • equals(object?: Entity<T>): boolean

populate

  • populate(props: PartialDeep<T>): void

Legend

  • Constructor
  • Property
  • Method
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Property
  • Method
  • Protected property
  • Private property
  • Static method

Generated using TypeDoc