Skip to content

Commit

Permalink
feat(apis): add updated at date ✨
Browse files Browse the repository at this point in the history
  • Loading branch information
PierreBrisorgueil committed Mar 25, 2020
1 parent 6448b85 commit 5468277
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/helpers/montaineSave.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const prepareSave = (object, date) => {
* @param {object} object - object to prepare
* @return {[object]} [object] - array of action for insert in mongoose
*/
const prepareMongoose = (object) => {
const prepareMongoose = (object, date) => {
const filter = {};
const arrays = [];
const edits = [];
Expand Down Expand Up @@ -73,7 +73,7 @@ const prepareMongoose = (object) => {
const init = {
filter,
update: {
$set: filter,
$set: { ...filter, ...{ updatedAt: date } },
},
upsert: true,
};
Expand Down
2 changes: 1 addition & 1 deletion modules/apis/repositories/apis.repository.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,5 +89,5 @@ exports.getApiData = (collection) => {
model = mongoose.model(collection, _schema);
}

return model.find().sort('-createdAt').exec();
return model.find().sort('-updatedAt').exec();
};

0 comments on commit 5468277

Please sign in to comment.