feat: add editorial approval and account guards

This commit is contained in:
Leon Tonhäuser committed 2026-08-09 21:15:30 +02:00
1 parent a8d4e54ffb
commit 3584b4a7a7
9 files changed
+878 -1

No files matched your search

+61
View File
@@ -0,0 +1,61 @@
import { eq } from "drizzle-orm";
import { headers } from "next/headers";
import { db } from "@/db/client";
import { billingAddressVersions, editorialAccounts } from "@/db/schema";
import { requireActiveEditorial } from "@/modules/auth/principal";
export default async function EditorialProfilePage() {
const principal = await requireActiveEditorial(new Headers(await headers()));
const [editorial] = await db
.select({
name: editorialAccounts.name,
contactName: editorialAccounts.contactName,
loginEmail: editorialAccounts.loginEmail,
addressLine1: billingAddressVersions.addressLine1,
addressLine2: billingAddressVersions.addressLine2,
postalCode: billingAddressVersions.postalCode,
city: billingAddressVersions.city,
countryCode: billingAddressVersions.countryCode,
})
.from(editorialAccounts)
.leftJoin(
billingAddressVersions,
eq(editorialAccounts.currentBillingAddressVersionId, billingAddressVersions.id),
)
.where(eq(editorialAccounts.id, principal.editorialId))
.limit(1);
return (
<main className="portal-shell">
<section className="content-section" aria-labelledby="profile-title">
<p className="eyebrow">Redaktionskonto</p>
<h1 id="profile-title">Profil</h1>
<dl>
<dt>Redaktion</dt>
<dd>{editorial?.name}</dd>
<dt>Ansprechperson</dt>
<dd>{editorial?.contactName}</dd>
<dt>Anmelde-E-Mail</dt>
<dd>{editorial?.loginEmail}</dd>
<dt>Rechnungsadresse</dt>
<dd>
{editorial?.addressLine1 ? (
<address>
{editorial.addressLine1}
{editorial.addressLine2 ? <br /> : null}
{editorial.addressLine2}
<br />
{editorial.postalCode} {editorial.city}
<br />
{editorial.countryCode}
</address>
) : (
"Keine Rechnungsadresse hinterlegt."
)}
</dd>
</dl>
</section>
</main>
);
}