29 lines
510 B
TypeScript
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;
|
|
}
|
|
}; |