From e268451c75d47b162dfd92d45acf38bc3675a8bd Mon Sep 17 00:00:00 2001 From: Luiz Duarte Date: Sat, 2 Jan 2021 18:41:05 -0300 Subject: [PATCH] Update model.js Modern Sequelize doesn't have findById anymore, so, we need to change this to add support to findByPk function. --- src/model.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/model.js b/src/model.js index 313f447..e478ecf 100644 --- a/src/model.js +++ b/src/model.js @@ -346,7 +346,8 @@ fakeModel.prototype.findAndCountAll = function (options) { * @param {Integer} id ID of the instance * @return {Promise} Promise that resolves with an instance with the given ID **/ -fakeModel.prototype.findById = function (id) { +fakeModel.prototype.findById = +fakeModel.prototype.findByPk = function (id) { var self = this; return this.$query({ @@ -690,4 +691,4 @@ fakeModel.prototype.belongsToMany = fakeModel.prototype.hasMany = function (item }; }; -module.exports = fakeModel; \ No newline at end of file +module.exports = fakeModel;