collection update sale
This commit is contained in:
parent
e893576591
commit
60d80502d1
|
@ -0,0 +1,42 @@
|
|||
module.exports = Self => {
|
||||
Self.remoteMethodCtx('collectionUpdateSale', {
|
||||
description: 'Update sale of a collection',
|
||||
accessType: 'WRITE',
|
||||
accepts: [{
|
||||
arg: 'sale',
|
||||
type: 'Number',
|
||||
required: true,
|
||||
description: 'The sale id'
|
||||
}, {
|
||||
arg: 'originalQuantity',
|
||||
type: 'Number',
|
||||
required: true,
|
||||
description: 'The quantity to sale'
|
||||
}, {
|
||||
arg: 'ticketFk',
|
||||
type: 'Number',
|
||||
required: true,
|
||||
description: 'The ticket id'
|
||||
}, {
|
||||
arg: 'stateFk',
|
||||
type: 'Number',
|
||||
required: true,
|
||||
description: 'The state id'
|
||||
}],
|
||||
returns: {
|
||||
type: 'Object',
|
||||
root: true
|
||||
},
|
||||
http: {
|
||||
path: `/collectionUpdateSale`,
|
||||
verb: 'POST'
|
||||
}
|
||||
});
|
||||
|
||||
Self.collectionUpdateSale = async(ctx, sale, originalQuantity, ticketFk, stateFk) => {
|
||||
const userId = ctx.req.accessToken.userId;
|
||||
|
||||
query = `vn.collection_updateSale(?,?,?,?,?)`;
|
||||
return await Self.rawSql(query, [sale, originalQuantity, userId, stateFk, ticketFk]);
|
||||
};
|
||||
};
|
|
@ -2,4 +2,5 @@ module.exports = Self => {
|
|||
require('../methods/collection/collectionGet')(Self);
|
||||
require('../methods/collection/collectionNew')(Self);
|
||||
require('../methods/collection/getSectors')(Self);
|
||||
require('../methods/collection/collectionUpdateSale')(Self);
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue