Giter VIP home page Giter VIP logo

Comments (6)

raymondfeng avatar raymondfeng commented on September 26, 2024

A few options:

  1. Add a beforeRemote hook to patch the filter object
  2. Add a belongsTo relation to Installation. You should be able to do so using a boot script.
  3. Submit a PR so that we can add belongsTo relations to Installation.

from loopback-component-push.

nullEuro avatar nullEuro commented on September 26, 2024

Could you elaborate on the first one please?

from loopback-component-push.

raymondfeng avatar raymondfeng commented on September 26, 2024
MyModel.beforeRemote('find', function(ctx, inst, next) {
  var filter = ctx.args[0];
  // Patch filter here
  ...
  next();
});

from loopback-component-push.

nullEuro avatar nullEuro commented on September 26, 2024

For anyone interested in the result: https://gist.github.com/nullEuro/6ea7c6c1de7206a44fd3

Feel free to criticize.

from loopback-component-push.

raymondfeng avatar raymondfeng commented on September 26, 2024

This is great. We should try to generalize the solution. such as:

Allowing the request to contain variables, for example:

{
  where: {
    userId: {{ctx.user.id}}
  }
} 

from loopback-component-push.

superkhau avatar superkhau commented on September 26, 2024

Closing this as there is nothing left to resolve here.

from loopback-component-push.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.