Skip to content

Latest commit

 

History

History

exercise2

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

Exercise 2

Fix the urls.py: exercise2.schema.schema

Problem

At the moment we can't query anything related (e.g. members, guests, products) on the SocialClubType

TODO

Questions

@strawberry.field
random_names(self, info: Info) -> <???>:
    return None if True else ["Peter", "Paul", "Amy"]

@strawberry.field    
number(self, info: Info) -> <???>:
    return None if True else 1

Find the matching return Type

Sample

Query:

{
  socialClubs {
    id
    name
    members {
      id
      firstName
      lastName
    }
    guests {
      id
      firstName
      lastName
    }
    products {
      id
      name
    }
  }
}

Result:

{
  "data": {
    "socialClubs": [
      {
        "id": "1",
        "name": "Social Club No. 0",
        "members": [
          {
            "id": "2",
            "firstName": "Mathias",
            "lastName": "Hansen"
          },
          ...
        ],
        "guests": [
          {
            "id": "17",
            "firstName": "Vilja",
            "lastName": "Bakkan"
          },
          ...
        ],
        "products": [
          {
            "id": "2",
            "name": "Eagle Poisonberry"
          },
          ...
        ],
      }
    ]
  }
}