mirror of
https://github.com/wekan/wekan.git
synced 2025-12-16 15:30:13 +01: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';
|
||||
|
||||
Actions = new Mongo.Collection('actions');
|
||||
|
||||
Actions.allow({
|
||||
|
|
@ -17,3 +19,16 @@ Actions.helpers({
|
|||
return this.desc;
|
||||
},
|
||||
});
|
||||
|
||||
Actions.before.update((userId, doc, fieldNames, modifier, options) => {
|
||||
modifier.$set = modifier.$set || {};
|
||||
modifier.$set.modifiedAt = Date.now();
|
||||
});
|
||||
|
||||
if (Meteor.isServer) {
|
||||
Meteor.startup(() => {
|
||||
Actions._collection._ensureIndex({ modifiedAt: -1 });
|
||||
});
|
||||
}
|
||||
|
||||
export default Actions;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue