Skip to content

Commit c3e6532

Browse files
committed
Fix: hasTimestamps.indexOf is not a function
Closes #5
1 parent 0a39b96 commit c3e6532

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/delete.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ module.exports = function(req, res, urlPieces, model, config) {
2020
let result = {};
2121
result[model.idAttribute] = model.id;
2222
let promise = null;
23-
if(model.hasTimestamps.indexOf(config.deletedAttribute) >= 0 && (!req.hardDelete && !config.hardDelete || (req.hardDelete === false))) {
23+
let hasTimestamps = model.hasTimestamps || [];
24+
if(hasTimestamps.indexOf(config.deletedAttribute) >= 0 && (!req.hardDelete && !config.hardDelete || (req.hardDelete === false))) {
2425
let updatedData = {};
2526
updatedData[model.hasTimestamps[2]] = new Date();
2627
promise = model.save(updatedData, {method: 'update'})

src/get.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ module.exports = function(req, res, urlPieces, model, config) {
88
}
99
);
1010

11-
if(model.hasTimestamps.indexOf(config.deletedAttribute) !== -1) {
11+
let hasTimestamps = model.hasTimestamps || [];
12+
if(hasTimestamps.indexOf(config.deletedAttribute) !== -1) {
1213
promise = promise.where(config.deletedAttribute, null);
1314
}
1415

0 commit comments

Comments
 (0)