28 lines
722 B
JavaScript
28 lines
722 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;
|
|
let query = `CALL hedera.order_confirmWithUser(?, ?)`;
|
|
return await Self.rawSql(query, [orderFk, userId]);
|
|
};
|
|
};
|