Skip to content

Commit

Permalink
[feat] check that resolver is a sequelize resolver
Browse files Browse the repository at this point in the history
  • Loading branch information
scott-wyatt committed Jul 31, 2018
1 parent f0d34a6 commit 913a0f6
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/transformer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import * as Sequelize from 'sequelize'
import { FabrixApp } from '@fabrix/fabrix'
import { FabrixModel } from '@fabrix/fabrix/dist/common'
import { pickBy, isString, startsWith } from 'lodash'
import { SequelizeResolver } from './SequelizeResolver'

export const Transformer = {
BreakException: {},
Expand Down Expand Up @@ -185,6 +186,9 @@ export const Transformer = {
if (!model.resolver || !model.resolver.connect) {
throw new Error(`${modelName} was set to use Sequelize but the resolver is missing "connect"`)
}
if (!(model.resolver instanceof SequelizeResolver)) {
throw new Error(`${modelName} is not a Sequelize Resolver`)
}

model.store = store
model.migrate = migrate
Expand Down

0 comments on commit 913a0f6

Please sign in to comment.