WIP
This commit is contained in:
75
bbconf/todo_schema.graphql
Normal file
75
bbconf/todo_schema.graphql
Normal file
@ -0,0 +1,75 @@
|
||||
directive @bb_primaryKey on FIELD_DEFINITION
|
||||
directive @bb_resolver on FIELD_DEFINITION
|
||||
|
||||
type List {
|
||||
id: ID!
|
||||
title: String!
|
||||
tasks: [Task]
|
||||
user: User!
|
||||
}
|
||||
|
||||
"""
|
||||
Task or todo item.
|
||||
"""
|
||||
type Task {
|
||||
id: ID!
|
||||
title: String!
|
||||
description: String,
|
||||
completed: Boolean!
|
||||
user: User!
|
||||
list: List!
|
||||
}
|
||||
|
||||
"""
|
||||
User type; owner of lists and tasks
|
||||
"""
|
||||
type User {
|
||||
username: String! @bb_primaryKey
|
||||
name: String
|
||||
tasks: [Task]
|
||||
lists: [List]
|
||||
}
|
||||
|
||||
|
||||
type Query {
|
||||
|
||||
"""
|
||||
Get a user, this will be used to get the current user as well as the user's lists and tasks.
|
||||
"""
|
||||
getUser(
|
||||
username: String!
|
||||
): User @bb_resolver(_type: select, _object: User, _filter: { username: { _eq: "$username" } })
|
||||
|
||||
}
|
||||
|
||||
type Mutation {
|
||||
|
||||
createUser(
|
||||
username: String!,
|
||||
name: String!
|
||||
): User @bb_resolver(_type: insert, _object: User, _fields: { username: "$username", name: "$name" })
|
||||
|
||||
createList(
|
||||
title: String!
|
||||
user: User! # username needs to be specified as it's non-nullable
|
||||
): List @bb_resolver(_type: insert, _object: List, _fields: { title: "$title", user: "$user" })
|
||||
|
||||
createTask(
|
||||
title: String!,
|
||||
description: String,
|
||||
completed: Boolean!, # default not implemented yet, this needs to be added as it's non-nullable
|
||||
list: List! # list needs to be specified as it's non-nullable
|
||||
user: User! # username needs to be specified as it's non-nullable
|
||||
): Task @bb_resolver(_type: insert, _object: Task, _fields: { title: "$title", description: "$description", completed: "$completed", list: "$list", user: "$user" })
|
||||
|
||||
updateTask(
|
||||
id: ID!,
|
||||
title: String,
|
||||
description: String,
|
||||
completed: Boolean,
|
||||
list: List
|
||||
): Task @bb_resolver(_type: update, _object: Task, _filter: { id: { _eq: "$id" } }, _fields: { title: "$title", description: "$description", completed: "$completed", list: "$list" })
|
||||
|
||||
deleteTask(id: ID!): Task @bb_resolver(_type: delete, _object: Task, _filter: { id: { _eq: "$id" } })
|
||||
|
||||
}
|
Reference in New Issue
Block a user