30 lines
770 B
JavaScript
30 lines
770 B
JavaScript
module.exports = Self => {
|
|
Self.remoteMethodCtx('confirm', {
|
|
description: 'Confirms an order',
|
|
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'
|
|
}
|
|
});
|
|
|
|
Self.confirm = async(ctx, orderFk) => {
|
|
const userId = ctx.req.accessToken.userId;
|
|
const query = `CALL hedera.order_confirmWithUser(?, ?)`;
|
|
const response = await Self.rawSql(query, [orderFk, userId], {userId});
|
|
|
|
return response;
|
|
};
|
|
};
|