How to use the ember-cli-mirage/orm/model.extend function in ember-cli-mirage

To help you get started, we’ve selected a few ember-cli-mirage examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github miragejs / ember-cli-mirage / tests / integration / orm / has-many / has-many-helper.js View on Github external
this.ownKey = ownKey;
    this.ownModel = ownModel;
    this.otherKey = otherKey;
    this.otherModel = otherModel;
    this.db = new Db();

    let hasManyArgs = [];
    if (pluralize(otherModel) !== ownKey) {
      hasManyArgs.push(otherModel);
    }
    if (ownModel !== otherKey) {
      hasManyArgs.push({ inverse: otherKey });
    }

    this.schema = new Schema(this.db, {
      [ownModel]: Model.extend({
        [ownKey]: hasMany(...hasManyArgs)
      }),
      [otherModel]: Model
    });
  }
github miragejs / ember-cli-mirage / tests / integration / orm / belongs-to / belongs-to-helper.js View on Github external
constructor() {
    this.db = new Db();

    this.schema = new Schema(this.db, {
      user: Model.extend(),
      address: Model.extend({
        user: Mirage.belongsTo()
      })
    });
  }
github miragejs / ember-cli-mirage / tests / integration / serializers / schema-helper.js View on Github external
blogPost: Model.extend({
        wordSmith: belongsTo(),
        fineComments: hasMany()
      }),
      fineComment: Model.extend({
        blogPost: belongsTo()
      }),
      greatPhoto: Model,

      foo: Model.extend({
        bar: belongsTo()
      }),
      bar: Model.extend({
        baz: belongsTo()
      }),
      baz: Model.extend({
        quuxes: hasMany()
      }),
      quux: Model.extend({
        zomgs: hasMany()
      }),
      zomg: Model.extend({
        lol: belongsTo()
      }),
      lol: Model
    });
  }
github miragejs / ember-cli-mirage / tests / integration / serializers / schema-helper.js View on Github external
}),
      greatPhoto: Model,

      foo: Model.extend({
        bar: belongsTo()
      }),
      bar: Model.extend({
        baz: belongsTo()
      }),
      baz: Model.extend({
        quuxes: hasMany()
      }),
      quux: Model.extend({
        zomgs: hasMany()
      }),
      zomg: Model.extend({
        lol: belongsTo()
      }),
      lol: Model
    });
  }
github miragejs / ember-cli-mirage / tests / integration / orm / belongs-to / belongs-to-helper.js View on Github external
constructor() {
    this.db = new Db();

    this.schema = new Schema(this.db, {
      user: Model.extend(),
      address: Model.extend({
        user: Mirage.belongsTo()
      })
    });
  }
github miragejs / ember-cli-mirage / tests / integration / serializers / schema-helper.js View on Github external
setup() {
    return new Schema(new Db(), {
      wordSmith: Model.extend({
        blogPosts: hasMany()
      }),
      blogPost: Model.extend({
        wordSmith: belongsTo(),
        fineComments: hasMany()
      }),
      fineComment: Model.extend({
        blogPost: belongsTo()
      }),
      greatPhoto: Model,

      foo: Model.extend({
        bar: belongsTo()
      }),
      bar: Model.extend({
        baz: belongsTo()
      }),
      baz: Model.extend({
        quuxes: hasMany()
github miragejs / ember-cli-mirage / tests / integration / serializers / schema-helper.js View on Github external
}),
      fineComment: Model.extend({
        blogPost: belongsTo()
      }),
      greatPhoto: Model,

      foo: Model.extend({
        bar: belongsTo()
      }),
      bar: Model.extend({
        baz: belongsTo()
      }),
      baz: Model.extend({
        quuxes: hasMany()
      }),
      quux: Model.extend({
        zomgs: hasMany()
      }),
      zomg: Model.extend({
        lol: belongsTo()
      }),
      lol: Model
    });
  }
github miragejs / ember-cli-mirage / tests / integration / serializers / schema-helper.js View on Github external
setup() {
    return new Schema(new Db(), {
      wordSmith: Model.extend({
        blogPosts: hasMany()
      }),
      blogPost: Model.extend({
        wordSmith: belongsTo(),
        fineComments: hasMany()
      }),
      fineComment: Model.extend({
        blogPost: belongsTo()
      }),
      greatPhoto: Model,

      foo: Model.extend({
        bar: belongsTo()
      }),
      bar: Model.extend({
        baz: belongsTo()
      }),
      baz: Model.extend({
        quuxes: hasMany()
      }),
      quux: Model.extend({
        zomgs: hasMany()
      }),
      zomg: Model.extend({
        lol: belongsTo()
      }),
      lol: Model
    });
github miragejs / ember-cli-mirage / tests / integration / serializers / schema-helper.js View on Github external
setup() {
    return new Schema(new Db(), {
      wordSmith: Model.extend({
        blogPosts: hasMany()
      }),
      blogPost: Model.extend({
        wordSmith: belongsTo(),
        fineComments: hasMany()
      }),
      fineComment: Model.extend({
        blogPost: belongsTo()
      }),
      greatPhoto: Model,

      foo: Model.extend({
        bar: belongsTo()
      }),
      bar: Model.extend({
        baz: belongsTo()
github miragejs / ember-cli-mirage / tests / integration / serializers / schema-helper.js View on Github external
setup() {
    return new Schema(new Db(), {
      wordSmith: Model.extend({
        blogPosts: hasMany()
      }),
      blogPost: Model.extend({
        wordSmith: belongsTo(),
        fineComments: hasMany()
      }),
      fineComment: Model.extend({
        blogPost: belongsTo()
      }),
      greatPhoto: Model,

      foo: Model.extend({
        bar: belongsTo()
      }),
      bar: Model.extend({
        baz: belongsTo()
      }),
      baz: Model.extend({
        quuxes: hasMany()
      }),
      quux: Model.extend({
        zomgs: hasMany()
      }),