Add user queries and mutations

This commit is contained in:
WithoutPants 2023-06-03 10:16:22 +10:00
parent 3c2630432c
commit 2a2351fcdc
2 changed files with 41 additions and 1 deletions

View file

@ -269,7 +269,8 @@ type Query {
allStudios: [Studio!]! @deprecated(reason: "Use findStudios instead")
allMovies: [Movie!]! @deprecated(reason: "Use findGroups instead")
# Get everything with minimal metadata
"""Returns currently authenticated user"""
me: User
# Version
version: Version!
@ -588,6 +589,11 @@ type Mutation {
addTempDLNAIP(input: AddTempDLNAIPInput!): Boolean! @hasRole(role: ADMIN)
"Removes an IP address from the temporary DLNA whitelist"
removeTempDLNAIP(input: RemoveTempDLNAIPInput!): Boolean! @hasRole(role: ADMIN)
userCreate(input: UserCreateInput!): User @hasRole(role: ADMIN)
userUpdate(input: UserUpdateInput!): User @hasRole(role: ADMIN)
userDestroy(input: UserDestroyInput!): Boolean! @hasRole(role: ADMIN)
changePassword(input: UserChangePasswordInput!): Boolean!
}
type Subscription {

View file

@ -5,3 +5,37 @@ enum RoleEnum {
}
directive @hasRole(role: RoleEnum!) on FIELD_DEFINITION
directive @isUserOwner on FIELD_DEFINITION
type User {
name: String!
"""Should not be visible to other users"""
roles: [RoleEnum!] @isUserOwner
"""Should not be visible to other users"""
api_key: String @isUserOwner
}
input UserCreateInput {
name: String!
"""Password in plain text"""
password: String!
roles: [RoleEnum!]!
}
input UserUpdateInput {
name: String
"""Password in plain text"""
password: String
roles: [RoleEnum!]
}
input UserDestroyInput {
id: ID!
}
input UserChangePasswordInput {
"""Password in plain text"""
existing_password: String
new_password: String!
reset_key: String
}