From 897843040f26f280310fc19e316eaeb946f71382 Mon Sep 17 00:00:00 2001 From: austinfrey <11063598+austinfrey@users.noreply.github.com> Date: Tue, 8 Oct 2019 00:55:41 -0400 Subject: [PATCH 1/2] updated package.json --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index 436cabc..42eda11 100644 --- a/package.json +++ b/package.json @@ -14,6 +14,7 @@ "body-parser": "^1.18.2", "bookshelf": "^0.13.3", "bookshelf-secure-password": "^3.0.1", + "bookshelf-virtuals-plugin": "^0.1.1", "concurrently": "^3.5.1", "dotenv": "^5.0.1", "express": "^4.16.3", From aa4f1c141ae923026be558b8b85e2cc088e1f640 Mon Sep 17 00:00:00 2001 From: austinfrey <11063598+austinfrey@users.noreply.github.com> Date: Tue, 8 Oct 2019 00:58:49 -0400 Subject: [PATCH 2/2] updated plugins added `bookshelf-virtuals-plugin`. this is needed to use virtual computed properties like new User({password: 'password'}) and have is hashed and added correctly to the db under `password_digest` --- database/index.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/database/index.js b/database/index.js index bb4a8d4..9ed7474 100644 --- a/database/index.js +++ b/database/index.js @@ -3,6 +3,8 @@ const knexDb = knex({ client: 'pg', connection: 'postgres://localhost/jwt_test' const bookshelf = require('bookshelf'); const securePassword = require('bookshelf-secure-password'); const db = bookshelf(knexDb); +db.plugin('bookshelf-virtuals-plugin'); + db.plugin(securePassword); module.exports = db;