Skip to content

Commit

Permalink
Merge pull request #42 from fabrix-app/v1.6
Browse files Browse the repository at this point in the history
[fix] model conflicts with other implementations, opting for resolver…
  • Loading branch information
scott-wyatt authored May 1, 2019
2 parents 9f7a907 + 815590f commit 0eaab5a
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion lib/SequelizeResolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ export class SequelizeResolver extends FabrixResolver {

// Add a copy of the Fabrix app to the connection model
this._sequelizeModel.app = this.app
// this._sequelizeModel.model = this.model

// A helpful exposure of the instance of Sequelize being used
this._sequelize = this._sequelizeModel.sequelize
Expand All @@ -104,7 +105,7 @@ export class SequelizeResolver extends FabrixResolver {
this._sequelizeModel.prototype.app = this.app

// Attach Fabrix Model to the instance prototype
this._sequelizeModel.prototype.model = this.model
this._sequelizeModel.prototype.resolver = this

// Add this model to the connection.models for use later
this._connection.models[modelName] = this._sequelizeModel
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@fabrix/spool-sequelize",
"version": "1.6.12",
"version": "1.6.13",
"description": "Spool - Datastore Spool for Sequelize.js http://sequelizejs.com",
"scripts": {
"build": "tsc -p ./lib/tsconfig.release.json",
Expand Down
4 changes: 2 additions & 2 deletions test/integrations/spool.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ describe('Spool', () => {

it('instance should have access to model', (done) => {
const instance = global.app.models.testModel.build({name: 'test'})
assert.ok(instance.model)
assert.equal(instance.model, global.app.models.testModel)
assert.ok(instance.resolver)
assert.equal(instance.resolver, global.app.models.testModel.resolver)
done()
})

Expand Down

0 comments on commit 0eaab5a

Please sign in to comment.