paljs / prisma-tools

Prisma tools to help you generate CRUD system for GraphQL servers
https://paljs.com
MIT License
680 stars 55 forks source link

prisma-table: adding custom fields on 1 to n and n to m relations. #265

Closed mohammed-bahumaish closed 2 years ago

mohammed-bahumaish commented 2 years ago

hello everyone, in my use case i needed to to render a custom cell on the table on a field that have one to many relation, but all that's been queried is the id from the other table on the relation. I'm sure many will need the same feature in order to custom render relation cell instead of directing the user into a new table page.

I'm ready to make the pull request. but before that i need to know what you think about it, and what is the best approach.

my idea is to pass field type and extra fields into the prisma table then those fields will be used in getFields function.

let me know what you think. thanks!

mohammed-bahumaish commented 2 years ago

OK, I've just read that in the code, and fieldModel.displayFields.forEach(...) in getFields does the job.