feat: refactor delete user mutation with the REST API endpoint
This commit is contained in:

committed by
Faruk AYDIN

parent
0e26032ac3
commit
1aa1f441b3
@@ -29,9 +29,6 @@ import upsertSamlAuthProvider from './mutations/upsert-saml-auth-provider.ee.js'
|
||||
import upsertSamlAuthProvidersRoleMappings from './mutations/upsert-saml-auth-providers-role-mappings.ee.js';
|
||||
import verifyConnection from './mutations/verify-connection.js';
|
||||
|
||||
// Converted mutations
|
||||
import deleteUser from './mutations/delete-user.ee.js';
|
||||
|
||||
const mutationResolvers = {
|
||||
createAppAuthClient,
|
||||
createAppConfig,
|
||||
@@ -45,7 +42,6 @@ const mutationResolvers = {
|
||||
deleteFlow,
|
||||
deleteRole,
|
||||
deleteStep,
|
||||
deleteUser,
|
||||
duplicateFlow,
|
||||
executeFlow,
|
||||
generateAuthUrl,
|
||||
|
@@ -1,24 +0,0 @@
|
||||
import { Duration } from 'luxon';
|
||||
import User from '../../models/user.js';
|
||||
import deleteUserQueue from '../../queues/delete-user.ee.js';
|
||||
|
||||
const deleteUser = async (_parent, params, context) => {
|
||||
context.currentUser.can('delete', 'User');
|
||||
|
||||
const id = params.input.id;
|
||||
|
||||
await User.query().deleteById(id);
|
||||
|
||||
const jobName = `Delete user - ${id}`;
|
||||
const jobPayload = { id };
|
||||
const millisecondsFor30Days = Duration.fromObject({ days: 30 }).toMillis();
|
||||
const jobOptions = {
|
||||
delay: millisecondsFor30Days,
|
||||
};
|
||||
|
||||
await deleteUserQueue.add(jobName, jobPayload, jobOptions);
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
export default deleteUser;
|
@@ -14,7 +14,6 @@ type Mutation {
|
||||
deleteFlow(input: DeleteFlowInput): Boolean
|
||||
deleteRole(input: DeleteRoleInput): Boolean
|
||||
deleteStep(input: DeleteStepInput): Step
|
||||
deleteUser(input: DeleteUserInput): Boolean
|
||||
duplicateFlow(input: DuplicateFlowInput): Flow
|
||||
executeFlow(input: ExecuteFlowInput): executeFlowType
|
||||
generateAuthUrl(input: GenerateAuthUrlInput): AuthLink
|
||||
@@ -381,10 +380,6 @@ input UpdateUserInput {
|
||||
role: UserRoleInput
|
||||
}
|
||||
|
||||
input DeleteUserInput {
|
||||
id: String!
|
||||
}
|
||||
|
||||
input RegisterUserInput {
|
||||
fullName: String!
|
||||
email: String!
|
||||
|
Reference in New Issue
Block a user