Sunday, 3 February 2019

How to handle drag and drop lists in mongodb/express?

I'm building a kanban board like spa with user boards that contain lists, and lists that contain cards all with drag and drop functionality using vue.js in front-end and express.js with mongoose in back-end.

I'm currently stuck on how to set up my models and sorting correctly.

Could anyone give me an example of a 3 simple mongoose models for a board, a list and a card that would work for a drag and drop functionality for lists and cards, together with sorting, routes would be awesome too?

I'm completely lost if I should use embedding or referencing, I've tried both ways but it doesn't seem right.

EDIT:

I know how trello/wakan/kanbanflow does it, I know about the websockets way, but for now I just need a very simple, basic set-up without realtime updates.

From what I gather -

Board model - contains members array with id's of users List model - contains board id and list of cards (refs or embedded?), or just board id? Card model - contains board id and list id?

How would I query the cards for the board view, as they have to be in their own respected lists?

I get a board by id, then use aggregation and lookup/fill boards lists, then for each of those lists i should look up/fill with cards? Sounds like a lot of querying going on, not really efficient?

For board I only really need to add members, change the title.

For list - I need to be able to re-order them and change title.

For cards - Alot of stuff going on here: title, description, card members, activities, comments etc.. I think I'll use referenced activities,comments, card members etc, but my main concern is how to handle the re-ordering and creating/deleting cards/lists with drag and drop?



from How to handle drag and drop lists in mongodb/express?

No comments:

Post a Comment