From 256b872dd5f3e000e275ac47a532e835b1d484d7 Mon Sep 17 00:00:00 2001 From: jgallego Date: Wed, 21 Mar 2018 07:24:00 +0100 Subject: [PATCH] filter js --- services/ticket/common/methods/sale/filter.js | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 services/ticket/common/methods/sale/filter.js diff --git a/services/ticket/common/methods/sale/filter.js b/services/ticket/common/methods/sale/filter.js new file mode 100644 index 000000000..b33d5f1b6 --- /dev/null +++ b/services/ticket/common/methods/sale/filter.js @@ -0,0 +1,26 @@ +module.exports = Self => { + Self.installMethod('filter', filterParams); + + function filterParams(params) { + return { + where: { + ticketFk: params.ticketFk + }, + skip: (params.page - 1) * params.size, + limit: params.size, + order: params.order || 'concept ASC', + include: [{ + relation: "itemTag", + scope: { + fields: ["id", "value", "priority", "tagFk"], + include: { + relation: "tag", + scope: { + fields: ["name"] + } + } + } + }] + }; + } +};