sdy

update create account

...@@ -5,5 +5,6 @@ type Mutation { ...@@ -5,5 +5,6 @@ type Mutation {
5 password: String! 5 password: String!
6 bio: String 6 bio: String
7 avatarUrl: String 7 avatarUrl: String
8 + phoneNumber: String
8 ): AuthPayload! 9 ): AuthPayload!
9 } 10 }
......
...@@ -4,7 +4,14 @@ import bcrypt from "bcryptjs"; ...@@ -4,7 +4,14 @@ import bcrypt from "bcryptjs";
4 export default { 4 export default {
5 Mutation: { 5 Mutation: {
6 createAccount: async (_, args) => { 6 createAccount: async (_, args) => {
7 - const { name, password, email, bio = "", avatarUrl = "" } = args; 7 + const {
8 + name,
9 + password,
10 + email,
11 + bio = "",
12 + avatarUrl = "",
13 + phoneNumber = "",
14 + } = args;
8 const encryptPw = await bcrypt.hash(password, 10); 15 const encryptPw = await bcrypt.hash(password, 10);
9 const user = await prisma.user.create({ 16 const user = await prisma.user.create({
10 data: { 17 data: {
...@@ -13,6 +20,7 @@ export default { ...@@ -13,6 +20,7 @@ export default {
13 bio, 20 bio,
14 avatarUrl, 21 avatarUrl,
15 password: encryptPw, 22 password: encryptPw,
23 + phoneNumber,
16 }, 24 },
17 }); 25 });
18 const token = generateToken(user.id); 26 const token = generateToken(user.id);
......