openbeta-graphql
openbeta-graphql copied to clipboard
Create an "update parent" mutation
Use case
I want to move an area to be under a different parent.
To do:
- [ ] Update parent id
- [ ] Update path tokens (look at area renaming code for ways to recursively update children's paths)
- [ ] Update ancestors
- [ ] Unit test
I've been needing this for a while and have decided to tackle it in connection with another feature I am needing - which would benefit greatly from knowing how group structures are changed and validated.
I will create a PR soon, but the gist is that I am going to add a new field to the area collection by the name of 'parent'. This is the source of truth from which
- path tokens
- ancestors
- children
will be derived (Not to mention my other structure hierarchy query will be able to run 2-4x faster through the mongo pipeline)