chore: remove redundant register user mutation

This commit is contained in:
Ali BARIN
2024-09-11 13:08:53 +00:00
committed by Faruk AYDIN
parent ba0d46c6cd
commit ddc9867058
5 changed files with 1 additions and 51 deletions

View File

@@ -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;