103 lines
1.9 KiB
GraphQL
103 lines
1.9 KiB
GraphQL
# ===============================================
|
|
# USERS
|
|
# ===============================================
|
|
|
|
extend type Query {
|
|
users: UserQuery
|
|
}
|
|
|
|
extend type Mutation {
|
|
users: UserMutation
|
|
}
|
|
|
|
# -----------------------------------------------
|
|
# QUERIES
|
|
# -----------------------------------------------
|
|
|
|
type UserQuery {
|
|
list(
|
|
filter: String
|
|
orderBy: String
|
|
): [UserMinimal] @auth(requires: ["write:users", "manage:users", "manage:system"])
|
|
|
|
search(
|
|
query: String!
|
|
): [UserMinimal] @auth(requires: ["write:groups", "manage:groups", "write:users", "manage:users", "manage:system"])
|
|
|
|
single(
|
|
id: Int!
|
|
): User @auth(requires: ["manage:users", "manage:system"])
|
|
}
|
|
|
|
# -----------------------------------------------
|
|
# MUTATIONS
|
|
# -----------------------------------------------
|
|
|
|
type UserMutation {
|
|
create(
|
|
email: String!
|
|
name: String
|
|
passwordRaw: String
|
|
provider: String!
|
|
providerId: String
|
|
role: UserRole!
|
|
): UserResponse @auth(requires: ["write:users", "manage:users", "manage:system"])
|
|
|
|
update(
|
|
id: Int!
|
|
email: String
|
|
name: String
|
|
provider: String
|
|
providerId: String
|
|
role: UserRole
|
|
): UserResponse @auth(requires: ["manage:users", "manage:system"])
|
|
|
|
delete(
|
|
id: Int!
|
|
): DefaultResponse @auth(requires: ["manage:users", "manage:system"])
|
|
|
|
resetPassword(
|
|
id: Int!
|
|
): DefaultResponse
|
|
|
|
setPassword(
|
|
id: Int!
|
|
passwordRaw: String!
|
|
): DefaultResponse
|
|
}
|
|
|
|
# -----------------------------------------------
|
|
# TYPES
|
|
# -----------------------------------------------
|
|
|
|
enum UserRole {
|
|
guest
|
|
user
|
|
admin
|
|
}
|
|
|
|
type UserResponse {
|
|
responseResult: ResponseStatus!
|
|
user: User
|
|
}
|
|
|
|
type UserMinimal {
|
|
id: Int!
|
|
name: String!
|
|
email: String!
|
|
providerKey: String!
|
|
createdAt: Date!
|
|
}
|
|
|
|
type User {
|
|
id: Int!
|
|
name: String!
|
|
email: String!
|
|
providerKey: String!
|
|
providerId: String
|
|
role: UserRole!
|
|
createdAt: Date!
|
|
updatedAt: Date!
|
|
groups: [Group]
|
|
}
|