From f7730d760c0bffb085496287e93d7f51ab68737e Mon Sep 17 00:00:00 2001 From: Axel Navarro Date: Wed, 24 Jan 2018 09:11:13 -0300 Subject: [PATCH] feat(model): add mongoose-history plugin for SurveyAddress --- package-lock.json | 6 ++++++ package.json | 1 + src/model/surveyAddress.js | 3 ++- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/package-lock.json b/package-lock.json index 640a0ff..10f6a96 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4470,6 +4470,12 @@ } } }, + "mongoose-history": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/mongoose-history/-/mongoose-history-0.6.0.tgz", + "integrity": "sha512-c5P8PG9THq35U0m64Y2pGrTklc7MkFOs3w69AfCGzagZCYjsdb+LcaZOvvJAfl/9jfQ7jukgZIlU7JOBhjyJDg==", + "dev": true + }, "mongoose-legacy-pluralize": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/mongoose-legacy-pluralize/-/mongoose-legacy-pluralize-1.0.2.tgz", diff --git a/package.json b/package.json index a8ac562..c684cce 100644 --- a/package.json +++ b/package.json @@ -41,6 +41,7 @@ "gulp-load-plugins": "1.5.0", "gulp-mocha": "6.0.0", "husky": "^1.1.1", + "mongoose-history": "^0.6.0", "should": "13.2.3", "sinon": "6.3.5", "superagent": "^4.0.0-beta.5", diff --git a/src/model/surveyAddress.js b/src/model/surveyAddress.js index 8887ca6..b663cc1 100644 --- a/src/model/surveyAddress.js +++ b/src/model/surveyAddress.js @@ -1,5 +1,6 @@ const {SURVEYS_COLLECTION} = process.env; const mongoose = require('mongoose'); +const history = require('mongoose-history'); const logger = require('../helpers/logger'); const dwelling = require('./dwelling'); @@ -13,4 +14,4 @@ module.exports = mongoose.model('SurveyAddress', new Schema({ user: {type: ObjectId, required: true}, address: {type: ObjectId, ref: 'Address', required: true}, state: {type: Number} -}, {collection: SURVEYS_COLLECTION, timestamps: true})); +}, {collection: SURVEYS_COLLECTION, timestamps: true}).plugin(history));