dchester / epilogue

Create flexible REST endpoints and controllers from Sequelize models in your Express app
846 stars 116 forks source link

Foreign key being deleted from associated fetch #104

Closed mark-lester closed 8 years ago

mark-lester commented 9 years ago

/Routes/1/Trips drops the RouteId, which is 1 of course so it's not a show stopper for me to have to put it back. Is there is a way of asking for it not to be removed ?,

I thought I had the block of code that was doing that at the end of list.js but I remarked it out and RouteId was still missing.

mark-lester commented 9 years ago

So there's two places where this is done, once at the bottom of list.js, but then again, with no attempt at qualification, at the bottom of has-many. I've remarked both out pending thought on how to configure, but do we need both of these ?.

mbroadst commented 9 years ago

@mark-lester hey, it would be helpful if you could link to the code you're referring to in the comments to help me track through this with you. Are you referring to this here? It does indeed look like that is double effort. If you pull it out does it break any tests? I'd say go ahead and remove it otherwise

A little bit of a caveat emptor here: the auto association code was based on an original punt I was working on when I still needed this module for a larger project. It was then completed by another user in collaboration wit me, but it is certainly missing functionality.

As far as the initial question, the primary keys should not be stripped by default, though you may have discovered why they are in your case here already.

mark-lester commented 9 years ago

yes thats the line, I thought it was also going on here https://github.com/dchester/epilogue/blob/master/lib/Controllers/list.js#L141 but I dont have any includes of course, so that wasnt getting called anyway.

mbroadst commented 8 years ago

@mark-lester should be fixed in https://github.com/dchester/epilogue/commit/8d31e62c8e9434bd73b7a0d2cd6bb0cd11fe5632, would appreciate if you could check that out

mark-lester commented 8 years ago

@mbroadst many thanks indeed, I will test first thing in the morning.

mark-lester commented 8 years ago

yes that worked for me many thanks.