2024-06-29 05:22:22 +00:00
|
|
|
"use server";
|
|
|
|
|
|
|
|
import { getAuth } from "@/auth/queries/getauth";
|
2024-06-29 06:37:50 +00:00
|
|
|
import { daphnis } from "@/lib/prisma";
|
2024-06-29 05:22:22 +00:00
|
|
|
|
2024-06-29 07:12:29 +00:00
|
|
|
export async function getDaphnisInUseCards() {
|
2024-06-29 05:22:22 +00:00
|
|
|
const { user } = await getAuth();
|
|
|
|
|
|
|
|
if (!user || !user.accessCode) {
|
|
|
|
throw new Error("User is not authenticated or accessCode is missing");
|
|
|
|
}
|
|
|
|
|
2024-06-29 06:37:50 +00:00
|
|
|
const aimeUser = await daphnis.user.findFirst({
|
2024-06-29 05:22:22 +00:00
|
|
|
where: {
|
|
|
|
accessCode: user.accessCode,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
return aimeUser;
|
|
|
|
}
|