Comments (7)
@bradisbell all query items should be converted to search criteria in list: https://github.com/dchester/epilogue/blob/master/lib/Controllers/list.js#L88. There's actually a test that shows this off in particular: https://github.com/dchester/epilogue/blob/master/tests/resource/associations.test.js#L218. As you can see, for the list controller the criteria is built up as part of the fetch milestone so that might be the issue you are running into. I'm up or a discussion about how that preparation should happen earlier in the chain, if you have a proposal.
from epilogue.
@mbroadst I'm not seeing anything in criteria
in any milestone. Am I doing this correctly?
from epilogue.
@bradisbell let's take the ListController for example here:
- context.criteria is used chiefly in the List.prototype.fetch milestone
- prior to this milestone the criteria can be modified, and will in turn be used in that milestone, but nothing explicitly sets any of the criteria
- If you look at that milestone, it saves off a copy of the criteria here, and then uses that criteria to fetch data from the database
- Since it modifies a local copy of the criteria, that's not going to show up in subsequent milestones either
In your provided example if you added something to context.criteria in e.g. the "start" milestone, you would see it in your traces:
.use({
list: {
start: function(req, res, context) {
context.criteria = { some: "criteria" }
return context.continue();
}
}
});
So basically what I'm getting at is: this might not be the best behavior. Maybe we should pull off the criteria much earlier as a default milestone for these controllers (e.g. we move this to List.prototype.start or something). But we need to discuss it a bit first because these behavior changes, while undocumented, are depended upon by existing users
from epilogue.
I think I understand what you are saying. The criteria
is mainly for modification, and not for reading from. Is that correct?
from epilogue.
@bradisbell context.criteria is used in that milestone to modify the query parameters, so in that way yes context.criteria is "for modification." However, I guess I'm pointing out that there is what might considered a bug here because the context.criteria is never updated in the milestone, so you wouldn't see any additional data in subsequent milestones. I'm not sure if I'm even answering your question anymore 😄
from epilogue.
@bradisbell have we answered your question here?
from epilogue.
I think so. At this point I have just written my own middleware for the specific routes that need the functionality I need. Thanks for the reply and explanation.
from epilogue.
Related Issues (20)
- Support to check if Postgres array contains string?
- create inserts nulls on postgres db? HOT 1
- Workflow for pull requests? HOT 2
- Typescript support? HOT 4
- AResouce.list.data.after is not called if AResouce.list.data is not presented
- Controller List is not applying attributes of Model Scope as specified in req.query.scope HOT 1
- search by parameter 'q' does not work HOT 12
- Order of associations HOT 1
- repo unmaintained! active fork: https://github.com/tommybananas/finale HOT 4
- How to add another options item while creating an model instance?
- app[self.method] is not a function
- [Read Endpoint] Get data from two models HOT 1
- Filtering/sorting by association fields
- Project status HOT 1
- EpilogueError: internal error HOT 1
- Sorting ignored with hasMany relationships
- How to define all API routes to be in a separate group
- How do I add auth to all actions of a Resource? HOT 1
- How can I assign fetching items to POST request?
- Cannot set headers after they are sent to the client HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from epilogue.