-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Return All Inserted Rows in Many Create #15
base: master
Are you sure you want to change the base?
Conversation
I've never touched a Postgraphile Plugin, I have no idea what I'm doing. I copied what they did at https://github.com/graphile-contrib/pg-many-to-many/blob/715e84fb3b021e00bbfc20031bd8a3c5e51c4050/src/createManyToManyConnectionType.js#L184 and it seems to work! Not sure what the |
const tableName = inflection.tableFieldName(table); | ||
const tableNamePlural = `${tableName}s` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@benjie This might be of interest? It seems Postgraphile does a lot of "pluralizing", is there a function I can use besides my naive strategy of appending an s
? Thanks!
Also if you look below, does type: new GraphQLList(tableType)
make sense?
Upon first glance, you'll need to integrate with the types I had and update those vs. using "any" types. Using "any" invalidates my effort and all the types I built (some are implied as any, which is ok for now). For the names the inflection plugin/something similar should be used (it uses another hook). The entire plugin needs to use that vs. trying to hardcode the name in (even the |
Ok, my tsconfig must be different, it was complaining about
Ok, if the api is not going to change, I think we'll go forward to using this in production. I mostly would be concerned with GraphQL API having to change, and us having to migrate our frontend code... |
If I'm not mistaken, changing the table names to all have an additional |
Ok, yeah I can see why this is a breaking change. I am unsure of the utility of inserting multiple rows and only being able to query the first row that got inserted... perhaps do a major release of
Are you sure it doesn't line up? Here https://github.com/tjmoses/postgraphile-plugin-batch-create-update-delete/pull/15/files#diff-d98a4086916d405fc31ca771c4284a92ead266cfa14b390fea7c28772ad3354bR160 I return a
Yes, I will probably do this if it doesn't get released by early next week. No big deal! |
You may be able to use the plugin I was referring for directly adding the I would like to hold off on an official v2 until the tests I wrote are integrated in with Circle CI, and additional features like the name changing are added. For the return list I suppose GraphQLList is easy enough, but no I have not tested anything just glanced it over (seems ok, didn't see that earlier). If this is the only change and it works, def could do a v2.0.0-canary.0 version. Only worried that the new return value may break people's code bases since it was one item and is now a list. |
Indeed any time you add a name to the GraphQL schema (type name, field name, argument name, directive name, enum name, etc) that name should come directly from an inflection function; you can read more about inflection here: https://www.graphile.org/postgraphile/inflection/ |
I need this PR |
Hey Tim, this PR seems to work. We'd likely want to add this to Many Update if this approach is correct