feat: add signup logic

This commit is contained in:
Rıdvan Akca
2023-03-03 14:04:23 +03:00
parent c1150d50b1
commit 18089a8076
2 changed files with 5 additions and 1 deletions

View File

@@ -4,11 +4,12 @@ type Params = {
input: { input: {
email: string; email: string;
password: string; password: string;
fullName: string;
}; };
}; };
const createUser = async (_parent: unknown, params: Params) => { const createUser = async (_parent: unknown, params: Params) => {
const { email, password } = params.input; const { email, password, fullName } = params.input;
const existingUser = await User.query().findOne({ email }); const existingUser = await User.query().findOne({ email });
@@ -19,6 +20,7 @@ const createUser = async (_parent: unknown, params: Params) => {
const user = await User.query().insert({ const user = await User.query().insert({
email, email,
password, password,
fullName,
role: 'user', role: 'user',
}); });

View File

@@ -335,6 +335,7 @@ input DeleteStepInput {
} }
input CreateUserInput { input CreateUserInput {
fullName: String!
email: String! email: String!
password: String! password: String!
} }
@@ -428,6 +429,7 @@ input StepInput {
type User { type User {
id: String id: String
fullName: String fullName: String
password: String
email: String email: String
role: String role: String
createdAt: String createdAt: String