User schema wip

This commit is contained in:
vjrj 2017-12-13 22:21:20 +01:00
parent 8b8b145360
commit 633e552b31
3 changed files with 135 additions and 2 deletions

View file

@ -0,0 +1,26 @@
/* eslint-disable consistent-return */
export const defaultCreatedAt = {
type: Date,
// autoform: { type: 'hidden' },
autoValue: () => {
if (this.isInsert) {
return new Date();
}
// Prevent user from supplying their own value
this.unset();
}
};
export const defaultUpdateAt = {
type: Date,
// autoform: { type: 'hidden' },
autoValue: () => {
if (this.isUpdate || this.isInsert) {
return new Date();
}
},
// Commented because we want to have updateAt = createAt initialy
// denyInsert: true,
optional: true
};