salix/services/loopback/common/methods/ticket/componentUpdate.js

42 lines
1.1 KiB
JavaScript

module.exports = Self => {
Self.remoteMethod('componentUpdate', {
description: 'Save ticket sale components',
accessType: 'WRITE',
accepts: [{
arg: 'ticketFk',
type: 'number',
required: true,
description: 'ticket id',
http: {source: 'path'}
}, {
arg: 'data',
type: 'Object',
required: true,
description: 'landed, addressFk, agencyModeFk',
http: {source: 'body'}
}],
returns: {
type: ['Object'],
root: true
},
http: {
path: `/:ticketFk/componentUpdate`,
verb: 'post'
}
});
Self.componentUpdate = async (ticketFk, data) => {
let query = 'CALL vn.ticketComponentMakeUpdate(?, ?, ?, ?, ?, ?, ?)';
let res = await Self.rawSql(query, [
ticketFk,
data.agencyModeFk,
data.addressFk,
data.warehouseFk,
data.shipped,
data.landed,
data.option
]);
return res;
};
};