mirror of
https://github.com/wekan/wekan.git
synced 2025-09-22 01:50:48 +02:00
Add createdAt and modifiedAt to all collections
This commit is contained in:
parent
fb728baf0c
commit
c60e80d25b
37 changed files with 3722 additions and 2168 deletions
|
@ -1,3 +1,5 @@
|
|||
import { Meteor } from 'meteor/meteor';
|
||||
|
||||
Triggers = new Mongo.Collection('triggers');
|
||||
|
||||
Triggers.mutations({
|
||||
|
@ -23,7 +25,6 @@ Triggers.allow({
|
|||
});
|
||||
|
||||
Triggers.helpers({
|
||||
|
||||
description() {
|
||||
return this.desc;
|
||||
},
|
||||
|
@ -56,3 +57,16 @@ Triggers.helpers({
|
|||
return cardLabels;
|
||||
},
|
||||
});
|
||||
|
||||
Triggers.before.update((userId, doc, fieldNames, modifier, options) => {
|
||||
modifier.$set = modifier.$set || {};
|
||||
modifier.$set.modifiedAt = Date.now();
|
||||
});
|
||||
|
||||
if (Meteor.isServer) {
|
||||
Meteor.startup(() => {
|
||||
Triggers._collection._ensureIndex({ modifiedAt: -1 });
|
||||
});
|
||||
}
|
||||
|
||||
export default Triggers;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue