add: news search bar, application history
This commit is contained in:
@@ -2,9 +2,10 @@ import ReviewPageClient from "./client";
|
||||
import { getCurrentUser } from "@/lib/user";
|
||||
import { redirect } from "next/navigation";
|
||||
import { AccountMenu } from "../../account-menu";
|
||||
import { getPendingApplications } from "@/lib/citizenship/repository";
|
||||
import { getAllApplications } from "@/lib/citizenship/repository";
|
||||
import { getImageUrl } from "@/lib/image";
|
||||
import { Metadata } from "next";
|
||||
import { findUserById } from "@/lib/user/repository";
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: "Review citizenship applications",
|
||||
@@ -18,21 +19,31 @@ export default async function ReviewPage() {
|
||||
const user = await getCurrentUser();
|
||||
if (!user?.isAdmin) redirect("/account/citizenship");
|
||||
|
||||
const applications = await getPendingApplications();
|
||||
const applications = await getAllApplications();
|
||||
|
||||
const applicationsWithWarning = await Promise.all(
|
||||
applications.map(async (application) => ({
|
||||
...application,
|
||||
profileUrl: await getImageUrl(application.profileKey),
|
||||
signatureUrl: await getImageUrl(application.signatureKey),
|
||||
applications.map(async (application) => {
|
||||
const reviewerUser = application.reviewedBy
|
||||
? await findUserById(application.reviewedBy)
|
||||
: null;
|
||||
|
||||
nameMismatch:
|
||||
application.givenNames !== application.user.firstName ||
|
||||
application.surname !== application.user.secondName,
|
||||
return {
|
||||
...application,
|
||||
profileUrl: await getImageUrl(application.profileKey),
|
||||
signatureUrl: await getImageUrl(application.signatureKey),
|
||||
|
||||
previousCitizenship:
|
||||
application.user._count.citizenships > 0,
|
||||
}))
|
||||
nameMismatch:
|
||||
application.givenNames !== application.user.firstName ||
|
||||
application.surname !== application.user.secondName,
|
||||
|
||||
previousCitizenship:
|
||||
application.user._count.citizenships > 0,
|
||||
|
||||
reviewer: reviewerUser
|
||||
? { firstName: reviewerUser.firstName, secondName: reviewerUser.secondName }
|
||||
: null,
|
||||
};
|
||||
})
|
||||
);
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user