Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ humanType = new gql.GraphQLObjectType({
// https://docs.arangodb.com/Aql/GraphTraversals.html#working-on-collection-sets
const species = args.species || null;
return db._query(aqlQuery`
WITH ${characters}
FOR friend IN ANY ${human} ${friends}
FILTER !${species} || friend.$type == ${species}
SORT friend._key ASC
Expand All @@ -177,6 +178,7 @@ humanType = new gql.GraphQLObjectType({
// appear in a character), so we are only interested
// in OUTBOUND edges.
return db._query(aqlQuery`
WITH ${characters}
FOR episode IN OUTBOUND ${human._id} ${appearsIn}
SORT episode._key ASC
RETURN episode
Expand Down Expand Up @@ -231,6 +233,7 @@ droidType = new gql.GraphQLObjectType({
resolve(droid, args) {
const species = args.species || null;
return db._query(aqlQuery`
WITH ${characters}
FOR friend IN ANY ${droid} ${friends}
FILTER !${species} || friend.$type == ${species}
SORT friend._key ASC
Expand All @@ -243,6 +246,7 @@ droidType = new gql.GraphQLObjectType({
description: 'Which movies they appear in.',
resolve(droid) {
return db._query(aqlQuery`
WITH ${characters}
FOR episode IN OUTBOUND ${droid._id} ${appearsIn}
SORT episode._key ASC
RETURN episode
Expand Down