Skip to content

How to work with ReferenceArrayField / ReferenceArrayInput #13

@henrik-d

Description

@henrik-d

Hi,
first of all thanks for sharing the dataProvider. I have a problem with Many-to-Many relationsships.

A Book has many Authors.
An Author writes many Books.

In React Admin in the books resource I want to display / edit the related authors using ReferenceArrayField / ReferenceArrayInput. The problem is that React Admin expects the following format:

// book  as required by React Admin
{
    "title": "Book Title",
    "auhors": [2,4,5] //just the authorIds
}

Whereas Nest-Crud generates and requires a list of objects with at least idto update the relationship.

// book  as required by Nest CRUD
{
    "title": "Book Title",
    "auhors": [{"id": 2}, {"id": 4}, {"id": 5}] //objects
}

What would you recommend? Can this issue be solved in the dataProvider or elsewhere in React Admin? Or is it best to solve it on the server side, e.g. with an interceptor?

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions