Skip to content
This repository has been archived by the owner on Apr 24, 2023. It is now read-only.

Firestore relation broken parent #168

Open
cristian-milea opened this issue Mar 29, 2019 · 0 comments
Open

Firestore relation broken parent #168

cristian-milea opened this issue Mar 29, 2019 · 0 comments
Labels
bug Something isn't working

Comments

@cristian-milea
Copy link

cristian-milea commented Mar 29, 2019

Describe the bug
Implement self relation categories just like example from cms30-08-ecommerce but with Firestore

To Reproduce
Steps to reproduce the behavior:

  1. 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>
);
  1. add 1 parent and try adding 2 children to him
  2. check firestore
  3. See error

Expected behavior
Both children should be under the parent.

Screenshots
Screen Shot 2019-03-29 at 02 57 01
Screen Shot 2019-03-29 at 02 56 52
Screen Shot 2019-03-29 at 02 56 41

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

@cristian-milea cristian-milea added the bug Something isn't working label Mar 29, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant