Skip to content

Commit

Permalink
Update dependency versions
Browse files Browse the repository at this point in the history
  • Loading branch information
valtlfelipe committed Sep 13, 2019
1 parent 7ee6643 commit ee85ffb
Show file tree
Hide file tree
Showing 5 changed files with 3,716 additions and 28 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,5 @@ myhostname
test/db
test/db.sqlite
coverage.html
package-lock.json
yarn.lock
yarn-error.log
9 changes: 5 additions & 4 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ async function register(server, options) {
options = [options];
}

await Joi.validate(options, Schema.options);
await Joi.assert(options, Schema.options);

setupDecorators(server);

Expand All @@ -37,8 +37,9 @@ async function register(server, options) {
configure(options).then(db => {
server.expose(options.name, db);
return db;
})
], []
}),
],
[],
);

return Promise.all(configured);
Expand All @@ -50,7 +51,7 @@ async function configure(options) {
} catch (error) {
throw new Error(
`An error occurred while attempting to connect to DB[${options.name}],
please check the configuration. Details: ${error.message}`
please check the configuration. Details: ${error.message}`,
);
}

Expand Down
18 changes: 8 additions & 10 deletions lib/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,14 @@ const Joi = require('@hapi/joi');
const Sequelize = require('sequelize');

const option = Joi.object().keys({
name: Joi.string().token().required(),
models: Joi.alternatives().try(
Joi.string(),
Joi.array().items(Joi.string())
),
ignoredModels: Joi.alternatives().try(
Joi.string(),
Joi.array().items(Joi.string())
),
sequelize: Joi.object().type(Sequelize).required(),
name: Joi.string()
.token()
.required(),
models: Joi.alternatives().try(Joi.string(), Joi.array().items(Joi.string())),
ignoredModels: Joi.alternatives().try(Joi.string(), Joi.array().items(Joi.string())),
sequelize: Joi.object()
.instance(Sequelize)
.required(),
sync: Joi.boolean().default(false),
forceSync: Joi.boolean().default(false),
debug: Joi.boolean(),
Expand Down
Loading

0 comments on commit ee85ffb

Please sign in to comment.