21 lines
540 B
JavaScript
21 lines
540 B
JavaScript
module.exports = function(Self) {
|
|
Self.installMethod('filter', filterParams);
|
|
|
|
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"]
|
|
}
|
|
}
|
|
};
|
|
}
|
|
};
|