Files
wr.do/lib/user.ts
T
2024-07-26 22:08:57 +08:00

29 lines
510 B
TypeScript

import { prisma } from "@/lib/db";
export const getUserByEmail = async (email: string) => {
try {
const user = await prisma.user.findUnique({
where: {
email: email,
},
select: {
name: true,
emailVerified: true,
},
});
return user;
} catch {
return null;
}
};
export const getUserById = async (id: string) => {
try {
const user = await prisma.user.findUnique({ where: { id } });
return user;
} catch {
return null;
}
};