searchUser.js
498 Bytes
import { prisma } from "../../../utils";
export default {
Query: {
searchUser: async (_, args) => {
const { term } = args;
try {
return prisma.user.findMany({
where: {
OR: [
{
name_contains: term,
},
{
email_contains: term,
},
],
},
});
} catch (error) {
console.log(error);
}
return null;
},
},
};