Amit Kumar
Amit Kumar

Reputation: 169

How can I have custom identifiers/primary keys for my resources?

My table has a primary key other than id and react-admin enforces id to be returned in the response by the DataProvider. So can I configure different primary keys/identifiers for my resources?

I am using this library - https://github.com/Steams/ra-data-hasura-graphql

Right now I have made few changes in my library code to make this work, but I need an idea to implement it, so anyone using this library doesn't need to go thru whole code to make it work.

const config = { 
  'primaryKey': { 
      'tableName': 'primaryKey1', 'tableName2': 'primaryKey2' 
  } 
};

I was thinking of something like passing configuration like this.

Thanks.

Upvotes: 2

Views: 476

Answers (1)

lashdown
lashdown

Reputation: 11

I don't believe it is currently possible with the 0.1.0 release. However in hasura you can expose the column with a different name

hasura column exposed name

Upvotes: 1

Related Questions