API Docs for:
Show:

models.server.Base Class

Base class for server Models

Methods

byId

(
  • id
)
models.server.Base static

Shortcut for getting models by id

Parameters:

Returns:

models.server.Base:

subclass of models.server.Base

createdAt

() Date

Inherited from models.BaseMixin but overwritten in models/BaseMixin.js:12

Returns:

Date:

deletedAt

() Date

Inherited from models.BaseMixin but overwritten in models/BaseMixin.js:36

Returns:

Date:

fetchOrCreate

(
  • identifier
)
Bluebird.Promise

Fetch or create a model uniquely identified by the columns defined in the identifier

Parameters:

  • identifier Object

    Object of table columns

Returns:

Bluebird.Promise:

with the model instance

hasVisibility

(
  • visibility
  • models
)

Visibility assertion helper

Parameters:

  • visibility String
  • models Array

    Array of models.server.Visibility models

Returns:

Boolean

isModel

(
  • UNKNOWN
)
Boolean static

Returns true if the given value is a Backbone.Model like object

Parameters:

  • UNKNOWN Any

Returns:

Boolean:

isSame

(
  • other
)

Inherited from models.BaseMixin but overwritten in models/BaseMixin.js:48

Return true if the other object is built using the same constructor and they have the same id

Parameters:

Returns:

Boolean

isSoftDeleted

() Boolean

Inherited from models.BaseMixin but overwritten in models/BaseMixin.js:28

Returns:

Boolean:

softDelete

(
  • byUser
)
Bluebird.Promise

Set timestamp to deletedAt

Parameters:

Returns:

toAttr

(
  • model
  • attr
)
Mixed static

Get attribute using get() if model is Model instance or just return the value

Parameters:

  • model Backbone.Model | Any
  • attr String

    Attribute to get from the model

Returns:

Mixed:

toId

(
  • model
)
Number static

Return id for the model or just return the id if the id itself is passed.

Parameters:

Returns:

Number:

uniqueId

() String

Returns:

String:

updatedAt

() Date

Inherited from models.BaseMixin but overwritten in models/BaseMixin.js:20

Returns:

Date:

Properties

type

String

The database table name

Virtual database field. Use .get("type") to access it.

unique_id

String

Unique id between tables.

Virtual database field. Use .get("unique_id") to access it.