sdy

update create account

......@@ -5,5 +5,6 @@ type Mutation {
password: String!
bio: String
avatarUrl: String
phoneNumber: String
): AuthPayload!
}
......
......@@ -4,7 +4,14 @@ import bcrypt from "bcryptjs";
export default {
Mutation: {
createAccount: async (_, args) => {
const { name, password, email, bio = "", avatarUrl = "" } = args;
const {
name,
password,
email,
bio = "",
avatarUrl = "",
phoneNumber = "",
} = args;
const encryptPw = await bcrypt.hash(password, 10);
const user = await prisma.user.create({
data: {
......@@ -13,6 +20,7 @@ export default {
bio,
avatarUrl,
password: encryptPw,
phoneNumber,
},
});
const token = generateToken(user.id);
......