sdy

update search user

type Query {
searchUser(name: String!): [User!]!
searchUser(term: String!): [User!]!
}
......
......@@ -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;
},
},
};
......