skinny-azureS
Refineβ€’3y agoβ€’
38 replies
skinny-azure

Composite Primary Keys recommendations

Hey Refine-Team, hello Discord!
Thank you for refine, it's a really good solution and has provided a lot of "wow" effects for the people I work with over the last couple of weeks.

We are building a CRUD-UI using Refine for some pretty large databases, spanning 9 dbs over multiple hundred tables. We have a specification that is asking for composite-primary-key (CPK) access. Meaning I have an API that is offering access to a resource like this /post/:id/:locale_id/:provider_id. All keys must be provided for the CPK to access the correct resource.

I found the BaseRecord and BaseKey interface I'd probably override?
export type BaseKey = string | number;
export type BaseRecord = {
    id?: BaseKey;
    // eslint-disable-next-line @typescript-eslint/no-explicit-any
    [key: string]: any;
};


I guess I will have to write another dataProvider with extended functionality for this.
Maybe someone has done something similar already, any help or hint is appreciated!
Was this page helpful?