cannercms
cannercms copied to clipboard
Firestore relation broken parent
Describe the bug Implement self relation categories just like example from cms30-08-ecommerce but with Firestore
To Reproduce Steps to reproduce the behavior:
- use (almost) the same categories.schema.js from example
import CannerScript from 'canner-script';
export default () => (
<array
keyName="categories"
ui="tree"
title="Categories"
description="Dealing with relationship data is annoying, but in Canner, it\'s just a few tags and properties."
dataSource={{name: 'firestore'}}
uiParams={{
relationField: "parent",
columns: [
{
title: "Category Name",
dataIndex: "name"
}
]}}>
<string keyName="name" title="Category Name" required />
<relation
keyName="parent"
ui="singleSelectTree"
relation={{
type: "toOne",
to: "categories"
}}
title="Parent Category"
uiParams={{
disabled: (data, treeKey) => {
return treeKey.indexOf("-") !== -1;
},
textCol: data => data.name,
relationField: "parent"
}}
>
<toolbar>
</toolbar>
</relation>
</array>
);
- add 1 parent and try adding 2 children to him
- check firestore
- See error
Expected behavior Both children should be under the parent.
Screenshots
Dependencies (please complete the following information):
- OS: MacOS 10.14.3
- Browser Chrome 73
- Node Version v8.15.1
- Canner Version 3.2.13
Additional context Relationships (especially self ones) mapping is very confusing in documentation. I honestly don't know how to make uni-directional or bi-directional, and how to do a one-to-many relationship