This commit is contained in:
Ivan Rezchikov
2026-07-11 21:20:57 +03:00
parent e192717466
commit 18161f4604
57 changed files with 1211 additions and 615 deletions
+5 -5
View File
@@ -38,7 +38,7 @@ export async function getApplicationEligibility(
};
}
const citizenship = await prisma.citizenship.findUnique({ where: { userId } });
const citizenship = await prisma.citizenship.findFirst({ where: { userId, revokedAt: null } });
if (citizenship && !citizenship.revokedAt) {
return {
eligible: false,
@@ -100,7 +100,7 @@ export async function getPendingApplicationsCount(): Promise<number> {
}
export async function getActiveCitizenship(userId: string) {
const citizenship = await prisma.citizenship.findUnique({ where: { userId } });
if (!citizenship || citizenship.revokedAt) return null;
return citizenship;
}
return prisma.citizenship.findFirst({
where: { userId, revokedAt: null },
});
}