2017-12-04 07:17:29 +00:00
|
|
|
module.exports = function(Self) {
|
2018-01-05 07:06:21 +00:00
|
|
|
Self.installMethod('filter', filterParams);
|
2017-12-04 07:17:29 +00:00
|
|
|
|
|
|
|
function filterParams(params) {
|
|
|
|
return {
|
|
|
|
where: {
|
|
|
|
clientFk: params.clientFk
|
|
|
|
},
|
|
|
|
skip: (params.page - 1) * params.size,
|
|
|
|
limit: params.size,
|
|
|
|
order: params.order || 'created DESC',
|
|
|
|
include: {
|
|
|
|
relation: "employee",
|
|
|
|
scope: {
|
|
|
|
fields: ["id", "name", "surname"]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
};
|