Consolidate audit-fixes branch: webhooks, integrations, and deploy hardening

Batch commit of the pending working tree on security/audit-fixes-2026-07.
Major areas:
- Outbound webhooks / Zapier: schema + signed delivery with retries, public
  v1 API (REST-hook subscribe/unsubscribe), settings UI, cron drain.
- Deploy hardening: email via SMTP2GO (Resend fully removed), verified DB TLS
  (DATABASE_SSL=require + DATABASE_CA), storage fails loud in production when
  Spaces is unconfigured instead of silently using ephemeral disk.
- Integrations & features (concurrent work): accounting (QuickBooks/Xero),
  e-signature (DocuSign/Dropbox Sign), PayPal, geocoding/maps, onboarding,
  expanded legal pages.
- DB migrations 0006–0009.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Leon Serfaty
2026-07-02 13:42:34 -04:00
co-authored by Claude Opus 4.8
parent 969d5d4c8a
commit c9968531e4
282 changed files with 41530 additions and 4013 deletions
+20 -10
View File
@@ -3,6 +3,7 @@ import { and, eq, desc } from "drizzle-orm"
import { db } from "@/lib/db"
import { tenants as tenantsTable, rent_payments, maintenance_requests, leases as leasesTable } from "@/lib/db/schema"
import { getSessionUser } from "@/lib/session"
import { getEffectiveOwnerId } from "@/lib/account"
import Link from "next/link"
import { formatCurrency, formatDate } from "@/lib/utils"
import { RentStatusBadge } from "@/components/dashboard/rent-status-badge"
@@ -10,15 +11,18 @@ import { MaintenanceStatusBadge, PriorityBadge } from "@/components/dashboard/ma
import { Mail, Phone } from "lucide-react"
import { CopyButton } from "@/components/shared/copy-button"
import { SendReminderButton } from "@/components/shared/send-reminder-button"
import { DeleteTenantButton } from "@/components/forms/delete-tenant-button"
export default async function TenantDetailPage({ params }: { params: Promise<{ tenantId: string }> }) {
const user = await getSessionUser()
if (!user) redirect("/login")
const ownerId = await getEffectiveOwnerId(user.id)
const { tenantId } = await params
const tenant = await db.query.tenants.findFirst({
where: and(eq(tenantsTable.id, tenantId), eq(tenantsTable.user_id, user.id)),
where: and(eq(tenantsTable.id, tenantId), eq(tenantsTable.user_id, ownerId)),
with: {
unit: { columns: { unit_number: true, rent_amount: true, bedrooms: true, bathrooms: true } },
property: { columns: { name: true, address_line1: true, city: true, state: true } },
@@ -31,19 +35,19 @@ export default async function TenantDetailPage({ params }: { params: Promise<{ t
db
.select()
.from(rent_payments)
.where(and(eq(rent_payments.user_id, user.id), eq(rent_payments.tenant_id, tenantId)))
.where(and(eq(rent_payments.user_id, ownerId), eq(rent_payments.tenant_id, tenantId)))
.orderBy(desc(rent_payments.due_date))
.limit(6),
db
.select()
.from(maintenance_requests)
.where(and(eq(maintenance_requests.user_id, user.id), eq(maintenance_requests.tenant_id, tenantId)))
.where(and(eq(maintenance_requests.user_id, ownerId), eq(maintenance_requests.tenant_id, tenantId)))
.orderBy(desc(maintenance_requests.created_at))
.limit(5),
db
.select()
.from(leasesTable)
.where(and(eq(leasesTable.user_id, user.id), eq(leasesTable.tenant_id, tenantId)))
.where(and(eq(leasesTable.user_id, ownerId), eq(leasesTable.tenant_id, tenantId)))
.orderBy(desc(leasesTable.created_at))
.limit(1),
])
@@ -74,12 +78,18 @@ export default async function TenantDetailPage({ params }: { params: Promise<{ t
</div>
</div>
</div>
<Link
href={`/tenants/${tenantId}/edit`}
className="rounded-lg border border-white/10 px-4 py-2 text-sm text-white/60 hover:border-white/20 hover:text-white transition"
>
Edit
</Link>
<div className="flex items-center gap-2">
<Link
href={`/tenants/${tenantId}/edit`}
className="rounded-lg border border-white/10 px-4 py-2 text-sm text-white/60 hover:border-white/20 hover:text-white transition"
>
Edit
</Link>
<DeleteTenantButton
tenantId={tenantId}
tenantName={`${tenant.first_name} ${tenant.last_name}`}
/>
</div>
</div>
<div className="grid gap-6 lg:grid-cols-3">