Toggle navigation
Toggle navigation
This project
Loading...
Sign in
2020-1-capstone-design1
/
Triz_Project1
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
1
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
sdy
2020-05-11 18:49:39 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
7fa3ba5b410035ed3855c1ba810fc5371c40a314
7fa3ba5b
1 parent
203c1660
update createAccount resolver, typedefs
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
2 deletions
back/src/api/User/createAccount/createAccount.graphql
back/src/api/User/createAccount/createAccount.js
back/src/api/User/createAccount/createAccount.graphql
View file @
7fa3ba5
...
...
@@ -3,6 +3,7 @@ type Mutation {
username: String!
email: String!
password: String!
password2: String!
bio: String
avatarUrl: String
phoneNum: String!
...
...
back/src/api/User/createAccount/createAccount.js
View file @
7fa3ba5
...
...
@@ -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
,
user
name
,
email
,
bio
,
avatarUrl
,
...
...
Please
register
or
login
to post a comment