Merge branch 'phase/018-020-assistent'

This commit is contained in:
2026-10-12 11:19:33 +02:00
16 changed files with 1144 additions and 2 deletions
+44
View File
@@ -0,0 +1,44 @@
import { prisma } from "@/lib/db";
/** Was der Host-zu-Host-Assistent zur Auswahl braucht (#020) – nur oeffentliche Angaben. */
export async function assistentDaten() {
const [hosts, vorlagen] = await Promise.all([
prisma.host.findMany({
where: { archiviertAm: null },
select: {
id: true,
name: true,
adresse: true,
port: true,
bootstrapAm: true,
hostSchluessel: { where: { status: "VERTRAUT" }, select: { algorithmus: true, fingerprint: true } },
},
orderBy: { name: "asc" },
}),
prisma.vorlage.findMany({
where: { archiviertAm: null, kategorie: "DIENST" },
select: {
id: true,
name: true,
beschreibung: true,
standardLaufzeitTage: true,
zielbenutzer: true,
zielbenutzerAnlegen: true,
sudoModus: true,
sudoBefehle: true,
authorizedKeysOptionen: true,
sshConfigAlias: true,
knownHostsEintragen: true,
},
orderBy: [{ eingebaut: "desc" }, { name: "asc" }],
}),
]);
return {
hosts: hosts
.filter((h) => h.bootstrapAm !== null)
.map((h) => ({ id: h.id, name: h.name, adresse: h.adresse, port: h.port, hostKeys: h.hostSchluessel })),
vorlagen,
};
}
export type AssistentDaten = Awaited<ReturnType<typeof assistentDaten>>;