daphnis/lib/GetUserAccessCode.ts
2024-06-29 02:25:52 -04:00

20 lines
440 B
TypeScript

"use server";
import { getAuth } from "@/auth/queries/getauth";
import { lachesis } from "@/lib/prisma";
export async function getLachesisInUseCards() {
const { user } = await getAuth();
if (!user || !user.accessCode) {
throw new Error("User is not authenticated or accessCode is missing");
}
const aimeUser = await lachesis.user.findFirst({
where: {
accessCode: user.accessCode,
},
});
return aimeUser;
}