sdy

remove unnecessary fields

......@@ -3,8 +3,5 @@ type Mutation {
username: String!
email: String!
password: String!
phoneNum: String!
bio: String
avatarUrl: String
): AuthPayload!
}
......
import { prisma, generateToken, changePhoneNumber } from "../../../utils";
import { prisma, generateToken } from "../../../utils";
import bcrypt from "bcryptjs";
export default {
Mutation: {
createAccount: async (_, args) => {
const { username, password, email, phoneNum, bio, avatarUrl } = args;
const { username, password, email } = args;
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: {
username,
email,
password: encryptPw,
phoneNum: newPhoneNumber,
bio,
avatarUrl,
},
});
const token = generateToken(user.id);
......