User schema wip
This commit is contained in:
parent
8b8b145360
commit
633e552b31
3 changed files with 135 additions and 2 deletions
26
imports/api/Utility/Utils.js
Normal file
26
imports/api/Utility/Utils.js
Normal 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
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue