2018-05-16 06:13:39 +00:00
|
|
|
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'
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2018-05-25 15:25:35 +00:00
|
|
|
Self.componentUpdate = async(ticketFk, data) => {
|
2018-05-25 09:40:04 +00:00
|
|
|
let query = 'CALL vn.ticketComponentMakeUpdate(?, ?, ?, ?, ?, ?, ?, ?)';
|
2018-05-16 06:13:39 +00:00
|
|
|
let res = await Self.rawSql(query, [
|
2018-05-25 15:25:35 +00:00
|
|
|
ticketFk,
|
|
|
|
data.agencyModeFk,
|
|
|
|
data.addressFk,
|
|
|
|
data.warehouseFk,
|
|
|
|
data.shipped,
|
2018-05-16 06:13:39 +00:00
|
|
|
data.landed,
|
2018-05-25 09:40:04 +00:00
|
|
|
data.isDeleted,
|
2018-05-16 06:13:39 +00:00
|
|
|
data.option
|
|
|
|
]);
|
|
|
|
return res;
|
|
|
|
};
|
|
|
|
};
|