choko icon indicating copy to clipboard operation
choko copied to clipboard

List references

Open recidive opened this issue 10 years ago • 3 comments

Allow "list" reference type that would create an aditional endpoint e.g. rest/myType/some-item/myReferenceFieldName, so for e.g. if we have blog posts on path rest/blog/some-blog-post, we could have a list reference field "comments" so we could access this blog post comments as rest/blog/some-blog-post/comments.

recidive avatar May 07 '14 20:05 recidive

#29 is related.

recidive avatar Sep 13 '14 13:09 recidive

This is now possible after waterline integration, you can use the via property to tell what field on the referenced type map to the current type. E.g.:

On a comment type:

fields: {
  post: {
    type: 'reference',
    reference: {
      type: 'post'
    }
  }
}

On a post type:

fields: {
  comments: {
    type: 'reference',
    reference: {
      type: 'comment',
      via: 'post'
    }
  }
}

Then you can populate comments on post item with the populate() method.

It still needs to have endpoints for getting referenced items via REST like this issue describes.

recidive avatar Oct 10 '14 17:10 recidive

:+1:

jardix22 avatar Oct 28 '14 14:10 jardix22