Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow defining default values for query filters #168

Closed
gcirne opened this issue Jul 9, 2014 · 5 comments
Closed

Allow defining default values for query filters #168

gcirne opened this issue Jul 9, 2014 · 5 comments

Comments

@gcirne
Copy link

gcirne commented Jul 9, 2014

For example, I would like to specify a default value of 10 for the limit filter of a particular model. In situations where no explicit limit is given, then the default value of 10 should be used.

@fabien
Copy link
Contributor

fabien commented Jul 11, 2014

@gcirne see #172 - this is for hasMany relations, but perhaps we can do something similar for what you're requesting. @raymondfeng thoughts?

@gcirne
Copy link
Author

gcirne commented Jul 11, 2014

Sure, that sounds good.

Guilherme Machado Cirne
[email protected]

On Fri, Jul 11, 2014 at 2:06 PM, Fabien Franzen [email protected]
wrote:

@gcirne https://github.com/gcirne see #172
#172 -
this is for hasMany relations, but perhaps we can do something similar for
what you're requesting. @raymondfeng https://github.com/raymondfeng
thoughts?


Reply to this email directly or view it on GitHub
#168 (comment)
.

@raymondfeng
Copy link
Contributor

Maybe we should try to unify everything under scope?

  1. scope defines some sort of constrained connection to other models or the declaring model itself.
  2. scope has the following properties:
    • name
    • sourceModel
    • targetModel
    • predefined query filter (can be static and/or dynamic)
    • predefined related properties (can be static and/or dynamic)
  3. For a model, we can define a default scope
  4. scopes can be chained (such as User.vips.active)

@raymondfeng
Copy link
Contributor

My ambition for a LoopBack model will be:

  1. A model has a list of managed properties and optional open properties
  2. A model has a list of connections to other models or services
    • relations
    • scopes
    • custom methods
  3. A model can have extra metadata for persistence/transfer/remoting
  4. A model can have behaviors (methods) mixed in from connectors or custom code
  5. The model properties and connections form a model graph
  6. The model graph allows you to read/write local states (properties) and connected states (connections)
  7. The model graph allows you to navigate following connections
  8. The model graph has the ability to pick and choose what information to be selected
    • select a list of instances
    • select a list of properties for a given instance
    • select a list of connected instances or data
    • embed the data or embed the links

@raymondfeng
Copy link
Contributor

The defaultScope should support your use case now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants