Comments (9)
Hey,
I think what you're referring to is if you have, for example, a one-to-many relation between Song and Album, being able to look up like /album/12/song/3
? We had sort of a long debate about this over on #34, and came to the conclusion at the time that in that case there's no real need for the /album/12
part of the route; if you're already working with a list of Songs from that Album, this would essentially be the same as /songs/:id
.
To that end, and please correct me if the assumption I made earlier is incorrect, no that is not currently implemented in epilogue. I'm not completely against incorporating the feature into the module, but I think some discussion about the merits of that approach is warranted first.
from epilogue.
Hi,
I want a relational model on the front end so that parent collections can have a currently selected model, and thus the child collection need to be the set of members of that parent. So yes I want the songs on album 12. How do I ask for that ?
from epilogue.
boy that thread's long and it's late here, I'm sure you do this, I dont need arbitrary nesting (I got as far as "that's an anti-pattern"), but that's such a long discussion I should read as soon as I get up.
I also need a callback to implement some filter on posted and getted records as an access cotnrol mechanism, I think this middleware stuff you've done must handle that.
much obliged.
from epilogue.
@mark-lester to get the songs on album 12 you would first enable associations: true
on your resource to trigger automatic association generation. Then you would point your browser to like /albums/12/songs
from epilogue.
@mbroadst after some thought (and editing what I said earlier) I realised that my problem now is that DataSet owns everything, apart from User which owns it. I am getting an outer join on 10 tables when I just go /DataSets, and that breaks. /DataSets/1/Agencies works, which is why I thought it was because I'd declared a resource on everything it had got upset. All I want /DataSets to do is list datasets, i dont want a join.
from epilogue.
OK, so it was that nasty options.include array. I've just brutalised that for now, is there a switch to turn it off or just explicitly specify the models you want.
if (Object.keys(criteria).length)
options.where = criteria;
options.include=[]; // brutalisation
return model
.findAndCountAll(options)
...
from epilogue.
Hm, I haven't really experienced a situation like this yet (this might be a smell that your DataSet
is doing a bit too much work, however that's most likely not changeable). If you look here you'll see that we're using this.include
to cache the includes on a per-resource basis. Theoretically you could create the resource, and immediately afterwards do something like myResource.controllers.list.include = []
though this might cause some other sort of havoc considering we don't test these types of scenarios.
from epilogue.
Yeah my DataSet is sort of a DB instance, so it owns everything. Things seem to be working, but I havent done any posting or anything yet, so I'll let you know.
Thanks a lot for this stuff.
from epilogue.
Hello,
I'm new to epilogue and sequelize and wish to achieve the same thing. Tried with this:
var Project = database.define('Projects', {
name: {
type: Sequelize.STRING
},
archived: {
type: Sequelize.BOOLEAN
}
});
var Sprint = database.define('Sprints', {
name: {
type: Sequelize.STRING
},
startsAt: {
type: Sequelize.DATE
},
endsAt: {
type: Sequelize.DATE
}
});
Project.hasMany(Sprint, {as: 'Sprints'});
(...)
var projectResource = epilogue.resource({
model : Project,
associations : true,
endpoints : ['/projects', '/projects/:id']
});
I noticed that I can request, as example, GET
to projects/1/sprints
(project with id=1 exists), which returns an empty array, but I can't POST
to the same address, coming status 404 as response.
Is it possible to achieve it? I'm I missing something?
Thanks in advance
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.