salix/modules/ticket/back/methods/sale/updateConcept.js

33 lines
854 B
JavaScript
Raw Normal View History

2019-09-06 09:43:15 +00:00
module.exports = Self => {
Self.remoteMethod('updateConcept', {
description: 'Updates the concept of a sale',
accessType: 'WRITE',
accepts: [{
arg: 'id',
type: 'number',
required: true,
description: 'sale ID',
http: {source: 'path'}
}, {
arg: 'newConcept',
type: 'any',
required: true,
description: 'new concept'
}],
returns: {
type: 'string',
root: true
},
http: {
path: `/:id/updateConcept`,
verb: 'post'
}
});
Self.updateConcept = async(id, newConcept) => {
let currentLine = await Self.app.models.Sale.findById(id);
2019-09-06 09:43:15 +00:00
return await currentLine.updateAttributes({concept: newConcept});
};
};