IGME-Research-Studio / bloxeo-server

Server for our Brainstorm App
MIT License
2 stars 0 forks source link

Require idea destroy() to need admin #218

Closed erickipnis closed 8 years ago

erickipnis commented 8 years ago

Fixed the anonymous function to use .spread instead.

dropofwill commented 8 years ago

One complication I just thought of is that when an Idea is removed it also needs to be removed from all the IdeaCollections as well.

This is kind of tricky and makes me think we should just let this one fall out of the release. At least until Monday.

There is apparently no way to define a cascade delete or dependent destroy in Mongo/Mongoose and best practice is to use the remove middleware (like we do with duplicate checks on save). Basically we're going to have to grab all the IdeaCollection's idea collections (lol) and pull out the ones whose idea id match what we just deleted.

erickipnis commented 8 years ago

That sound's god awful, but yeah that's a good point. Let's proceed with a solution for that on Monday.

dropofwill commented 8 years ago

http://stackoverflow.com/questions/14348516/cascade-style-delete-in-mongoose

erickipnis commented 8 years ago

Implemented cascading removal of removed idea from idea collections that contained the idea.