This commit is contained in:
Ivan Rezchikov
2026-07-28 17:05:45 +03:00
parent e826e7b099
commit e234407a17
30 changed files with 1873 additions and 74 deletions
+30
View File
@@ -0,0 +1,30 @@
import { getCurrentUser } from "@/lib/user";
import { redirect } from "next/navigation";
import CreateActClient from "./client";
import { Metadata } from "next";
import { getActTypes, getInstitutions, getRegions } from "@/lib/acts/repository";
import { getPositions, getUserPositions } from "@/lib/positions/repository";
export const metadata: Metadata = {
title: "Create act",
robots: { index: false, follow: false },
};
export default async function CreateAct() {
const user = await getCurrentUser();
if (!user) redirect("/");
const [actTypes, institutions, regions, positions, userPositions] = await Promise.all([
getActTypes(),
getInstitutions(),
getRegions(),
getPositions(),
getUserPositions(user.id),
]);
if (userPositions.length === 0) {
redirect("/");
}
return <CreateActClient actTypes={actTypes} institutions={institutions.filter((institution) => userPositions.some((position) => position.position.institutionId === institution.id))} regions={regions} positions={positions} />;
}