Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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
});
}
constructor() {
this.db = new Db();
this.schema = new Schema(this.db, {
user: Model.extend(),
address: Model.extend({
user: Mirage.belongsTo()
})
});
}
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
});
}
}),
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
});
}
constructor() {
this.db = new Db();
this.schema = new Schema(this.db, {
user: Model.extend(),
address: Model.extend({
user: Mirage.belongsTo()
})
});
}
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()
}),
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
});
}
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
});
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()
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()
}),