salix/loopback/common/methods/application/executeProc.js

37 lines
1000 B
JavaScript

module.exports = Self => {
Self.remoteMethodCtx('executeProc', {
description: 'Return result of procedure',
accessType: '*',
accepts: [
{
arg: 'routine',
type: 'string',
description: 'The routine name',
required: true,
http: {source: 'path'}
},
{
arg: 'params',
type: ['any'],
description: 'The params array',
},
{
arg: 'schema',
type: 'string',
description: 'The routine schema',
}
],
returns: {
type: 'any',
root: true
},
http: {
path: `/:routine/execute-proc`,
verb: 'POST'
}
});
Self.executeProc = async(ctx, routine, params, schema, options) =>
Self.execute(ctx, routine, params, schema, 'procedure', options);
};