vue-todo/bbconf/basebox/schema.graphql

140 lines
2.5 KiB
GraphQL
Raw Normal View History

2023-03-05 15:06:14 +00:00
directive @bb_primaryKey on FIELD_DEFINITION
directive @bb_resolver on FIELD_DEFINITION
directive @bb_owned on OBJECT
directive @bb_user on OBJECT
2023-03-05 15:06:14 +00:00
"""
List of tasks or todo items.
"""
type List @bb_owned {
2023-02-12 10:36:19 +00:00
id: ID!
title: String!
tasks: [Task]
user: User!
}
input ListInput {
id: ID!
}
2023-02-12 10:36:19 +00:00
"""
Task or todo item.
"""
type Task @bb_owned {
2023-02-12 10:36:19 +00:00
id: ID!
title: String!
description: String,
completed: Boolean!
user: User!
list: List!
}
"""
User type; owner of lists and tasks
"""
type User @bb_user {
2023-02-12 10:36:19 +00:00
username: String! @bb_primaryKey
name: String
tasks: [Task]
lists: [List]
}
input UserInput {
username: String!
name: String
}
2023-02-12 10:36:19 +00:00
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" } })
2023-04-04 18:02:06 +00:00
2023-02-12 10:36:19 +00:00
}
type Mutation {
2023-03-07 21:12:06 +00:00
createUser(
username: String!,
name: String!
): User
@bb_resolver(
_type: INSERT,
_object: User,
_fields: { username: "$username", name: "$name" })
2023-03-07 21:12:06 +00:00
2023-02-12 10:36:19 +00:00
createList(
title: String!
user: UserInput!
): List
@bb_resolver(
_type: INSERT,
_object: List,
_fields: {
title: "$title",
user: { username: "$user.$username" }
})
2023-02-12 10:36:19 +00:00
2023-03-17 17:41:43 +00:00
updateList(
id: ID!,
title: String!
): List
@bb_resolver(
_type: UPDATE,
_object: List,
_filter: { id: { _eq: "$id" } },
_fields: { title: "$title" })
2023-03-17 17:41:43 +00:00
deleteList(id: ID!): List
@bb_resolver(_type: DELETE, _object: List, _filter: { id: { _eq: "$id" } })
2023-03-17 17:41:43 +00:00
2023-02-12 10:36:19 +00:00
createTask(
title: String!,
description: String,
completed: Boolean!,
list: ListInput!
user: UserInput!
): Task
@bb_resolver(
_type: INSERT,
_object: Task,
_fields: {
title: "$title",
description: "$description",
completed: "$completed",
list: { id: "$list.$id" },
user: { username: "$user.$username" } })
2023-02-12 10:36:19 +00:00
updateTask(
id: ID!,
title: String,
description: String,
completed: Boolean,
list: ListInput
): Task
@bb_resolver(
_type: UPDATE,
_object: Task,
_filter: { id: { _eq: "$id" } },
_fields: {
title: "$title",
description: "$description",
completed: "$completed",
list: { id: "$list.$id" }
})
deleteTask(id: ID!): Task
@bb_resolver(
_type: DELETE,
_object: Task,
_filter: { id: { _eq: "$id" }})
2023-02-12 10:36:19 +00:00
}