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-25 01:00:15 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
4aff1bce4d6877eed649c9ed05991e6054ee9be1
4aff1bce
1 parent
9abde310
update search user
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
3 deletions
back/src/api/User/searchUser/searchUser.graphql
back/src/api/User/searchUser/searchUser.js
back/src/api/User/searchUser/searchUser.graphql
View file @
4aff1bc
type Query {
searchUser(
name
: String!): [User!]!
searchUser(
term
: String!): [User!]!
}
...
...
back/src/api/User/searchUser/searchUser.js
View file @
4aff1bc
...
...
@@ -3,8 +3,24 @@ import { prisma } from "../../../utils";
export
default
{
Query
:
{
searchUser
:
async
(
_
,
args
)
=>
{
const
{
name
}
=
args
;
const
user
=
await
prisma
.
user
.
findOne
({});
const
{
term
}
=
args
;
try
{
return
prisma
.
user
.
findMany
({
where
:
{
OR
:
[
{
name_contains
:
term
,
},
{
email_contains
:
term
,
},
],
},
});
}
catch
(
error
)
{
console
.
log
(
error
);
}
return
null
;
},
},
};
...
...
Please
register
or
login
to post a comment