todos-contra-el-fuego-web/imports/api/Utility/Utils.js
2017-12-18 03:16:06 +01:00

29 lines
780 B
JavaScript

/* eslint-disable consistent-return */
/* eslint-disable prefer-arrow-callback */
export const defaultCreatedAt = {
type: Date,
// autoform: { type: 'hidden' },
// Prefer normal function: https://github.com/aldeed/meteor-simple-schema/issues/562
autoValue: function autovalue() {
if (this.isInsert) {
return new Date();
}
// Prevent user from supplying their own value
this.unset();
},
optional: true // TODO: Use migration for users
};
export const defaultUpdateAt = {
type: Date,
// autoform: { type: 'hidden' },
autoValue: function autovalue() {
if (this.isUpdate || this.isInsert) {
return new Date();
}
},
// Commented because we want to have updateAt = createAt initialy
// denyInsert: true,
optional: true
};