Models - adamkendis/ember-discography GitHub Wiki

Models

There are three primary resources: artist, album, and song. An album can't exist without an artist. A song can't exist without an album and an artist.

Thus, when a record is successfully deleted:

  • The mock back-end will cascade delete all dependent child records to prevent orphans.
  • All dependent child records will be unloaded from the Ember Data store.

Note that "parent" records can exist without children. An artist can be created with 0 albums but albums can be added to the artist after creation. An album can be created with 0 songs but songs can be added to the album after creation.

Artist

Attributes:

  • name (string)
  • image (string) - url

Relationships:

  • albums (hasMany)
  • songs (hasMany)

Album

Attributes:

  • title (string)
  • releaseDate (string) - 'MM/DD/YYYY'

Relationships:

  • artist (belongsTo)
  • songs (hasMany)

Song

Attributes:

  • title (string)
  • length (integer) - time in seconds

Relationships:

  • artist (belongsTo)
  • album (belongsTo)