I have the following mutation:
const CREATE_CANVAS = gql`
mutation CREATE_CANVAS($userId: ID!, $projectId: ID!){
createdCanvas: createCanvas(data: {
id: ""
owner: {
connect: $userId
}
project: {
connect: $projectId
}
}){
...canvasFields
}
}
${canvas.canvasFields}
`;
It creates the following project
:
{
"ref": Ref(Collection("Projects"), "294406582593126919"),
"ts": 1617026846950000,
"data": {
"id": "",
"label": "test",
"owner": Ref(Collection("Users"), "293673586012455429"),
"canvas": Ref(Collection("Canvas"), "294406583103783431")
}
}
And the following canvas:
{
"ref": Ref(Collection("Canvas"), "294406583103783431"),
"ts": 1617026846950000,
"data": {
"id": "",
"owner": Ref(Collection("Users"), "293673586012455429")
}
}
Why doesn’t the canvas
document has a project
field? It only linked half of it, although the project
doc does have the expected project
relation.
Here is my schema:
type Project @collection(
name: "Projects"
){
id: ID!
"""
Name of the project
"""
label: String!
owner: User! @relation(
name: "userProjects"
)
canvas: Canvas @relation(
name: "projectCanvas"
)
}
type Canvas @collection(
name: "Canvas"
){
id: ID!
lastUpdatedBySessionEphemeralId: String
lastUpdatedByUserName: String
project: Project! @relation(
name: "projectCanvas"
)
owner: User! @relation(
name: "userCanvases"
)
}