chore: remove redundant update user mutation
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
// Converted mutations
|
||||
import executeFlow from './mutations/execute-flow.js';
|
||||
import updateUser from './mutations/update-user.ee.js';
|
||||
import verifyConnection from './mutations/verify-connection.js';
|
||||
import updateCurrentUser from './mutations/update-current-user.js';
|
||||
import generateAuthUrl from './mutations/generate-auth-url.js';
|
||||
@@ -15,7 +14,6 @@ const mutationResolvers = {
|
||||
resetConnection,
|
||||
updateConnection,
|
||||
updateCurrentUser,
|
||||
updateUser,
|
||||
verifyConnection,
|
||||
};
|
||||
|
||||
|
@@ -1,27 +0,0 @@
|
||||
import User from '../../models/user.js';
|
||||
|
||||
const updateUser = async (_parent, params, context) => {
|
||||
context.currentUser.can('update', 'User');
|
||||
|
||||
const userPayload = {
|
||||
email: params.input.email,
|
||||
fullName: params.input.fullName,
|
||||
};
|
||||
|
||||
try {
|
||||
context.currentUser.can('update', 'Role');
|
||||
|
||||
userPayload.roleId = params.input.role.id;
|
||||
} catch {
|
||||
// void
|
||||
}
|
||||
|
||||
const user = await User.query().patchAndFetchById(
|
||||
params.input.id,
|
||||
userPayload
|
||||
);
|
||||
|
||||
return user;
|
||||
};
|
||||
|
||||
export default updateUser;
|
@@ -8,7 +8,6 @@ type Mutation {
|
||||
resetConnection(input: ResetConnectionInput): Connection
|
||||
updateConnection(input: UpdateConnectionInput): Connection
|
||||
updateCurrentUser(input: UpdateCurrentUserInput): User
|
||||
updateUser(input: UpdateUserInput): User
|
||||
verifyConnection(input: VerifyConnectionInput): Connection
|
||||
}
|
||||
|
||||
@@ -241,13 +240,6 @@ input UserRoleInput {
|
||||
id: String
|
||||
}
|
||||
|
||||
input UpdateUserInput {
|
||||
id: String!
|
||||
fullName: String
|
||||
email: String
|
||||
role: UserRoleInput
|
||||
}
|
||||
|
||||
input UpdateCurrentUserInput {
|
||||
email: String
|
||||
password: String
|
||||
|
@@ -1,10 +0,0 @@
|
||||
import { gql } from '@apollo/client';
|
||||
export const UPDATE_USER = gql`
|
||||
mutation UpdateUser($input: UpdateUserInput) {
|
||||
updateUser(input: $input) {
|
||||
id
|
||||
email
|
||||
fullName
|
||||
}
|
||||
}
|
||||
`;
|
Reference in New Issue
Block a user