Giter VIP home page Giter VIP logo

Comments (1)

smyrman avatar smyrman commented on May 28, 2024 2

As a first warning, there isn't much active development of rest-layer. We for one have decided to use it more or less, as-is, and the original author, @rs, is not using this project in production.

That said, you are welcome to attempt to create a PR four your use-case. Before you start on the code though, there are some considerations to take:

  1. How do you find the related resource for Filter validation in the schema package (with no knowledge of the resource package)? Do you define a better interface for finding related resources?
  2. Do you always allow filtering of related resources, or do need to configure it in the schema?
  3. How do you implement this within the resource pacakge and/or within the resource Storer implementations?

Implementation wise, as there are no joins available in the rest-layer abstraction, there would need to be two distinct queries when doing related lookup. E.g. first get all companies, then extract the IDs, and then do the final query.

For example, if a user has just permission to see measurements related to a specific company, I can easily add a filter predicate to the query.

As for permissions, then you can do this with resource hooks today, as your own extension to rest-layer. Within the hooks, you can do as many sub-queries as you need. We have a permission system where we do perform related queries, compile the result into a new query for the target resource (usually an $in query), and finally join the permission query with the user query with an explicit AND.

from rest-layer.

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.