Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add parent objects to mongodb documents #9

Closed
signebedi opened this issue May 29, 2023 · 2 comments
Closed

Add parent objects to mongodb documents #9

signebedi opened this issue May 29, 2023 · 2 comments

Comments

@signebedi
Copy link
Owner

If we want to create child documents of parent documents...

This should be as simple as adding a parent key:value

@signebedi
Copy link
Owner Author

[pages] consider making children elements draggable in the UI
In #9, I think we needed to make ONLY parent objects draggable, lest we run into complexity issues. However, over time it will be worth considering how we can make the children elements draggable, too...

@signebedi
Copy link
Owner Author

[bug] position field broken with children elements
Currently, when we create children, it still uses the standard position of the document based on the length of the total database.

    def create(self, data, parent_id=None):
        data['created_at'] = datetime.datetime.now()
        data['last_edited'] = datetime.datetime.now()
        data['position'] = self.collection.count_documents({}) + 1  # Assign the next position
        if parent_id is not None:
            data['parent_id'] = parent_id  # Add the parent_id to the document
        return self.collection.insert_one(data).inserted_id

We need to change this such that, if parent is not null, we use different logic to determine position.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant