export async function getUser<T extends Omit<UserFindUniqueArgs, "where">>(
userId: number,
options: T,
): Promise</** WHAT TO PUT HERE? */> {
const user = await database.user.findUnique({
where: { id: userId },
...options,
});
if (!user) {
throw data(
{ error: `User with ID "${userId}" does not exist` },
{ status: 400 },
);
}
return user;
}
export async function getUser<T extends Omit<UserFindUniqueArgs, "where">>(
userId: number,
options: T,
): Promise</** WHAT TO PUT HERE? */> {
const user = await database.user.findUnique({
where: { id: userId },
...options,
});
if (!user) {
throw data(
{ error: `User with ID "${userId}" does not exist` },
{ status: 400 },
);
}
return user;
}