chore: remove redundant register user mutation
This commit is contained in:
@@ -3,7 +3,6 @@ import createUser from './mutations/create-user.ee.js';
|
|||||||
import deleteFlow from './mutations/delete-flow.js';
|
import deleteFlow from './mutations/delete-flow.js';
|
||||||
import duplicateFlow from './mutations/duplicate-flow.js';
|
import duplicateFlow from './mutations/duplicate-flow.js';
|
||||||
import generateAuthUrl from './mutations/generate-auth-url.js';
|
import generateAuthUrl from './mutations/generate-auth-url.js';
|
||||||
import registerUser from './mutations/register-user.ee.js';
|
|
||||||
import resetConnection from './mutations/reset-connection.js';
|
import resetConnection from './mutations/reset-connection.js';
|
||||||
import updateConnection from './mutations/update-connection.js';
|
import updateConnection from './mutations/update-connection.js';
|
||||||
import updateFlowStatus from './mutations/update-flow-status.js';
|
import updateFlowStatus from './mutations/update-flow-status.js';
|
||||||
@@ -28,7 +27,6 @@ const mutationResolvers = {
|
|||||||
duplicateFlow,
|
duplicateFlow,
|
||||||
executeFlow,
|
executeFlow,
|
||||||
generateAuthUrl,
|
generateAuthUrl,
|
||||||
registerUser,
|
|
||||||
resetConnection,
|
resetConnection,
|
||||||
updateConnection,
|
updateConnection,
|
||||||
updateCurrentUser,
|
updateCurrentUser,
|
||||||
|
@@ -1,30 +0,0 @@
|
|||||||
import appConfig from '../../config/app.js';
|
|
||||||
import User from '../../models/user.js';
|
|
||||||
import Role from '../../models/role.js';
|
|
||||||
|
|
||||||
const registerUser = async (_parent, params) => {
|
|
||||||
if (!appConfig.isCloud) return;
|
|
||||||
|
|
||||||
const { fullName, email, password } = params.input;
|
|
||||||
|
|
||||||
const existingUser = await User.query().findOne({
|
|
||||||
email: email.toLowerCase(),
|
|
||||||
});
|
|
||||||
|
|
||||||
if (existingUser) {
|
|
||||||
throw new Error('User already exists!');
|
|
||||||
}
|
|
||||||
|
|
||||||
const role = await Role.query().findOne({ name: 'User' });
|
|
||||||
|
|
||||||
const user = await User.query().insert({
|
|
||||||
fullName,
|
|
||||||
email,
|
|
||||||
password,
|
|
||||||
roleId: role.id,
|
|
||||||
});
|
|
||||||
|
|
||||||
return user;
|
|
||||||
};
|
|
||||||
|
|
||||||
export default registerUser;
|
|
@@ -11,7 +11,6 @@ type Mutation {
|
|||||||
duplicateFlow(input: DuplicateFlowInput): Flow
|
duplicateFlow(input: DuplicateFlowInput): Flow
|
||||||
executeFlow(input: ExecuteFlowInput): executeFlowType
|
executeFlow(input: ExecuteFlowInput): executeFlowType
|
||||||
generateAuthUrl(input: GenerateAuthUrlInput): AuthLink
|
generateAuthUrl(input: GenerateAuthUrlInput): AuthLink
|
||||||
registerUser(input: RegisterUserInput): User
|
|
||||||
resetConnection(input: ResetConnectionInput): Connection
|
resetConnection(input: ResetConnectionInput): Connection
|
||||||
updateConnection(input: UpdateConnectionInput): Connection
|
updateConnection(input: UpdateConnectionInput): Connection
|
||||||
updateCurrentUser(input: UpdateCurrentUserInput): User
|
updateCurrentUser(input: UpdateCurrentUserInput): User
|
||||||
@@ -296,12 +295,6 @@ input UpdateUserInput {
|
|||||||
role: UserRoleInput
|
role: UserRoleInput
|
||||||
}
|
}
|
||||||
|
|
||||||
input RegisterUserInput {
|
|
||||||
fullName: String!
|
|
||||||
email: String!
|
|
||||||
password: String!
|
|
||||||
}
|
|
||||||
|
|
||||||
input UpdateCurrentUserInput {
|
input UpdateCurrentUserInput {
|
||||||
email: String
|
email: String
|
||||||
password: String
|
password: String
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { allow, rule, shield } from 'graphql-shield';
|
import { rule, shield } from 'graphql-shield';
|
||||||
import User from '../models/user.js';
|
import User from '../models/user.js';
|
||||||
import AccessToken from '../models/access-token.js';
|
import AccessToken from '../models/access-token.js';
|
||||||
|
|
||||||
@@ -53,7 +53,6 @@ const isAuthenticatedRule = rule()(isAuthenticated);
|
|||||||
export const authenticationRules = {
|
export const authenticationRules = {
|
||||||
Mutation: {
|
Mutation: {
|
||||||
'*': isAuthenticatedRule,
|
'*': isAuthenticatedRule,
|
||||||
registerUser: allow,
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -1,10 +0,0 @@
|
|||||||
import { gql } from '@apollo/client';
|
|
||||||
export const REGISTER_USER = gql`
|
|
||||||
mutation RegisterUser($input: RegisterUserInput) {
|
|
||||||
registerUser(input: $input) {
|
|
||||||
id
|
|
||||||
email
|
|
||||||
fullName
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`;
|
|
Reference in New Issue
Block a user