panter / ra-data-prisma

Packages to connect react-admin with prisma version 2
MIT License
84 stars 28 forks source link

Idea: rework resource dependent options #128

Open macrozone opened 1 year ago

macrozone commented 1 year ago

options grew organically and currenlty contain (among others):

all those options kindof are related to a specific resource, so we could consider to rework those into something like this:


type Options = {

  resources: ResourceOptions

...

}

type ResourceOptions = Record<string, ResourceOption> // whereas key is the resourceName

type ResourceOption = {
   backendResource?: string // defaults to the key. This can be altered for "virtual" resources
  fragments: { // to alter what data is fetched, 
     one: ...,
     many: ... 
  },
  customizeInputData: {
     create: ...,
     update: ...
  },
filters: ...
}

so basically group the options. That will make it a bit easier to think about further improvements and customizations and is more logical

macrozone commented 1 year ago

@knapeto What do you think?

knapeto commented 1 year ago

I like it! I've never used customization for input data but make sense to me. Thanks for briefing @macrozone

macrozone commented 1 year ago

I like it! I've never used customization for input data but make sense to me. Thanks for briefing @macrozone

i actually just used it as a workaround (i was not even aware that we have it), i'll write this in a new ticket, since you might also stumbled across this https://github.com/panter/ra-data-prisma/issues/129