YetAnotherToDoList/graph/schema.graphqls

69 lines
1.4 KiB
GraphQL

# YetAnotherToDoList
# Copyright © 2023 gilex-dev gilex-dev@proton.me
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# GraphQL schema example
#
# https://gqlgen.com/getting-started/
type Todo {
id: ID!
text: String!
done: Boolean!
user: User!
}
type User {
id: ID!
userName: String!
fullName: String!
todos: [Todo!]!
}
type Query {
todos: [Todo!]!
users: [User!]!
user(id: ID!): User!
todo(id: ID!): Todo!
}
input NewUser {
userName: String!
fullName: String!
}
input NewTodo {
text: String!
userId: ID!
}
input updateTodo {
text: String
done: Boolean
}
input updateUser {
userName: String
fullName: String
}
type Mutation {
createUser(input: NewUser!): User!
createTodo(input: NewTodo!): Todo!
updateTodo(id: ID!, changes: updateTodo!): Todo!
updateUser(id: ID!, changes: updateUser!): User!
deleteUser(id: ID!): ID
deleteTodo(id: ID!): ID
}