fremail / sequelize-nested-set

Library to store and manage nested set trees using Sequelize
MIT License
40 stars 10 forks source link

Error converting a sub tree of records into a separate tree, using the "makeRoot" command. #10

Closed jpsepulvedaf closed 5 years ago

jpsepulvedaf commented 5 years ago

Hi good day. I try to convert a sub tree of records into a separate tree (as root) using the "makeRoot" command. As a result, the main registry becomes root, but its children do not.

Initially I have the following list of records:

img1

Next I want to convert the tree with record ID: 15 into an independent tree, executing the following code:

let category = await models.Category.findOne({where:{id:15}});
await category.makeRoot();

and as a result it only converts the record ID: 15 to root, but its children are not updated as children of the ID: 15.

img2

I hope you can help me.

fremail commented 5 years ago

Hi @jpsepulvedaf!

Thank you for reporting this bug.

I made a fix for the bug and released v. 1.3.1. Update your dependencies to get the fix.

And thank you for using this library :)

jpsepulvedaf commented 5 years ago

Thank you very much. The functionality that this library applies is extremely important, and is implemented by all mature ORMs. It strikes me that the Secuelize community does not give it the use it should. Thank you very much for the effort in the maintenance. Greetings.