feat: citizenship built

This commit is contained in:
Ivan Rezchikov
2026-07-03 15:03:35 +03:00
parent c60ab9e8f9
commit 2eb0de5357
46 changed files with 1150 additions and 257 deletions
+17 -1
View File
@@ -12,6 +12,10 @@ type CreateData = {
birthRegion?: string | null;
naturalizationReason?: string | null;
address: string;
regionId?: string | null;
city?: string | null;
street?: string | null;
customAddress?: string | null;
height: string;
eyeColor: string;
};
@@ -28,6 +32,18 @@ export async function createApplication(userId: string, data: CreateData) {
export async function getUserApplications(userId: string) {
return prisma.citizenshipApplication.findMany({
where: { userId },
orderBy: { createdAt: "desc" },
orderBy: { createdAt: "asc" },
});
}
export async function getPendingApplications() {
return prisma.citizenshipApplication.findMany({
where: { status: "PENDING" },
orderBy: { createdAt: "desc" },
include: { user: true },
})
}
export async function getPendingApplicationsCount(): Promise<number> {
return prisma.citizenshipApplication.count({ where: { status: "PENDING" } })
}