const valuesValidator = (value) => { if (!_.isPlainObject(value)) { return false; } if (!_.isPlainObject(value.board)) { return false; } return true; }; module.exports = { inputs: { values: { type: 'ref', custom: valuesValidator, required: true, }, request: { type: 'ref', }, }, async fn(inputs) { const { values } = inputs; const label = await Label.create({ ...values, boardId: values.board.id, }).fetch(); sails.sockets.broadcast( `board:${label.boardId}`, 'labelCreate', { item: label, }, inputs.request, ); return label; }, };