-
Notifications
You must be signed in to change notification settings - Fork 5
05. Example GraphQL Queries
Chris Nurse edited this page Nov 24, 2022
·
8 revisions
Once the Crudio demo environment is running in Docker, browse to Hasura Console (or whatever port you have used), to see the new database through Hasura GraphQL.
Go to the API
tab, and copy, paste and run the following GraphQL queries and you will see that Crudio has built a complete database filled with great looking data:
IMPORTANT NOTE:
When you run the initialisation script, the database schema will be crudio
, so the example queries below will work as is. But if you run the unit tests, the schema will be crudio_test
, so you will have to prefix the tables like so... crudio_test_Blogs
instead of crudio_Blogs
{
crudio_Blogs {
article
BlogTags {
Tag {
name
}
}
}
}
Get a list of Employees with their organisations and prove their email addresses match the organisation they work for
{
crudio_Employees{
firstname
lastname
email
Organisation {
name
}
}
}
{
crudio_Users {
firstname
lastname
email
}
}
{
CEO: crudio_Employees(where: {EmployeeOrganisationRoles: {OrganisationRole: {name: {_eq: "CEO"}}}}) {
firstname
lastname
email
Organisation {
name
}
EmployeeOrganisationRoles{
OrganisationRole {
name
}
}
}
CFO: crudio_Employees(where: {EmployeeOrganisationRoles: {OrganisationRole: {name: {_eq: "CFO"}}}}) {
firstname
lastname
email
Organisation {
name
}
EmployeeOrganisationRoles{
OrganisationRole {
name
}
}
}
}