filter js

This commit is contained in:
Javi Gallego 2018-03-21 07:24:00 +01:00
parent cf06e6291a
commit 256b872dd5
1 changed files with 26 additions and 0 deletions

View File

@ -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"]
}
}
}
}]
};
}
};