Cascade with variable Or nested Filter

As this is a simplified test example I have no real scheme at hand, but I constructed one for you. It would probably look like this:

type Student {
    id: String! @id
    age: DateTime @search
    firstName: String! @search(by: [term])
    classes: [Class!] @hasInverse(field: students)
}

type Class {
    id: String! @id
    description: String! @search(by: [term])
    students: [Student!]!
    room: Room!
}

type Room {
    id: String! @id
    name: String! @search(by: [term])
    classes: [Class!] @hasInverse(field: room)
}

for the dataset you could populate it with this query

mutation addData($input: [AddStudentInput!]!) {
  addStudent(input: $input) {
    student {
      id
      age
      firstName
      classes {
        id
        description
        room {
          id
          name
        }
      }
    }
  }
}
and these variables
  "input": [
    {
    "id": "student1",
    "firstName": "John",
    "classes": [
      {
        "id": "class1", 
        "description": "Math",
        "room":  {
          "id": "room1", 
          "name": "501"
        }
      },{
        "id": "class2", 
        "description": "English",
        "room":  {
          "id": "room2", 
          "name": "502"
        }
      }
    ]
    },
    {
    "id": "student2",
    "firstName": "Tim",
    "classes": [
      {
        "id": "class1", 
        "description": "Math",
        "room":  {
          "id": "room1", 
          "name": "501"
        }
      }
    ]
    },{
    "id": "student3",
    "firstName": "Simon",
    "classes": []
  }
  ]
}
1 Like