Basic info
: using Postgres in the backend and GraphQL in the front end using Postgraphile.
Need
: Use a GraphQL mutation to update a row in the Postgres DB.
Code
:
Suppose I have a library_account schema which has book table in Postgres which has fields like id, title, borrower_id and is_available.
Scenario
: It is getting borrowed for the very first time.
Proposed flow
: make a GraphQL mutation to update the Postgres table with the borrower_id.
Code I am currently using:
mutation BookUpdates(
$title: String,
$borrower_id: Int!, #not really an Int but for the sake of ease.
$author_id: Int!,
$isle_id: Int!,
$is_available: Boolean
) {
updateBookByAuthorIdAndIsleId(input: {
isle_id: $isle_id,
is_available: $is_available,
borrower_id: $borrower_id,
author_id: $author_id
}) {
bookEdge {
node {
author_id
}
}
}
Here, I am getting an error for borrower_id
which says that borrower_id is not defined by type updateBookByAuthorIdAndIsleId
.
Any suggestions??