60 lines
1.9 KiB
TypeScript
60 lines
1.9 KiB
TypeScript
import { eq } from "drizzle-orm";
|
|
|
|
import { db } from "@/db/client";
|
|
import { billingAddressVersions, editorialAccounts } from "@/db/schema";
|
|
|
|
import { requireEditorial } from "../access";
|
|
|
|
export default async function EditorialProfilePage() {
|
|
const principal = await requireEditorial();
|
|
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 (
|
|
<section className="editorial-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>
|
|
);
|
|
}
|