2019-01-14 10:35:48 +00:00
|
|
|
module.exports = Self => {
|
2019-05-30 06:41:08 +00:00
|
|
|
Self.remoteMethodCtx('confirm', {
|
2019-01-18 12:37:48 +00:00
|
|
|
description: 'Confirms an order',
|
2019-01-14 10:35:48 +00:00
|
|
|
accessType: 'WRITE',
|
|
|
|
accepts: [{
|
|
|
|
arg: 'id',
|
|
|
|
type: 'number',
|
|
|
|
required: true,
|
|
|
|
description: 'order id',
|
|
|
|
http: {source: 'path'}
|
|
|
|
}],
|
|
|
|
returns: {
|
|
|
|
type: 'object',
|
|
|
|
root: true
|
|
|
|
},
|
|
|
|
http: {
|
|
|
|
path: `/:id/confirm`,
|
|
|
|
verb: 'POST'
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2019-05-30 06:41:08 +00:00
|
|
|
Self.confirm = async(ctx, orderFk) => {
|
|
|
|
const userId = ctx.req.accessToken.userId;
|
|
|
|
let query = `CALL hedera.order_confirmWithUser(?, ?)`;
|
|
|
|
return await Self.rawSql(query, [orderFk, userId]);
|
2019-01-14 10:35:48 +00:00
|
|
|
};
|
|
|
|
};
|