API Docs for:
Show:

AggregateRoot Class

Methods

$include

(
  • [options]
)
Promise(BaseModel)

include all relational models and returns new model

Parameters:

  • [options] Object optional
    • [async=true] Boolean optional

      get async values

    • [props] Array(String) optional

      include only given props

Returns:

Promise(BaseModel):

new model

$set

() BaseModel

set value to prop and create a new model

Returns:

BaseModel:

this

$unset

(
  • prop
)
BaseModel

unset property and create a new model

Parameters:

  • prop String

    property name

Returns:

BaseModel:

this

clone

() BaseModel public

create clone

Returns:

copyWith

() BaseModel

shallow copy the model with props

Returns:

createFactory

(
  • modFirstName
)
BaseFactory

create a factory instance 2nd, 3rd, 4th ... arguments are the params to pass to the constructor of the factory

Parameters:

  • modFirstName String

Returns:

createModel

(
  • modFirstName
  • obj
  • [options]
)
BaseModel

create an instance of the given modFirstName using obj if obj is null or undefined, empty object will be created.

Parameters:

  • modFirstName String
  • obj Object
  • [options] Object optional

Returns:

createPreferredFactory

(
  • firstName
  • [options]
)
BaseFactory

create a preferred factory instance 3rd, 4th ... arguments are the params to pass to the constructor of the factory

Parameters:

  • firstName String
  • [options] Object optional
    • [noParent=true] Object optional

      if true, stop requiring parent class

Returns:

createPreferredRepository

(
  • firstName
  • [options]
)
BaseRepository

create a preferred repository instance 3rd, 4th ... arguments are the params to pass to the constructor of the repository

Parameters:

  • firstName String
  • [options] Object optional
    • [noParent] Object optional

      if true, stop requiring parent class

Returns:

createPreferredService

(
  • firstName
  • [options]
)
BaseService

create a preferred service instance 3rd, 4th ... arguments are the params to pass to the constructor of the factory

Parameters:

  • firstName String
  • [options] Object optional
    • [noParent=true] Object optional

      if true, stop requiring parent class

Returns:

createRepository

(
  • modFirstName
)
BaseRepository

create a repository instance 2nd, 3rd, 4th ... arguments are the params to pass to the constructor of the repository

Parameters:

  • modFirstName String

Returns:

createService

(
  • modFirstName
)
BaseRepository

create a service instance 2nd, 3rd, 4th ... arguments are the params to pass to the constructor of the service

Parameters:

  • modFirstName String

Returns:

deprecated

(
  • methodName
  • message
)
Error protected

Show indication message of deprecated method

Parameters:

  • methodName String
  • message String

Returns:

Error:

diff

(
  • plainObj
  • [options]
)
Array(String) public

Get diff props

Parameters:

  • plainObj Any
  • [options] Object optional
    • [ignores] Array(String) optional

      prop names to skip checking diff

Returns:

Array(String):

enum

() Object(key: String => Number) public

Returns:

Object(key: String => Number):

equals

(
  • entity
)
Boolean

check equality

Parameters:

Returns:

Boolean:

error

(
  • reason
  • [message]
)
Error

create instance of DomainError

Parameters:

  • reason String

    reason of the error

  • [message] String optional

Returns:

Error:

getDiff

(
  • plainObj
  • [options]
)
Object public

Get diff prop values

Parameters:

  • plainObj Any
  • [options] Object optional
    • [ignores] Array(String) optional

      prop names to skip checking diff

Returns:

Object:

getFacade

() Facade deprecated

Inherited from Base: /home/ubuntu/base-domain/src/lib/base.coffee:81

Deprecated: just use this.facade

Get facade

Returns:

getModelProps

() ModelProps private

Returns:

getModule

() BaseModule

Get module which this class belongs to

Returns:

getParent

() Function

get parent class

Returns:

Function:

include

(
  • [options]
)
Promise(BaseModel)

include all relational models if not set

Parameters:

  • [options] Object optional
    • [async=true] Boolean optional

      get async values

    • [props] Array(String) optional

      include only given props

Returns:

Promise(BaseModel):

self

included

() Boolean

Check if all subentities are included.

Returns:

Boolean:

inherit

(
  • anotherModel
)
BaseModel

inherit value of anotherModel

Parameters:

Returns:

BaseModel:

this

plainClone

() Object public

clone the model as a plain object

Returns:

Object:

set

()

set value to prop set memories

setEnum

(
  • prop
  • value
)
private

set enum value

Parameters:

  • prop String
  • value String | Number

setRoot

() protected

toPlainObject

() Object

create plain object without relational entities plainize memoryResources

Returns:

Object:

plainObject

unset

(
  • prop
)
BaseModel

unset property

Parameters:

  • prop String

    property name

Returns:

BaseModel:

this

useMemoryResource

(
  • modelName
)
MemoryResource

get or create a memory resource to save to @memories Only called from LocalRepository

Parameters:

  • modelName String

Returns:

Properties

id

String | Number

primary key for the model

isRoot

Boolean static

is root (to identify RootInterface)

memories

Object(MemoryResource)

key: modelName, value: MemoryResource