Skip to content

Commit

Permalink
Merge pull request #41 from fabrix-app/v1.6
Browse files Browse the repository at this point in the history
V1.6
  • Loading branch information
scott-wyatt authored May 1, 2019
2 parents cf2fec6 + c4eac49 commit 9f7a907
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 2 deletions.
3 changes: 3 additions & 0 deletions lib/SequelizeResolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ export class SequelizeResolver extends FabrixResolver {
// Attach Fabrix to the instance prototype
this._sequelizeModel.prototype.app = this.app

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

// 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.11",
"version": "1.6.12",
"description": "Spool - Datastore Spool for Sequelize.js http://sequelizejs.com",
"scripts": {
"build": "tsc -p ./lib/tsconfig.release.json",
Expand Down
7 changes: 7 additions & 0 deletions test/integrations/spool.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,13 @@ 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)
done()
})

it('should build and save an instance with associations', (done) => {
const instance = global.app.models.User.build({
name: 'test',
Expand Down

0 comments on commit 9f7a907

Please sign in to comment.