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-04-26 18:40:30 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
892884aee5740a7493ce6bf90d2d68efec600f98
892884ae
1 parent
965b19c6
update editProfile
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
3 deletions
back/src/api/User/editProfile/editProfile.graphql
back/src/api/User/editProfile/editProfile.js
back/src/api/User/editProfile/editProfile.graphql
View file @
892884a
type Mutation {
editProfile(
email: String!
name: String
email: String
bio: String
avatarUrl: String
phoneNum: String
): User!
}
...
...
back/src/api/User/editProfile/editProfile.js
View file @
892884a
import
{
prisma
}
from
"../../../utils"
;
import
{
isAuthenticated
,
prisma
}
from
"../../../utils"
;
export
default
{
Mutation
:
{
editProfile
:
async
(
_
,
args
,
{
request
})
=>
{},
editProfile
:
async
(
_
,
args
,
{
request
})
=>
{
isAuthenticated
(
request
);
const
{
name
,
email
,
avatarUrl
,
bio
,
phoneNum
}
=
args
;
const
user
=
await
prisma
.
user
.
findOne
({
where
:
{
email
,
},
});
if
(
user
)
{
const
updateUser
=
await
prisma
.
user
.
update
({
where
:
{
email
,
},
data
:
{
name
,
bio
,
avatarUrl
,
phoneNum
,
},
});
return
updateUser
;
}
else
{
throw
new
Error
(
"There is no such a user"
);
}
},
},
};
...
...
Please
register
or
login
to post a comment