-
Notifications
You must be signed in to change notification settings - Fork 252
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
Relation cannot be saved by model, only by ID #1451
Comments
Hi @WalterWoshid - Can you share your schema? Or at least a subset that includes the user/wallet models. Thanks. |
here you go: backend/api/app/schema.graphql: type Wallet @model @auth(rules: [{allow: private}]) {
id: ID!
data: String
}
type User @model @auth(rules: [{allow: owner}, {allow: public, operations: [create, read, update]}, {allow: groups, groups: ["admin"], operations: [read, create, update, delete]}]) {
id: ID!
Veriff: VeriffModel @hasOne
} #current-cloud-backend/api/app/build/schema.graphql type Wallet @aws_iam @aws_cognito_user_pools {
id: ID!
data: String
createdAt: AWSDateTime!
updatedAt: AWSDateTime!
_version: Int!
_deleted: Boolean
_lastChangedAt: AWSTimestamp!
}
type User @aws_api_key @aws_iam @aws_cognito_user_pools {
id: ID!
Wallet: Wallet
createdAt: AWSDateTime!
updatedAt: AWSDateTime!
_version: Int!
_deleted: Boolean
_lastChangedAt: AWSTimestamp!
userWalletId: ID
} |
In backend/api/app/schema.graphql does |
FWIW, this is a limitation for hasOne relationship cross Amplify libraries, that when associate the model for hasOne relationship, would need to assign the connection ID filed directly (what shown in your first code sample). I think this limitation will be removed along with the initiative of #1449 - better experience on cascade save and delete. |
@Jordan-Nelson It does not seem like it. The only @HuiSF Looking forward for the new update :) |
amplify-ios team is looking into a solution as well - aws-amplify/amplify-swift#1676 |
This is a known feature gap between model relationship support, which will be resolved with #1449. |
Description
Trying to save a model with a relationship only works when saving by ID like this
Expected behaviour, like in the docs:
No error is returned, it just doesn't save the relation
Categories
Steps to Reproduce
No response
Screenshots
No response
Platforms
Environment
Dependencies
Device
Pixel 4 API 31
OS
Android 12.0
CLI Version
7.6.23
Additional Context
No response
The text was updated successfully, but these errors were encountered: