I'm implementing a graphql prisma datamodel. Here I have a type called BankAccount
. I may need to update and delete them as well. I'm implementing this as immutable object. So, when updating I'm adding updating the existing record as IsDeleted and add a new record. And when updating an existing record I need to keep the id of the previous record to know which record is updated. So, I've came up with a type like this
type BankAccount {
id: ID! @unique
parentbankAccount: String!
bankName: String!
bankAccountNo: String!
isDeleted: Boolean! @default(value: "false")
}
Here the parentBankAccount
keeps the id of previous BankAccount
. I'm thinking when creating a bank account, setting the parentBankAccount
as same as the id
as it doesn't have a parent. The thing is I'm not sure it's possible. I'm bit new to GraphQL. So, any help would be appreciated.
Thanks