fix(db): phase 4 group 6 — session guard, type safety, SQL filter fixes

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-07-23 17:33:48 +08:00
co-authored by Claude Sonnet 4.6
parent f591c0be18
commit dacc1a5265
4 changed files with 12 additions and 7 deletions
@@ -1,7 +1,8 @@
export const dynamic = 'force-dynamic'
import { notFound } from 'next/navigation'
import { notFound, redirect } from 'next/navigation'
import Link from 'next/link'
import { getSession } from '@/lib/auth/get-session'
import { asAdmin } from '@/lib/db/with-user'
import { incidents, sites, zones, trucks, users, evidenceFiles, investigations } from '@/lib/db/schema'
import { eq, and } from 'drizzle-orm'
@@ -16,6 +17,9 @@ interface Props {
export default async function SupervisorIncidentDetailPage({ params }: Props) {
const { id } = await params
const session = await getSession()
if (!session) redirect('/login')
const reporterAlias = aliasedTable(users, 'reporter')
const investigatorAlias = aliasedTable(users, 'investigator')