140 lines
2.7 KiB
GraphQL
140 lines
2.7 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!]!
|
|
roles: [RelationUserRole!]!
|
|
}
|
|
|
|
type RelationUserRole {
|
|
role: Role!
|
|
userIsRoleManager: Boolean!
|
|
}
|
|
|
|
type RelationRoleUser {
|
|
user: User!
|
|
userIsRoleManager: Boolean!
|
|
}
|
|
|
|
type Role {
|
|
id: ID!
|
|
roleName: String!
|
|
isAdmin: Boolean!
|
|
isUserCreator: Boolean!
|
|
roleMembers: [RelationRoleUser!]!
|
|
}
|
|
|
|
type RefreshToken {
|
|
id: ID!
|
|
expiryDate: Int!
|
|
tokenName: String
|
|
selector: String
|
|
token: String
|
|
userId: String!
|
|
}
|
|
|
|
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!
|
|
}
|
|
|
|
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
|
|
}
|
|
|
|
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
|
|
addUserRole(
|
|
userId: ID!
|
|
roleId: ID!
|
|
userIsRoleManager: Boolean!
|
|
): [RelationUserRole!]!
|
|
UpdateUserRole(
|
|
userId: ID!
|
|
roleId: ID!
|
|
userIsRoleManager: Boolean!
|
|
): [RelationUserRole!]!
|
|
removeUserRole(userId: ID!, roleId: ID!): [RelationUserRole!]!
|
|
}
|