This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
backend/internal/graphql/schema/user.graphql

94 lines
1.6 KiB
GraphQL

enum Role {
Admin
User
}
type User {
id: ID!
displayName: String!
role: Role!
email: String!
activated: Boolean!
createdAt: Time!
}
type UserList {
total: Int!
items: [User!]
}
input UserInput {
displayName: String
password: String
email: String
role: Role
activated: Boolean
}
input UpdateManyUsersInput {
role: Role
activated: Boolean
}
input UserFilter {
id: [ID!]
idNEQ: [ID!]
activated: Boolean
displayName: [String!]
displayNameNEQ: [String!]
displayNameIEQ: String
displayNameMATCH: String
email: [String!]
emailNEQ: [String!]
emailIEQ: String
emailMATCH: String
role: [Role!]
roleNEQ: [Role!]
createdAt: Time
createdAtGT: Time
createdAtGTE: Time
createdAtLT: Time
createdAtLTE: Time
}
type UserWithToken {
token: String!
user: User!
}
extend type Query {
users(
filter: UserFilter
limit: Int
offset: Int
sort: [String!]
): UserList! @authenticated(yes: true) @hasRole(role: Admin)
user(id: Int!): User @authenticated(yes: true) @hasRole(role: Admin)
me: User
}
extend type Mutation {
createUser(input: UserInput!): User
@authenticated(yes: true)
@hasRole(role: Admin)
updateUser(id: ID!, input: UserInput!): User
@authenticated(yes: true)
@hasRole(role: Admin)
updateManyUsers(ids: [ID!]!, input: UpdateManyUsersInput!): [User!]
@authenticated(yes: true)
@hasRole(role: Admin)
deleteUsers(ids: [ID!]!): [User!]
@authenticated(yes: true)
@hasRole(role: Admin)
signIn(
email: String!
password: String!
staySignedIn: Boolean
): UserWithToken @authenticated(yes: false)
}