sdy

update createAccount resolver, typedefs

......@@ -3,6 +3,7 @@ type Mutation {
username: String!
email: String!
password: String!
password2: String!
bio: String
avatarUrl: String
phoneNum: String!
......
......@@ -4,13 +4,24 @@ import bcrypt from "bcryptjs";
export default {
Mutation: {
createAccount: async (_, args) => {
const { name, password, email, bio, avatarUrl, phoneNum } = args;
const {
username,
password,
password2,
email,
bio,
avatarUrl,
phoneNum,
} = args;
if (password !== password2) {
throw new Error("two password aren't same each other");
}
const encryptPw = await bcrypt.hash(password, 10);
// TODO: Find user's country code and change new phone number value
const newPhoneNumber = await changePhoneNumber(phoneNum, "+82");
const user = await prisma.user.create({
data: {
name,
username,
email,
bio,
avatarUrl,
......