Skip to content

Instantly share code, notes, and snippets.

@dmastag
Created July 24, 2018 10:32
Show Gist options
  • Save dmastag/5d4fd8436e4559fb8ae9da7a965ca763 to your computer and use it in GitHub Desktop.
Save dmastag/5d4fd8436e4559fb8ae9da7a965ca763 to your computer and use it in GitHub Desktop.
Cara di Loopback untuk memaksa penambahan Limit
Member.beforeRemote(
"prototype.__get__tickets",
async (ctx, instance, next) => {
if (!ctx.args.filter || !ctx.args.filter.limit) {
if (!ctx.args.filter) ctx.args.filter = {};
ctx.args.filter.limit = 10;
} else {
ctx.args.filter.limit = Math.min(ctx.args.filter.limit, 10);
}
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment