salix/modules/worker/back/models/worker-observation.js

13 lines
364 B
JavaScript
Raw Permalink Normal View History

2023-03-24 11:11:42 +00:00
module.exports = function(Self) {
2023-03-30 06:23:53 +00:00
Self.validatesPresenceOf('text', {
message: 'Description cannot be blank'
});
2023-03-24 11:11:42 +00:00
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;
});
};