Skip to content
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

In GraphQL how to set WriteOnce functionality in specific property in the collection schema #3956

Closed
sau3078 opened this issue Aug 21, 2023 · 1 comment

Comments

@sau3078
Copy link

sau3078 commented Aug 21, 2023

Lets say I have one json file of any entity say test.json.

{
"name": "TestLoan",
"bsonType": "object",
"graphQLTypeName": "TestLoan",
"properties": {
"_id": {
"bsonType": "objectId"
},
"loanId": {
"bsonType": "int"
}
}
}

Let say I have loanId property inside my TestLoan entity and I am creating graphql schema from this json in my springboot graphql application.

I have mutation classes to update this TestLoan entity like TestLoanMutation to update single records and TestLoabManyMutation to update multiple records.

I have requirement if my loanId is null intially then I should be able to update it with any other non null value. If at any time loanId value is set then we can't update it to null or any other non null value means write once.

How its possible to do in Graphql ?

@yaacovCR
Copy link
Contributor

It seems like something you would handle within your resolver code rather than within the type system. Unless you wanted to introduce two different types that each satisfy and interface, with one type also having a loan. I’m going to close this issue for now as it seems to be a general graphql question rather than related to the reference implementation within this repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants