module.exports = Self => { Self.remoteMethodCtx('salePreparingList', { description: 'Returns a list with the lines of a ticket and its different states of preparation', accessType: 'READ', accepts: [{ arg: 'id', type: 'number', required: true, description: 'The ticket id', http: {source: 'path'} }], returns: { type: ['object'], root: true }, http: { path: `/:id/salePreparingList`, verb: 'GET' } }); Self.salePreparingList = async(ctx, id, options) => { const myOptions = {}; if (typeof options == 'object') Object.assign(myOptions, options); query = `CALL vn.salePreparingList(?)`; const [sales] = await Self.rawSql(query, [id], myOptions); return sales; }; };