Last active
September 23, 2020 15:07
-
-
Save MuddyBootsCode/b8b30f8bff384966e6b95b34a8065139 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
directive @subscribe on FIELD_DEFINITION | |
directive @publish(to: String!) on FIELD_DEFINITION | OBJECT | |
type User @isAuthenticated { | |
id: ID! | |
firstName: String! | |
lastName: String! | |
} | |
// The subscription created for the auto generated | |
type Task @publish(to: "autotaskAdded"){ | |
id: ID! | |
content: String! | |
column: Column @relation(name: "BELONGS_TO", direction: "OUT") | |
columnName: String @cypher ( | |
statement: "MATCH (this)-[:BELONGS_TO]->(c:Column) return c.title" | |
) | |
} | |
type Column { | |
id: ID! | |
title: String! | |
tasks: [Task] @relation(name: "BELONGS_TO", direction: "IN") | |
table: Table @relation(name: "BELONGS_TO", direction: "OUT") | |
taskIds: [ID] | |
} | |
type Table { | |
id: ID! | |
title: String! | |
columns: [Column] @relation(name: "BELONGS_TO", direction: "IN") | |
columnOrder: [ID] | |
} | |
type Subscription { | |
taskAdded: Task @subscribe | |
autoTaskAdded: Task @subscribe | |
} | |
type Mutation { | |
addTask(taskContent: String!, columnId: ID!): Task @publish(to: "taskAdded") | |
@cypher ( | |
statement: "CREATE (t:Task { id: randomUUID(), content: $taskContent }) with t MATCH(c:Column {id: $columnId}) CREATE(c)<-[:BELONGS_TO]-(t) set c.taskIds = c.taskIds + t.id return t" | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment