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 (

Redaktionskonto

Profil

Redaktion
{editorial?.name}
Ansprechperson
{editorial?.contactName}
Anmelde-E-Mail
{editorial?.loginEmail}
Rechnungsadresse
{editorial?.addressLine1 ? (
{editorial.addressLine1} {editorial.addressLine2 ?
: null} {editorial.addressLine2}
{editorial.postalCode} {editorial.city}
{editorial.countryCode}
) : ( "Keine Rechnungsadresse hinterlegt." )}
); }