YetAnotherToDoList/graph/schema.graphqls

120 lines
2.3 KiB
GraphQL
Raw Normal View History

2023-08-19 23:47:36 +02:00
# 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!
2023-08-19 23:47:36 +02:00
}
type User {
id: ID!
userName: String!
fullName: String
todos: [Todo!]!
roles: [Role!]!
}
type Role {
id: ID!
roleName: String!
isAdmin: Boolean!
isUserCreator: Boolean!
}
type RefreshToken {
id: ID!
expiryDate: Int!
tokenName: String
selector: String
token: String
userId: String!
2023-08-19 23:47:36 +02:00
}
type Query {
todos: [Todo!]!
users: [User!]!
roles: [Role!]!
refreshTokens: [RefreshToken!]!
user(id: ID!): User!
todo(id: ID!): Todo!
role(id: ID!): Role!
refreshToken(id: ID!): RefreshToken!
}
input NewUser {
userName: String!
fullName: String
password: String!
2023-08-19 23:47:36 +02:00
}
input NewTodo {
text: String!
userId: ID!
}
input NewRole {
roleName: String!
isAdmin: Boolean!
isUserCreator: Boolean!
}
input NewRefreshToken {
tokenName: String
}
input UpdateTodo {
text: String
done: Boolean
}
input UpdateUser {
userName: String
fullName: String
password: String
}
input UpdateRole {
roleName: String
isAdmin: Boolean
isUserCreator: Boolean
}
input UpdateRefreshToken {
tokenName: String
2023-08-19 23:47:36 +02:00
}
type Mutation {
createUser(input: NewUser!): User!
createTodo(input: NewTodo!): Todo!
createRole(input: NewRole!): Role!
createRefreshToken(input: NewRefreshToken!): RefreshToken!
updateTodo(id: ID!, changes: UpdateTodo!): Todo!
updateUser(id: ID!, changes: UpdateUser!): User!
updateRole(id: ID!, changes: UpdateRole!): Role!
updateRefreshToken(id: ID!, changes: UpdateRefreshToken!): RefreshToken!
deleteUser(id: ID!): ID
deleteTodo(id: ID!): ID
deleteRole(id: ID!): ID
deleteRefreshToken(id: ID!): ID
addRole(userId: ID!, roleId: ID!): [Role!]!
removeRole(userId: ID!, roleId: ID!): [Role!]!
2023-08-19 23:47:36 +02:00
}