这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@mnlbox
Copy link
Contributor

@mnlbox mnlbox commented May 7, 2019

Special thanks to @httpsOmkar and @praveenweb for help 😉
Fix #2088

Description

No new parameter add to ra-data-hasura cunstructor.
In below example "online_exam.difficulty" = resource name with schema name (default schema name is public) / If you don't provide primaryKey for a resource in this configs array id use for that resource as a default primary key.
add a config array contain primarykey name like this:

const configs = {
    // "online_exam.difficulty" = resource name with schema name (default schema name is public) / If you don't provide primaryKey for a resource in this configs array `id` use for that resource as a default primary key.

    "online_exam.difficulty": {
        primaryKey: "title",
        // other customization can be add here in future
    },
    "online_exam.question_mode":{
        primaryKey: "title"
    }
};

const dataProvider = hasuraDataProvider('http://localhost:12003', headers, configs);

Affected components

  • Community Content

Related Issues

Solution and Design

Steps to test and verify

Limitations, known bugs & workarounds

@mnlbox mnlbox requested a review from shahidhk as a code owner May 7, 2019 06:36
@hasura-bot
Copy link
Contributor

Beep boop! 🤖

Hey @mnlbox, thanks for your PR!

One of my human friends will review this PR and get back to you as soon as possible. 🕐

Stay awesome! 😎

@netlify
Copy link

netlify bot commented May 7, 2019

Deploy preview for hasura-docs ready!

Built with commit 3931e49

https://deploy-preview-2133--hasura-docs.netlify.com

@mnlbox
Copy link
Contributor Author

mnlbox commented May 7, 2019

Guys now order by is buggy with custom primary key. Please help me to fix this 😉

@mnlbox
Copy link
Contributor Author

mnlbox commented May 9, 2019

We also need support composite primary keys, something like this:

const configs = {
    // "online_exam.difficulty" = resource name with schema name (default schema name is public) / If you don't provide primaryKey for a resource in this configs array `id` use for that resource as a default primary key.

    "online_exam.difficulty": {
        primaryKey: ["column1", "column2"],
        // other customization can be add here in future
    },
    "online_exam.question_mode":{
        primaryKey: "title"
    }
};

@mnlbox
Copy link
Contributor Author

mnlbox commented May 15, 2019

Now we have working PR here: #2194
Thanks @praveenweb

@mnlbox mnlbox closed this May 15, 2019
@hasura-bot
Copy link
Contributor

Review app https://hge-ci-pull-2133.herokuapp.com is deleted

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

Successfully merging this pull request may close these issues.

Add a flexible way for customization react-admin data provider (primaryKey, ...)

3 participants