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) => { if (schema) routine = schema + '.' + routine; const query = `CALL ${routine}`; return Self.execute(ctx, query, params, options); }; };