13 lines
364 B
JavaScript
13 lines
364 B
JavaScript
module.exports = function(Self) {
|
|
Self.validatesPresenceOf('text', {
|
|
message: 'Description cannot be blank'
|
|
});
|
|
|
|
Self.observe('before save', async function(ctx) {
|
|
ctx.instance.created = new Date();
|
|
let token = ctx.options.accessToken;
|
|
let userId = token && token.userId;
|
|
ctx.instance.userFk = userId;
|
|
});
|
|
};
|